+
+#Some quick functions for yanking values out of a packet.
+def srcadr(packet):
+ """Returns the source address of a packet as an integer."""
+ return ord(packet[4])+(ord(packet[5])<<8);
+def isencrypted(packet):
+ """Returns true if the packet is encrypted.""";
+ try:
+ return ord(packet[1])&0x08;
+ except:
+ return False;
+def pktnonceseq(packet):
+ """Returns the nonce sequence of a packet."""
+ nonce=0;
+ for byte in [0xa,9,8,7]:
+ nonce=(nonce<<8)|ord(packet[byte]);
+ return nonce;
+