O'Reilly logo

iOS and OS X Network Programming Cookbook by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a simple port scanner using libnet and libpcap together

In Chapter 3, Using Libnet, we discussed how to use libnet to inject packets into the network. In this chapter, we discussed how to use libpcap to capture and analyze the incoming packets. The next logical question is, "How can we use libnet and libpcap to create some really awesome network security tools?" This recipe is written to show you how we can use libnet and libpcap together.

We will build a simple port scanner that scans a range of ports on a remote device and lists whether that port is open or closed. We will implement a SYN scan. This is a scan that sends a packet with the SYN flag set, and if the port is open, the remote device will respond with a packet that has the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required