Skip to Main Content
Hands-On Penetration Testing on Windows
book

Hands-On Penetration Testing on Windows

by Phil Bramwell
July 2018
Intermediate to advanced content levelIntermediate to advanced
452 pages
11h 51m
English
Packt Publishing
Content preview from Hands-On Penetration Testing on Windows

Building a Python server

Now, we're going to set up a simple server. I say simple server, which may make you think something like an HTTP server with just basic functionality—no, I mean simple. This will simply listen for connections and take an action upon receipt of data. Let's take a look:

#!/usr/bin/pythonimport socketimport threadinghost_ip = '0.0.0.0'host_port = 45678server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)server.bind((host_ip, host_port))server.listen(4)print "Server is up. Listening on %s:%d" % (host_ip, host_port)def connect(client_socket):    received = client_socket.recv(1024)    print "Received from remote client:\n-----------\n%s\n-----------\n" % received    client_socket.send("Always listening, comrade!\n\r") print ...
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

Hands-On Web Penetration Testing with Metasploit

Hands-On Web Penetration Testing with Metasploit

Harpreet Singh, Himanshu Sharma
Metasploit Penetration Testing Cookbook - Third Edition

Metasploit Penetration Testing Cookbook - Third Edition

Nipun Jaswal, Daniel Teixeira, Abhinav Singh, Monika Agarwal
Web Penetration Testing with Kali Linux - Third Edition

Web Penetration Testing with Kali Linux - Third Edition

Gilberto Najera-Gutierrez, Juned Ahmed Ansari

Publisher Resources

ISBN: 9781788295666Supplemental Content