| 1 | package App::pscan::Scanner; | ||||||||||
| 2 | 1 | ▶ | use Net::IP; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use App::pscan::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | |||||||||||
| 6 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 7 | 0 | my $self = shift; | |||||||||
| 8 | 0 | $self->_gen_range(shift); | |||||||||
| 9 | 0 | $self->scan(); | |||||||||
| 10 | |||||||||||
| 11 | } | ||||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub _gen_range() { | ||||||||
|
Subroutine
_gen_range: not called CC=8 SCAR=42.8
| |||||||||||
| 14 | 0 | my $self = shift; | |||||||||
| 15 | 0 | my $cmd=shift; | |||||||||
| 16 | 0 | my $Ip; | |||||||||
| 17 | my $Port; | ||||||||||
| 18 | 0 | ▶ | if($cmd=~/:/){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | ( $Ip, $Port ) = split( /:/, $cmd ); | |||||||||
| 20 | |||||||||||
| 21 | } else { | ||||||||||
| 22 | 0 | $Ip=$cmd; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | if ( my $IP = new Net::IP($Ip) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | $Ip=$IP; | |||||||||
| 27 | |||||||||||
| 28 | } | ||||||||||
| 29 | else { | ||||||||||
| 30 | 0 | info "Resolving $Ip"; | |||||||||
| 31 | 0 | $Ip = resolve($Ip); | |||||||||
| 32 | 0 | $Ip =new Net::IP($Ip); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | if ( !defined($Ip) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | error "! No ip to scan"; | |||||||||
| 37 | 0 | exit; | |||||||||
| 38 | } else { | ||||||||||
| 39 | 0 | info '- starting scan -'; | |||||||||
| 40 | |||||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | my ( $f, $l ) = generate_ports($Port) if $Port; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | info 'Scanning for ' . ( ( $l + 1 ) - $f ) . ' port(s)' if $Port; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | |||||||||||
| 47 | 0 | $self->{'IP'} = $Ip; | |||||||||
| 48 | 0 | ▶ | $self->{'first'} = $f if $Port; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | ▶ | $self->{'last'} = $l if $Port; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | |||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||