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

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 ...
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