X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2Fgoodfet.nrf;fp=client%2Fgoodfet.nrf;h=57766c4413f6e2995d6f72ca04919140be627e11;hp=ec3535ed8d5c204c5bf257f88bbaca8010e8b31c;hb=24f2f10289211210c754d91093e7e4e38692dc42;hpb=a0c78ba4e0584022cb65e683ce4a316c900f5842 diff --git a/client/goodfet.nrf b/client/goodfet.nrf index ec3535e..57766c4 100755 --- a/client/goodfet.nrf +++ b/client/goodfet.nrf @@ -268,6 +268,7 @@ class AutoTuner(): rate=False; chan=False; sync=False; + startch=0; #Useful for forcing an early match. def init(self,goodfet, rate=True,chan=True,sync=True): """Initializes a link to the GoodFET for autotuning.""" @@ -279,6 +280,11 @@ class AutoTuner(): client.poke(0x00,0x00); #Stop nRF client.poke(0x01,0x00); #Disable Shockburst client.poke(0x02,0x01); #Set RX Pipe 0 + + #Disable shockburst. + client.poke(0x1C,0x00); + client.poke(0x1D,0x00); + client.RF_setmaclen(2); # SETUP_AW for shortest #historic @@ -317,10 +323,12 @@ class AutoTuner(): def handle(self,packet): """Handles a packet.""" #printpacket(packet); + if not self.validmac(packet): - #print "Dropped packet:"; + #print "Dropped packet from %s" % self.packetaddr(packet,justmac=True); #printpacket(packet); return; + addr=self.packetaddr(packet); #Increment the address count. @@ -342,6 +350,7 @@ class AutoTuner(): It's important that this not get triggered by false positives.""" while 1: + self.retune(); start=time.mktime(time.localtime()); while (time.mktime(time.localtime())-start) < delay: packet=None; @@ -356,7 +365,6 @@ class AutoTuner(): #Tune it in here? client.tune(addr); return addr; - self.retune(); sys.stdout.flush(); def retune(self): @@ -388,7 +396,7 @@ class AutoTuner(): if self.chan: self.client.poke(0x05, - (count+0x12)&0x7f); + (count+self.startch)&0x7f); print "Tuned to %i MHz" % ( self.client.RF_getfreq() /(10**6)); @@ -459,9 +467,9 @@ if(sys.argv[1]=="sniffmskb"): print "Searching for a keyboard."; guesser=AutoTuner(); - guesser.init(client, rate=False, sync=True, chan=False); + guesser.init(client, rate=False, sync=True, chan=True); guesser.selftune(threshold=4,forever=False, - delay=3.0); + delay=10.0); client.poke(0x00,0x00); #Stop nRF client.poke(0x01,0x00); #Disable Shockburst