-
Notifications
You must be signed in to change notification settings - Fork 100
/
check.pl
40 lines (40 loc) · 869 Bytes
/
check.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env perl
use strict;
use warnings;
use lib qw(lib ../lib);
use HTML::Form::XSS;
use WWW::Mechanize;
use Data::Dumper;
if(scalar(@ARGV) != 1){ #check command line args
print "Usage: $0 <URL with form>\n";
exit(1);
}
my $url = $ARGV[0];
my $mech = WWW::Mechanize->new();
$mech->get($url);
my @forms = $mech->forms();
foreach my $form (@forms){
print "Found form:\n";
print $form->dump();
print "Test it (y/n)?";
my $answer = <STDIN>;
chomp $answer;
if($answer ne "y"){
next;
}
my $checker = HTML::Form::XSS->new($mech, config => '/home/config.xml');
my @results = $checker->do_audit($form);
my $vuln = 0;
foreach my $result (@results){
if($result->vulnerable()){
$vuln = 1;
my $example = $result->example();
print "Example of vulnerable URL: $example\n";
last;
}
}
if(!$vuln){
print "Form not vulnerable :-)\n";
}
}
exit();