/ README.md
README.md
 1  # Burp HTTPParser
 2  
 3  Small Python class to parse "raw" (string) BurpSuite requests.
 4  
 5  ContentType supported:
 6  - Standard POST data
 7  - multipart/form-data
 8  - JSON
 9  
10  
11  ## Usage
12  
13  Using this request as exemple:
14  ```
15  POST /test HTTP/1.1
16  Host: example.com
17  Upgrade-Insecure-Requests: 1
18  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
19  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
20  Accept-Encoding: gzip, deflate
21  Accept-Language: en-US,en;q=0.9
22  Content-Type: application/x-www-form-urlencoded
23  Connection: close
24  
25  param1=test&param2=anotherparam
26  ```
27  Example script:
28  ```python
29  from httpParser import HttpParser
30  
31  with open("sample_req.txt", "r") as f:
32      raw_req=f.read()
33  
34  parsed_req=HttpParser(raw_req)
35  print(f"""Host: {parsed_req.host}
36  Path: {parsed_req.path}
37  Method: {parsed_req.method}
38  Headers: {parsed_req.headers}
39  Params: {parsed_req.params}
40  """)
41  ```
42  Return:
43  ```
44  Host: example.com
45  Path: /test
46  Method: POST
47  Headers: {'Host': 'example.com', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.9', 'Content-Type': 'application/x-www-form-urlencoded', 'Connection': 'close'}
48  Params: {'param1': 'test', 'param2': 'anotherparam'}
49  ```
50  
51  ## Notes
52  
53  As I only needed to parse POST requests, HttpParser doesn't work on GET requests yet.  
54  Please give me sample requests when creating issues :)
55  
56  
57