From: chrishoder Date: Tue, 19 Feb 2013 05:45:06 +0000 (+0000) Subject: added and debugged two new experiment methods. one listens and responds the other... X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=cae3f0dc7730f5ea7a991fba0e4dc6f863145785 added and debugged two new experiment methods. one listens and responds the other will fuzz all possible ids git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1508 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/experiments.py b/client/experiments.py index c2ce9bd..54bb823 100644 --- a/client/experiments.py +++ b/client/experiments.py @@ -175,7 +175,7 @@ class experiments(GoodFETMCPCANCommunication): self.client.txpacket(packet) ## listen for 2 packets. one should be the rtr we requested the other should be ## a new packet response - starttime = time.time() + starttime = tT.time() while ((time.time() - starttime) < duration): #listen for the given duration time period packet = self.client.rxpacket() if( packet == None): @@ -307,7 +307,7 @@ class experiments(GoodFETMCPCANCommunication): packet[i+5] = value print packet #put a rough time stamp on the data and get all the data bytes - row = [time.time(), id_new,8] + row = [time.tT(), id_new,8] msg = "Injecting: " for i in range(5,13): row.append(packet[i]) @@ -315,12 +315,12 @@ class experiments(GoodFETMCPCANCommunication): #print msg dataWriter.writerow(row) self.client.txpacket(packet) - time.sleep(period/1000) + tT.sleep(period/1000) #inject the packet the given number of times. for i in range(1,writesPerFuzz): self.client.MCPrts(TXB0=True) - time.sleep(period/1000) + tT.sleep(period/1000) fuzzNumber += 1 print "Fuzzing Complete" outfile.close() @@ -354,8 +354,8 @@ class experiments(GoodFETMCPCANCommunication): #generate a fuzzed packet for i in range(0,8): # for each data byte, fuzz it idx = "db%d"%i - limits = dbLimits[idx] - value = random.randint(limits[0],limits[1]) #generate pseudo-random integer value + + value = random.randint(0, 255) #generate pseudo-random integer value packet[i+5] = value print packet #put a rough time stamp on the data and get all the data bytes @@ -395,9 +395,9 @@ class experiments(GoodFETMCPCANCommunication): """@todo: make this only load the data onto the chip and not send """ self.client.txpacket(resPacket) self.addFilter([listenID,listenID,listenID,listenID]) #listen only for this packet - startTime = time.time() + startTime = tT.time() packet = None - while( (time.time() - startTime) < time): + while( (tT.time() - startTime) < time): packet = self.client.rxpacket() if( packet != None): print "packet read in, responding now" @@ -407,18 +407,19 @@ class experiments(GoodFETMCPCANCommunication): if( listenPacket == None): # no packets given, just want the id for i in range(0,repeats): self.client.MCPrts(TXB0=True) - time.sleep(period/1000) + tT.sleep(period/1000) else: #compare packets for i in range(0,8): idx = 5 + i byteIn = ord(packet[idx]) - compareIn = erspondPacket[i] + compareIn = respondPacket[i] if( byteIn != compareIn): packet == None + print "packet did not match" break if( packet ): - self.client(MCPrts(TXB0=True)) - time.sleep(period/1000) + self.client.MCPrts(TXB0=True) + tT.sleep(period/1000) print "Response Listening Terminated."