forked from cyal1/PyBurp
-
Notifications
You must be signed in to change notification settings - Fork 2
/
encryptedCompleteBody.py
33 lines (19 loc) · 1.12 KB
/
encryptedCompleteBody.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
# https://portswigger.github.io/burp-extensions-montoya-api/javadoc/burp/api/montoya/http/message/requests/HttpRequest.html
# https://portswigger.github.io/burp-extensions-montoya-api/javadoc/burp/api/montoya/http/message/responses/HttpResponse.html
def encrypt(s):
return base64encode(s)
def decrypt(s):
return base64decode(s).toString()
def urlPrefixAllowed(urls):
urls.add("https://httpbin.org/base64/U0ZSVVVFSkpUaUJwY3lCaGQyVnpiMjFs")
# curl -XGET -d "aGVsbG8g" -x http://127.0.0.1:8080/ "https://httpbin.org/base64/U0ZSVVVFSkpUaUJwY3lCaGQyVnpiMjFs"
def handleRequest(request, annotations):
print(request.bodyToString())
body = request.bodyToString() + "world"
return request.withBody(encrypt(body)), annotations
def handleProxyRequest(request, annotations):
return request.withBody(decrypt(request.bodyToString())), annotations
def handleResponse(response, annotations):
return response.withBody(decrypt(response.bodyToString())), annotations
def handleProxyResponse(response, annotations):
return response.withBody(encrypt(response.bodyToString())), annotations # encrypt body to browser