From e5eb7f8d3bc38e6ebb15c5cbb6afb6aec01ce2e7 Mon Sep 17 00:00:00 2001 From: martinp876 Date: Mon, 25 May 2015 14:28:13 +0000 Subject: [PATCH] 10_CUL_HM: harden attack detection checking for 2 old commands git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@8635 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_CUL_HM.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm index f29c24f07..e6d9cbe08 100755 --- a/fhem/FHEM/10_CUL_HM.pm +++ b/fhem/FHEM/10_CUL_HM.pm @@ -992,10 +992,9 @@ sub CUL_HM_Parse($$) {######################################################### my ($evntCnt,undef) = split(' last_at:',$dstH->{"prot"."ErrIoId_$src"},2); push @evtEt,[$dstH,1,"sabotageAttackId:ErrIoId_$src cnt:$evntCnt"]; } - if( defined $dstH->{helper}{cSnd} && - $dstH->{helper}{cSnd} ne substr($msg,7)){ - Log3 $dname,2,"CUL_HM $dname attack:$dstH->{helper}{cSnd}:".substr($msg,7)."."; + $dstH->{helper}{cSnd} =~ m/substr($msg,7)/){ + Log3 $dname,2,"CUL_HM $dname attack:$dstH->{helper}{cSnd}:".substr($msg,7); CUL_HM_eventP($dstH,"ErrIoAttack"); my ($evntCnt,undef) = split(' last_at:',$dstH->{"prot"."ErrIoAttack"},2); push @evtEt,[$dstH,1,"sabotageAttack:ErrIoAttack cnt:$evntCnt"]; @@ -5407,7 +5406,8 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response else{ CUL_HM_respWaitSu ($hash,"cmd:=$cmd","mNo:=$mNo","reSent:=$rss"); } - $hash->{helper}{cSnd} = substr($cmd,8); + $hash->{helper}{cSnd} =~ s/.*,// if($hash->{helper}{cSnd}); + $hash->{helper}{cSnd} .= ",".substr($cmd,8); } elsif($mTp eq '11'){ my $to = ""; @@ -5420,7 +5420,8 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response } } CUL_HM_respWaitSu ($hash,"cmd:=$cmd","mNo:=$mNo","reSent:=$rss",$to); - $hash->{helper}{cSnd} = substr($cmd,8); + $hash->{helper}{cSnd} =~ s/.*,// if($hash->{helper}{cSnd}); + $hash->{helper}{cSnd} .= ",".substr($cmd,8); } elsif($mTp eq '12' && $mFlg & 0x10){#wakeup with burst # response setup - do not repeat, set counter to 250