Book description
Discover practical solutions for a wide range of real-world network programming tasks
About This Book- Solve real-world tasks in the area of network programming, system/networking administration, network monitoring, and more.
- Familiarize yourself with the fundamentals and functionalities of SDN
- Improve your skills to become the next-gen network engineer by learning the various facets of Python programming
This book is for network engineers, system/network administrators, network programmers, and even web application developers who want to solve everyday network-related problems. If you are a novice, you will develop an understanding of the concepts as you progress with this book.
What You Will Learn- Develop TCP/IP networking client/server applications
- Administer local machines' IPv4/IPv6 network interfaces
- Write multi-purpose efficient web clients for HTTP and HTTPS protocols
- Perform remote system administration tasks over Telnet and SSH connections
- Interact with popular websites via web services such as XML-RPC, SOAP, and REST APIs
- Monitor and analyze major common network security vulnerabilities
- Develop Software-Defined Networks with Ryu, OpenDaylight, Floodlight, ONOS, and POX Controllers
- Emulate simple and complex networks with Mininet and its extensions for network and systems emulations
- Learn to configure and build network systems and Virtual Network Functions (VNF) in heterogeneous deployment environments
- Explore various Python modules to program the Internet
Python Network Programming Cookbook - Second Edition highlights the major aspects of network programming in Python, starting from writing simple networking clients to developing and deploying complex Software-Defined Networking (SDN) and Network Functions Virtualization (NFV) systems. It creates the building blocks for many practical web and networking applications that rely on various networking protocols. It presents the power and beauty of Python to solve numerous real-world tasks in the area of network programming, network and system administration, network monitoring, and web-application development.
In this edition, you will also be introduced to network modelling to build your own cloud network. You will learn about the concepts and fundamentals of SDN and then extend your network with Mininet. Next, you’ll find recipes on Authentication, Authorization, and Accounting (AAA) and open and proprietary SDN approaches and frameworks. You will also learn to configure the Linux Foundation networking ecosystem and deploy and automate your networks with Python in the cloud and the Internet scale.
By the end of this book, you will be able to analyze your network security vulnerabilities using advanced network packet capture and analysis techniques.
Style and approachThis book follows a practical approach and covers major aspects of network programming in Python. It provides hands-on recipes combined with short and concise explanations on code snippets. This book will serve as a supplementary material to develop hands-on skills in any academic course on network programming. This book further elaborates network softwarization, including Software-Defined Networking (SDN), Network Functions Virtualization (NFV), and orchestration. We learn to configure and deploy enterprise network platforms, develop applications on top of them with Python.
Table of contents
- Preface
-
Sockets, IPv4, and Simple Client/Server Programming
- Introduction
- Printing your machine's name and IPv4 address
- Retrieving a remote machine's IP address
- Converting an IPv4 address to different formats
- Finding a service name, given the port and protocol
- Converting integers to and from host to network byte order
- Setting and getting the default socket timeout
- Handling socket errors gracefully
- Modifying a socket's send/receive buffer sizes
- Changing a socket to the blocking/non-blocking mode
- Reusing socket addresses
- Printing the current time from the internet time server
- Writing an SNTP client
- Writing a simple TCP echo client/server application
- Writing a simple UDP echo client/server application
- Multiplexing Socket I/O for Better Performance
-
IPv6, Unix Domain Sockets, and Network Interfaces
- Introduction
- Forwarding a local port to a remote host
- Pinging hosts on the network with ICMP
- Waiting for a remote network service
- Enumerating interfaces on your machine
- Finding the IP address for a specific interface on your machine
- Finding whether an interface is up on your machine
- Detecting inactive machines on your network
- Performing a basic IPC using connected sockets (socketpair)
- Performing IPC using Unix domain sockets
- Finding out if your Python supports IPv6 sockets
- Extracting an IPv6 prefix from an IPv6 address
- Writing an IPv6 echo client/server
-
Programming with HTTP for the Internet
- Introduction
- Downloading data from an HTTP server
- Serving HTTP requests from your machine
- Extracting cookie information after visiting a website
- Submitting web forms
- Sending web requests through a proxy server
- Checking whether a web page exists with the HEAD request
- Spoofing Mozilla Firefox in your client code
- Saving bandwidth in web requests with the HTTP compression
- Writing an HTTP fail-over client with resume and partial downloading
- Writing a simple HTTPS server code with Python and OpenSSL
- Building asynchronous network applications with Twisted
- Building asynchronous network applications with Tornado
- Building concurrent applications with Tornado Future
-
Email Protocols, FTP, and CGI Programming
- Introduction
- Listing the files in a remote FTP server
- Uploading a local file to a remote FTP server
- Emailing your current working directory as a compressed ZIP file
- Downloading your Google email with POP3
- Checking your remote email with IMAP
- Sending an email with an attachment via Gmail SMTP server
- Writing a guestbook for your (Python-based) web server with CGI
- Finding the mail server from an email address
- Writing a simple SMTP server
- Writing a secure SMTP client using TLS
- Writing an email client with POP3
-
Programming Across Machine Boundaries
- Introduction
- Executing a remote shell command using telnet
- Copying a file to a remote machine by SFTP
- Printing a remote machine's CPU information
- Installing a Python package remotely
- Running a MySQL command remotely
- Transferring files to a remote machine over SSH
- Configuring Apache remotely to host a website
-
Working with Web Services – XML-RPC, SOAP, and REST
- Introduction
- Querying a local XML-RPC server
- Writing a multithreaded, multicall XML-RPC server
- Running an XML-RPC server with a basic HTTP authentication
- Collecting some photo information from Flickr using REST
- Searching for SOAP methods from an Amazon S3 web service
- Searching Amazon for books through the product search API
- Creating RESTful web applications with Flask
-
Network Monitoring and Security
- Introduction
- Sniffing packets on your network
- Saving packets in the pcap format using the pcap dumper
- Adding an extra header in HTTP packets
- Scanning the ports of a remote host
- Customizing the IP address of a packet
- Replaying traffic by reading from a saved pcap file
- Scanning the broadcast of packets
- Network Modeling
-
Getting Started with SDN
- Introduction
- SDN emulation with Mininet
- Developing Software-Defined Networks with OpenDaylight controller
- Developing Software-Defined Networks with ONOS controller
- Developing Software-Defined Networks with Floodlight controller
- Developing Software-Defined Networks with Ryu controller
- Developing Software-Defined Networks with POX controller
- Developing Software-Defined Networks visually with MiniEdit
- Authentication, Authorization, and Accounting (AAA)
- Open and Proprietary Networking Solutions
- NFV and Orchestration – A Larger Ecosystem
- Programming the Internet
Product information
- Title: Python Network Programming Cookbook - Second Edition
- Author(s):
- Release date: August 2017
- Publisher(s): Packt Publishing
- ISBN: 9781786463999
You might also like
book
Python Network Programming Techniques
Become well-versed with network programmability by solving the most commonly encountered problems using Python 3 and …
book
Python Network Programming
Power up your network applications with Python programming Key Features Master Python skills to develop powerful …
book
Learning Python Network Programming
Utilize Python 3 to get network applications up and running quickly and easily In Detail Network …
book
Python Cookbook
The Python Cookbook is a collection of problems, solutions, and practical examples for Python programmers, written …