+if(sys.argv[1]=="sniffcrypt"):
+ print "Zigbee crypto is pretty damned complicated, and this doesn't work yet.";
+ #Just broadcast.
+ client.RF_promiscuity(1);
+ client.RF_setsmac(0xFFFFFFFF);
+ client.RF_autocrc(1);
+ #client.poke(0x19, 0x03C7); #SECCTRL0, enabling CCM crypto w/ KEY0
+ client.poke(0x19, 0x03C6); #SECCTRL0, enabling CTRL crypto w/ KEY0
+
+ #What follows is the nonce.
+ client.poke(0x20, 0x000a); #SECCTRL1, skipping 10 bytes of header
+
+ if len(sys.argv)>2:
+ key=int(sys.argv[2],16);
+ nonce=int(sys.argv[3],16);
+
+ print "Setting KEY0 to %x" % key;
+ print "Setting NONCE to %x" % nonce;
+ client.RF_setkey(key);
+ client.RF_setnonce(nonce);
+ if len(sys.argv)>3:
+ freq=eval(sys.argv[3]);
+ if freq>100:
+ client.RF_setfreq(freq);
+ else:
+ client.RF_setchan(freq);
+ client.CC_RFST_RX();
+ print "Listening as %010x on %i MHz" % (client.RF_getsmac(),
+ client.RF_getfreq()/10**6);
+ #Now we're ready to get packets.
+ while 1:
+ packet=None;
+ while packet==None:
+ packet=client.RF_rxpacketdec();
+ client.printpacket(packet);
+ sys.stdout.flush();
+