Skip to content

Instantly share code, notes, and snippets.

@opless
Created February 28, 2017 20:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save opless/d1effc2eefdf2dfe3b1a6418979bc8ba to your computer and use it in GitHub Desktop.
Save opless/d1effc2eefdf2dfe3b1a6418979bc8ba to your computer and use it in GitHub Desktop.
#!/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