Created
February 28, 2017 20:01
-
-
Save opless/d1effc2eefdf2dfe3b1a6418979bc8ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use IO::Socket ; | |
use IO::Handle ; | |
my $host = $ARGV[0] || "localhost"; | |
my $port = $ARGV[1] || 8000; | |
STDERR->autoflush(1); | |
STDOUT->autoflush(1); | |
my $data = ""; | |
my $sock = new IO::Socket::INET( | |
PeerAddr => $host, | |
PeerPort => $port, | |
Proto => 'tcp', | |
Timeout => 30) ; | |
if (! $sock) { die "ERROR! Can't connect\n" ;} | |
$sock->autoflush(1); | |
print $sock "\x55\x55\xaa\xaa\x00\x00\x00\x00\x00\x00\x00\x50"; | |
if( ! read($sock, $data, 16) ) { die "Error"; } | |
while(read($sock, $data, 2048)) | |
{ | |
print $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment