Skip to content

Commit 781356a

Browse files
committed
bug fix: failed to get first line of the request/response
1 parent 8b4e001 commit 781356a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ m0nst3r(Song Xinlei) @ CFCA
2323
- changed default pyro4 port, avoiding brida conflicts
2424
- migration to python3
2525
- dynamic context menu items extracted from your python script
26+
- add `first_line` variable to `header` dict
2627

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

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

45+
> Note: header["first_line"] ==> `GET /XXX/yyy.php?param1=hello HTTP/1.1`.
46+
4447
```python
4548
class Burpy:
4649
'''

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>me.m0nst3r</groupId>
44
<artifactId>burpy</artifactId>
5-
<version>2.0-SNAPSHOT</version>
5+
<version>2.1-SNAPSHOT</version>
66
<name>burpy</name>
77
<description>burp plugin to run custom python</description>
88
<properties>

res/burpyServicePyro3.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def parse_headers(self, s):
3434

3535
def parse_headers_and_body(self,s):
3636
try:
37-
crlfcrlf = b"\x0d\x0a\x0d\x0a"
37+
crlfcrlf = "\r\n\r\n".encode('utf-8')
3838
crlfcrlfIndex = s.find(crlfcrlf)
3939
headers = s[:crlfcrlfIndex + len(crlfcrlf)].decode("utf-8")
4040
body = s[crlfcrlfIndex + len(crlfcrlf):]
@@ -52,7 +52,8 @@ def build(self):
5252
# if(isRequest):
5353
# get headers as dict
5454
newhttp = list()
55-
newhttp.append(self.first_line)
55+
first_line = self.headers.pop("first_line")
56+
newhttp.append(first_line)
5657
for k in self.headers.keys():
5758
newhttp.append("{}: {}".format(k,self.headers[k]))
5859

@@ -91,7 +92,7 @@ def get_methods(self):
9192

9293
def invoke_method(self,method_name, data):
9394
data = http(b64d(data))
94-
95+
data.headers.update({"first_line":data.first_line})
9596
func = getattr(self.burpy, method_name)
9697
if data is None:
9798
return "Parse HTTP data failed"

0 commit comments

Comments
 (0)