X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETGlitch.py;h=383609b87ec4be494e2a58a38a3fdbeadd0a6ce3;hp=06bb511eb98fffcc3ef4867163a750591597930f;hb=aaa8df93b42a926aab0cede6f70835089663fafc;hpb=a88155352fa58c4e30359cf07afe6b14289c9c7a diff --git a/client/GoodFETGlitch.py b/client/GoodFETGlitch.py index 06bb511..383609b 100644 --- a/client/GoodFETGlitch.py +++ b/client/GoodFETGlitch.py @@ -5,7 +5,7 @@ # # This code is being rewritten and refactored. You've been warned! -import sys, time, string, cStringIO, struct, glob, serial, os, random; +import sys, time, string, cStringIO, struct, glob, os, random; import sqlite3; from GoodFET import *; @@ -208,10 +208,10 @@ class GoodFETGlitch(GoodFET): tstop=self.client.glitchstarttime(); tstep=0x1; #Must be 1 self.scan(lock,trials,range(vstart,vstop),range(tstart,tstop)); - print "Learning phase complete, beginning to crunch."; + print "Learning phase complete, begin to crunch."; self.crunch(); - print "Crunch phase complete, beginning to explore."; - self.explore(); + #print "Crunch phase complete, beginning to explore."; + #self.explore(); def scansetup(self,lock): client=self.client; @@ -220,18 +220,24 @@ class GoodFETGlitch(GoodFET): client.erase(); print "Scanning %s" % client.infostring(); - self.secret=0x49; + #Kind of arbitrary. + #16 bit minimum. + self.secret=0xdead; + + + print "-- Setting secret"; + client.start(); + + #Flash the secret, to try and recover it later. + client.erase(); + print "-- Secret was %02x" % client.getsecret(); + client.setsecret(self.secret); + print "-- Secret set to %02x" % client.getsecret(); + sys.stdout.flush() + if(client.getsecret()!=self.secret): + print "Secret failed to set. Exiting for safety."; + sys.exit(); - while(client.getsecret()!=self.secret): - print "-- Setting secret"; - client.start(); - - #Flash the secret to the first two bytes of CODE memory. - client.erase(); - print "-- Secret was %02x" % client.getsecret(); - client.setsecret(self.secret); - sys.stdout.flush() - #Lock chip to unlock it later. if lock>0: client.lock();