Skip to content

Commit

Permalink
bug fix: failed to get first line of the request/response
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-m0nst3r committed Jul 18, 2020
1 parent 8b4e001 commit 781356a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ m0nst3r(Song Xinlei) @ CFCA
- changed default pyro4 port, avoiding brida conflicts
- migration to python3
- dynamic context menu items extracted from your python script
- add `first_line` variable to `header` dict

# Usage (`=v2.0`)
> NOTE: MAKE SURE YOU HAVE ALL DEPENDENCIES INSTALLED, INCLUDING THE DEPENDENCIES NEEDED FOR YOUR PYTHON SCRIPT
Expand All @@ -41,6 +42,8 @@ Just write your own logic to modify the header/body as your need, and return the

All functions will be extracted to generate context menu, except thos with `_`, `__`prefix!

> Note: header["first_line"] ==> `GET /XXX/yyy.php?param1=hello HTTP/1.1`.
```python
class Burpy:
'''
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.m0nst3r</groupId>
<artifactId>burpy</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.1-SNAPSHOT</version>
<name>burpy</name>
<description>burp plugin to run custom python</description>
<properties>
Expand Down
7 changes: 4 additions & 3 deletions res/burpyServicePyro3.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def parse_headers(self, s):

def parse_headers_and_body(self,s):
try:
crlfcrlf = b"\x0d\x0a\x0d\x0a"
crlfcrlf = "\r\n\r\n".encode('utf-8')
crlfcrlfIndex = s.find(crlfcrlf)
headers = s[:crlfcrlfIndex + len(crlfcrlf)].decode("utf-8")
body = s[crlfcrlfIndex + len(crlfcrlf):]
Expand All @@ -52,7 +52,8 @@ def build(self):
# if(isRequest):
# get headers as dict
newhttp = list()
newhttp.append(self.first_line)
first_line = self.headers.pop("first_line")
newhttp.append(first_line)
for k in self.headers.keys():
newhttp.append("{}: {}".format(k,self.headers[k]))

Expand Down Expand Up @@ -91,7 +92,7 @@ def get_methods(self):

def invoke_method(self,method_name, data):
data = http(b64d(data))

data.headers.update({"first_line":data.first_line})
func = getattr(self.burpy, method_name)
if data is None:
return "Parse HTTP data failed"
Expand Down

0 comments on commit 781356a

Please sign in to comment.