Server side

Lets start with the server side. Building a TCP server in Python is quite simple:

# Python For Offensive PenTest: A Complete Practical Course - All rights reserved # Follow me on LinkedIn https://jo.linkedin.com/in/python2# Basic TCP Server import socket # For Building TCP Connectiondef connect():        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # start a socket object 's'        s.bind(("10.0.2.15", 8080)) # define the kali IP and the listening port        s.listen(1) # define the backlog size, since we are expecting a single connection from a single                                                            # target we will listen to one connection        print '[+] Listening for incoming TCP connection on port 8080'     conn, addr = s.accept() # accept() function will return the connection object ...

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.