Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 2 - Introduction to Python > Network Communications - Pg. 57

Network communications 57 NETWORK COMMUNICATIONS When we are doing network penetration testing and need a custom script, Python is a common solution. The network libraries are plentiful, and the basic socket manipulation routes that can be used for exploit building are easy to use. Here we will explore the networking concepts in two separate sections: client communica- tions and server communications. Client communications Client communications will encompass much of what we do with sockets. We will initially focus on using basic sockets. They will come in handy when building network exploits, doing raw socket functions, or when we need some quick network- fu to accomplish a task. For more extensive network protocols, it makes sense to use Python modules that will handle the hard parts of protocols. Connecting to a host involves two operations: creating a socket, and connecting that socket to the remote host. Let's look at the code and then examine what each operation means: