3 import sys,binascii,time,random;
5 sys.path.append('../../../trunk/client/')
7 from GoodFETAVR import GoodFETAVR;
8 from GoodFETGlitch import *;
9 from intelhex import IntelHex16bit, IntelHex;
14 glitcher=GoodFETGlitch();
17 print "Usage: %s chip verb [objects]\n" % sys.argv[0];
18 print "%s avr learn" % sys.argv[0];
19 print "%s avr explore" % sys.argv[0];
20 print "%s avr graph" % sys.argv[0];
21 print "%s avr graphx11" % sys.argv[0];
22 print "%s avr points" % sys.argv[0];
24 This populates a database, glitch.db, with a record of all attempted
25 glitches. Graphs can then be generated from the results, allowing
26 results to be replicated on different hardware and models. The general
27 sequence for a new chip is as follows.
29 On a sample chip for the same model as the target,
30 1) Run 'goodfet $chip learn' in order to learn the glitching voltages.
31 2) Run 'goodfet $chip crunch' in order to precompute glitching ranges.
32 3) Run 'goodfet $chip explore' to find a time at which to glitch.
34 Then on a chip to be extracted,
35 3) Run 'goodfet $chip exploit' to exploit a chip and recover its firmware."""
39 if(sys.argv[2]=="graphx11"):
42 if(sys.argv[2]=="graph"):
45 if(sys.argv[2]=="points"):
49 if(sys.argv[2]=="crunch"):
53 glitcher.setup(sys.argv[1]);
55 if(sys.argv[2]=="learn"):
57 if(sys.argv[2]=="explore"):
59 if(sys.argv[2]=="exploit"):