Introduction
Libnet is a library that allows developers to construct and inject individual network packets. The libnet API hides most of the packet creation low-level details from the developer and allows the developer to quickly create and inject simple packets. Not only can libnet be used to create very powerful network security and monitoring tools, but it can also be used for malicious activities.
Note
While it is possible to compile libnet for the iPhone, if your app constructs custom packets and injects them into the network, Apple will probably reject your app. The code in this chapter is written and tested for OS X; it may or may not work on iOS.
When computers on an IP network wish to communicate, they exchange packets. These packets contain two types of information that are as follows:
Control information (header): The header provides information that the network needs to route the packet to the correct destination. This includes source and destination addresses, checksums, control...