-
-
Save danhart102/a8bc9fb6f8547645c93407683c089c26 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