X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETMCPCANCommunication.py;h=21bdfc073e8cc9849da6668be4ff61d2cd87641e;hp=d0c86c5038bcb4e5c8d4d65c982d03221e2825a9;hb=7455b09fe011c4abe0a725a7078f7f103b6cf093;hpb=1b4e85faa00f19e4cef2c658ebc95b672dba62c0 diff --git a/client/GoodFETMCPCANCommunication.py b/client/GoodFETMCPCANCommunication.py index d0c86c5..21bdfc0 100644 --- a/client/GoodFETMCPCANCommunication.py +++ b/client/GoodFETMCPCANCommunication.py @@ -67,6 +67,7 @@ class GoodFETMCPCANCommunication: def reset(self): self.client.MCPsetup(); + ########################## # SNIFF ########################## @@ -192,13 +193,33 @@ class GoodFETMCPCANCommunication: row.append(0); #since we don't check for errors if we're not in debug mode... row.append(comment) + #write packet to file for byte in packet: row.append("%02x"%ord(byte)); dataWriter.writerow(row); outfile.close() print "Listened for %d seconds, captured %d packets." %(duration,packetcount); - + return packetcount + + + def filterStdSweep(self, freq = freq, time = 5): + msgIDs = [] + niff(self,freq,duration,description, verbose=True, comment=None, filename=None, standardid=None, debug = False): + for i in range(0, 2047, 6): + print "sniffing id: %d, %d, %d, %d, %d, %d" % (i,i+1,i+2,i+3,i+4,i+5) + comment = "sweepFilter_%d_%d_%d_%d_%d_%d" % (i,i+1,i+2,i+3,i+4,i+5) + description = "Running a sweep filer for all the possible standard IDs. This run filters for: %d, %d, %d, %d, %d, %d" % (i,i+1,i+2,i+3,i+4,i+5) + count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [i, i+1, i+2, i+3, i+4, i+5]) + if( count != 0): + for j in range(i,i+5): + comment = "sweepFilter: %d" % (j) + description = "Running a sweep filer for all the possible standard IDs. This run filters for: %d " % j + count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [j]) + if( count != 0): + msgIDs.append(j) + return msgIDs + def sniffTest(self, freq): rate = freq; @@ -420,6 +441,7 @@ if __name__ == "__main__": if(args.verb=="snifftest"): comm.sniffTest(freq=freq) + ########################## # FREQ TEST ########################## @@ -433,6 +455,8 @@ if __name__ == "__main__": if(args.verb=="freqtest"): comm.freqtest(freq=freq) + + ########################## # iSniff ##########################