NAME
Masscan::Scanner - A Perl module which helps in using the masscan port scanner.
VERSION
version 20200329.150259
SYNOPSIS
my @hosts = qw(::1 127.0.0.1) ;
my @ports = qw(22 80 443 1-100) ;
my @arguments = qw(--banners) ;
my $mas = Masscan::Scanner->new( hosts => \ @hosts , ports => \ @ports , arguments => \ @arguments );
$mas ->add_host( '10.0.0.1' );
$mas ->add_host( '10.0.0.0/24' );
$mas ->add_port(25);
$mas ->add_port(110);
$mas ->add_port( '1024-2048' );
$mas ->add_port( '3000-65535' );
$mas ->add_host( 'averna.id.au' );
$mas ->add_host( 'duckduckgo.com' );
$mas ->sudo(1);
$mas ->verbose(1);
$mas ->add_argument( '--rate 100000' );
$mas ->binary( '/usr/bin/masscan' );
$mas ->name_servers([ '192.168.0.100' , '192.168.0.101' ]);
my $scan = $mas ->scan;
my $res = $mas ->scan_results if ( $scan );
|
METHODS
add_host
This method allows the addition of a host to the host list to be scaned.
my $mas = Masscan::Scanner->new();
$mas ->add_host( '127.0.0.1' );
|
add_port
This method allows the addition of a port or port range to the port list to be scaned.
my $mas = Masscan::Scanner->new();
$mas ->add_port(443);
$mas ->add_port( '1-65535' );
|
add_argument
This method allows the addition of masscan command line arguments.
my $mas = Masscan::Scanner->new( hosts => [ '127.0.0.1' , '10.0.0.1' ], ports => [80. 443]);
$mas ->add_argument( '--banners' );
$mas ->add_argument( '--rate 100000' );
|
scan
Will initiate the scan of what hosts & ports have been provided.
Returns true fi the scan was successful otherwise returns false.
my $mas = Masscan::Scanner->new();
$mas ->hosts([ '127.0.0.1' , '::1' ]);
$mas ->ports([ '22' , '80' , '443' ]);
$mas ->add_port( '1024' );
$mas ->scan;
|
scan_results
Returns the result of the masscan as a Perl data structure.
my $mas = Masscan::Scanner->new();
$mas ->hosts([ '127.0.0.1' , '::1' ]);
$mas ->ports([ '22' , '80' , '443' ]);
$mas ->add_port( '1024' );
my $scan = $mas ->scan;
if ( $scan )
{
my $res = $mas ->scan_results;
}
|
SCAN RESULTS
The scan_results method returns a data structure like so:
{
'scan_results' => [
{
'timestamp' => '1584816181' ,
'ip' => '10.0.0.1' ,
'ports' => [
{
'status' => 'open' ,
'reason' => 'syn-ack' ,
'port' => 443,
'proto' => 'tcp' ,
'ttl' => 60
}
]
},
{
'timestamp' => '1584816181' ,
'ip' => '10.0.0.2' ,
'ports' => [
{
'reason' => 'syn-ack' ,
'status' => 'open' ,
'port' => 443,
'ttl' => 60,
'proto' => 'tcp'
}
]
},
{
'ports' => [
{
'port' => 80,
'ttl' => 60,
'proto' => 'tcp' ,
'reason' => 'syn-ack' ,
'status' => 'open'
}
],
'ip' => '10.0.0.1' ,
'timestamp' => '1584816181'
},
{
'ip' => '10.0.0.2' ,
'timestamp' => '1584816181' ,
'ports' => [
{
'port' => 80,
'ttl' => 60,
'proto' => 'tcp' ,
'status' => 'open' ,
'reason' => 'syn-ack'
}
]
},
{
'timestamp' => '1584816181' ,
'ip' => '10.0.0.3' ,
'ports' => [
{
'reason' => 'syn-ack' ,
'status' => 'open' ,
'proto' => 'tcp' ,
'ttl' => 111,
'port' => 80
}
]
},
{
'ports' => [
{
'ttl' => 111,
'proto' => 'tcp' ,
'port' => 443,
'reason' => 'syn-ack' ,
'status' => 'open'
}
],
'timestamp' => '1584816181' ,
'ip' => '10.0.0.3'
}
],
'masscan' => {
'scan_stats' => {
'total_hosts' => 4,
'up_hosts' => 3
},
'command_line' => '/usr/bin/masscan --rate 100000 --banners -p 22,80,443,61222,25 10.0.0.2,10.0.0.1,10.0.0.3,10.0.0.4'
}
};
|
AUTHOR
Sarah Fuller <averna@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by Sarah Fuller.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.