From: travisutk Date: Wed, 12 Jan 2011 11:33:30 +0000 (+0000) Subject: AutoTuner drops invalid Nordic RF MAC addresses. X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=434ea82441717de82c922cdfbc65d0a0d7e242f3 AutoTuner drops invalid Nordic RF MAC addresses. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@835 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/goodfet.nrf b/client/goodfet.nrf index 80f38fc..48b8263 100755 --- a/client/goodfet.nrf +++ b/client/goodfet.nrf @@ -256,10 +256,20 @@ class AutoTuner(): rate=self.client.peek(0x06); return "%02x,%s,%02x,%02x" % ( sync,mac,ch,rate); + def validmac(self,packet): + sync=self.client.RF_getsmac()&0xFF; + if (ord(packet[0])&0x80)^(sync&0x80): + #print "%02x%02x invalid entry." % (sync,ord(packet[0])); + return False; + return True; + def handle(self,packet): """Handles a packet.""" #printpacket(packet); - #self.packets.append(packet); + if not self.validmac(packet): + #print "Dropped packet:"; + #printpacket(packet); + return; addr=self.packetaddr(packet); #Increment the address count. @@ -340,11 +350,12 @@ if(sys.argv[1]=="autotune"): print "sync,mac,r5,r6"; #Now we're ready to get packets. while 1: - packet=None; - while packet==None: - packet=client.RF_rxpacket(); - guesser.handle(packet); - guesser.retune(); + for foo in range(1,10): + packet=None; + while packet==None: + packet=client.RF_rxpacket(); + guesser.handle(packet); + guesser.retune(); sys.stdout.flush(); if(sys.argv[1]=="sniffmskb"):