I created a HTTP server, using Python3 and the http.server module:
from http.server import BaseHTTPRequestHandler
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
# Manage GET query
def do_POST(self):
# This is where I need help
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
if __name__ = '__main__':
# Run the server
What I would like is to read the POST query (from the client). I mean the entire raw query, in hexadecimal for example.
I tried with Scapy (it is installed), but:
from scapy.all import *
ImportError: No module named 'scapy'
I hope it is clear. So, if you have any idea, it would really help me. Thanks.
My bad. Actually my code was good, but my test was not.
So, I saw it on another post, the following is the code to get your data (not the entire request):
data = self.rfile.read(int(self.headers.get('Content-length')))