tcp request

programming/perl 2010. 5. 10. 09:29 |
$ARGC=@ARGV;
if ($ARGC !=2) {
        print "Usage: $0 <host> <port>\n";
        print "Example: $0 192.168.1.210 445\n";
        exit;
}
use Socket;

my($remote,$port,$iaddr,$paddr,$proto);
$remote=$ARGV[0];
$port = $ARGV[1];

$iaddr = inet_aton($remote) or die "Error: $!";
$paddr = sockaddr_in($port, $iaddr) or die "Error: $!";
$proto = getprotobyname('tcp') or die "Error: $!";

socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "Error: $!";
#connect(SOCK, $paddr) or die "Error: $!";
connect(SOCK, $paddr);

$sploit="\x30\x30\x30";

print $sploit;
send(SOCK, $sploit,0 ) or die "Cannot send query: $!";
sleep(1);
close(SOCK);
exit;

'programming > perl' 카테고리의 다른 글

socket TCP server  (0) 2010.05.10
udp request  (0) 2010.05.10
외부파일실행예제  (0) 2010.04.28
웹페이지 긁어오기 예제  (0) 2010.04.09
HTTP 파일업로드(Perl)  (0) 2009.12.30
Posted by applicationlayer
: