X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETGlitch.py;h=383609b87ec4be494e2a58a38a3fdbeadd0a6ce3;hp=52ce187df980d9450a3f61b72dba6f786e4ca154;hb=3ce12eeaf2628956df8b10ebf0e2824a229cdc93;hpb=1ef22a7f7983e4bb7513686cd573776a8338c904 diff --git a/client/GoodFETGlitch.py b/client/GoodFETGlitch.py index 52ce187..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 *; @@ -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();