Skip to content

Instantly share code, notes, and snippets.

@milankragujevic
Forked from opless/zmodo-client.pl
Created February 25, 2020 11:25
Show Gist options
  • Save milankragujevic/467a5d1feed6c730e8cafddfacdbacc0 to your computer and use it in GitHub Desktop.
Save milankragujevic/467a5d1feed6c730e8cafddfacdbacc0 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