-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py.py
37 lines (28 loc) · 1.29 KB
/
test.py.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
from burp import IBurpExtender, IHttpListener
class BurpExtender(IBurpExtender, IHttpListener):
def registerExtenderCallbacks(self, callbacks):
self._callbacks = callbacks
self._helpers = callbacks.getHelpers()
callbacks.registerHttpListener(self)
callbacks.setExtensionName("Hello Extension")
print("Hello Burp")
callbacks.issueAlert("Hello alerts!")
def getResponseHeaderAndBody(self, content):
response = content.getResponse()
response_data = self._helpers.analyzeResponse(response)
headers = list(response_data.getHeaders())
body = response[response_data.getBodyOffset():].decode('utf-8')
return headers, body
#.tostring()
def processHttpMessage(self, tool, is_request, content):
if is_request:
return
headers, body = self.getResponseHeaderAndBody(content)
# modify body
body = body.replace("Cloud", "Butt")
body = body.replace("cloud", "Butt")
body = body.replace("Cloud", "butt")
body = body.replace("cloud", "butt")
new_message = self._helpers.buildHttpMessage(headers, body.encode('utf-8'))
content.setResponse(new_message)