## 解析原始http请求包

类似sqlmap里面的-r选项，直接解析http原始请求的小工具

可以直接使用从burpsuite复制的请求，支持base64编码，防止二进制数据在复制的时候出错

## 使用示例

```python
from ParseRawHTTP import ParseRawHTTP

Raw_HTTP_Str = '''POST /login HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 25
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
DNT: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 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: zh-CN,zh;q=0.9
x-forwarded-for: 127.0.0.1
Connection: close

username=rayi&password=11

'''

http_url,http_method,http_headers_dict,http_body = ParseRawHTTP(Raw_HTTP_Str)
print("URL : http://" + http_url)
print("+--------------------------------------------------------------------+")
print("Headers : " , http_headers_dict)
print("+--------------------------------------------------------------------+")
print("Body : ", http_body.decode('utf8'))
print("+--------------------------------------------------------------------+\n")

# req = requests.request(method=http_method,url = http_url,headers=http_headers_dict,data=http_body).text
# print(req)

File_Upload = '''
POST / HTTP/1.1
Host: 192.168.39.2:8000
Pragma: no-cache
Cache-Control: no-cache
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 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: zh-CN,zh;q=0.9
Cookie: PHPSESSID=rayi
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryfhBkNluTJKBLYIEw
Content-Length: 352


------WebKitFormBoundaryfhBkNluTJKBLYIEw
Content-Disposition: form-data; name="PHP_SESSION_UPLOAD_PROGRESS"

asd

------WebKitFormBoundaryfhBkNluTJKBLYIEw
Content-Disposition: form-data; name="upload"; filename="<?php system('cat /flag');?>"
Content-Type: image/gif

G

------WebKitFormBoundaryfhBkNluTJKBLYIEw--

'''


http_url,http_method,http_headers_dict,http_body = ParseRawHTTP(File_Upload)
print("URL : http://" + http_url)
print("+--------------------------------------------------------------------+")
print("Headers : " , http_headers_dict)
print("+--------------------------------------------------------------------+")
print("Body : ", http_body.decode('utf8'))
print("+--------------------------------------------------------------------+\n")

Upload_Binary_File = ''' '''

http_url,http_method,http_headers_dict,http_body = ParseRawHTTP(Upload_Binary_File,is_base64=True)
print("URL : http://" + http_url)
print("+--------------------------------------------------------------------+")
print("Headers : " , http_headers_dict)
print("+--------------------------------------------------------------------+")
print("Body : ", http_body)
print("+--------------------------------------------------------------------+\n")
```

