Designing our own live host scanner

Let's now write our own host scanner program in Perl. We will be using a few new Perl modules, which will be described as we go over the code in the description:

#!/usr/local/bin/perl5.18.2 -w use strict; use Net::Pcap qw( :functions ); use Net::Frame::Device; use Net::Netmask; use Net::Frame::Dump::Online; use Net::ARP; use Net::Frame::Simple; my $err = ""; my $dev = pcap_lookupdev(\$err); # from Net::Pcap my $devProp = Net::Frame::Device->new(dev => $dev); my $ip = $devProp->ip; my $gateway = $devProp->gatewayIp; my $netmask = new Net::Netmask($devProp->subnet); my $mac = $devProp->mac; my $netblock = $ip . ":" . $netmask->mask(); my $filterStr = "arp and dst host ".$ip; my $pcap = Net::Frame::Dump::Online->new( ...

Get Penetration Testing with Perl now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.