Name:
Anonymous
2009-04-23 2:52
ITT we post short, useful programs.
Name:
Anonymous
2009-04-23 6:06
#!/usr/bin/perl
# Ad-hoc открытие двери на 4-й этаж посылкой пакета
# который я увидел в wireshark к БСК.
use strict;
use IO::Socket;
sub dehex($){join "",pack "C*",map hex,shift=~/([0-9a-zA-Z]{2}) \s*/gx}
sub hexdump($){join " ",map{sprintf "%02x",unpack "C",$_}split //,shift}
my $handle=IO::Socket::INET->new(
Proto=>'udp',PeerAddr=>"192.168.1.211",PeerPort=>1030)
or die "socket: $@";
send $handle,dehex "4effffffffffff17000002032874",0
or die "send: $!";
recv $handle,my $response,1000,0
or die "recv: $!";
$response eq dehex "4e17024f4bff"
or die "Wrong response: ".hexdump $response