mesh/dbg.pl: fix dequoting. Add "c"orrupt packet

This commit is contained in:
Stefan `Sec` Zehl 2012-01-05 12:53:28 +01:00
parent 701d17e5a1
commit 14107d9b1d
1 changed files with 16 additions and 1 deletions

View File

@ -43,12 +43,12 @@ if($cmd =~ /^r/){
my $rr=""; my $rr="";
if (@fh = $sel->can_read(100)) { if (@fh = $sel->can_read(100)) {
sysread($fh[0],$rr,1024); sysread($fh[0],$rr,1024);
$rr=~s/\\\\/\\/g;
$read.=$rr; $read.=$rr;
} }
}; };
while ($read =~ s/\\1(.*?)\\0//){ while ($read =~ s/\\1(.*?)\\0//){
my $str=$1; my $str=$1;
$str=~s/\\\\/\\/g;
my $cs=substr($str,0,length($str)-2); my $cs=substr($str,0,length($str)-2);
my $crc=unpack("n",substr($str,length($str)-2,2)); my $crc=unpack("n",substr($str,length($str)-2,2));
my $crc2= crcccitt($cs),"\n"; my $crc2= crcccitt($cs),"\n";
@ -167,6 +167,21 @@ if($cmd =~ /^r/){
$par.=chr(shift); #gen $par.=chr(shift); #gen
$par.=pack("N",scalar(time)+1*60*60+ 600); $par.=pack("N",scalar(time)+1*60*60+ 600);
$par.= pack("C",shift||0);
$par.= pack("C",0);
$par.= pack("C",0);
$par.= pack("C",0);
$par.=pack("N",0);
$par.=pack("N",0);
$par.=pack("N",0);
$par.=pack("N",0);
$par.=pack("N",0);
}elsif($scmd eq "c"){
$par.="\x1";
$par.=chr(shift); #gen
$par.=pack("N",scalar(time)+1*60*60+ 600);
$par.= pack("C",shift||0); $par.= pack("C",shift||0);
$par.= pack("C",0); $par.= pack("C",0);
$par.= pack("C",0); $par.= pack("C",0);