return range(min,max,1);
#If we get here, there are no points. Return empty set.
return [];
- def buildglitchvoltages(self):
+ def crunch(self):
"""This builds tables for glitching voltage ranges from the training set."""
- print "Precomputing glitching ranges. This might take a while.";
+ print "Precomputing glitching ranges. This might take a long while.";
+ print "Times...";
sys.stdout.flush();
- self.db.execute("create temporary table glitchrange(time integer primary key asc,max,min);");
+ self.db.execute("drop table if exists glitchrange;");
+ self.db.execute("create table glitchrange(time integer primary key asc,max,min);");
self.db.execute("insert into glitchrange(time,max,min) select distinct time, 0, 0 from glitches;");
+ print "Maximums...";
+ sys.stdout.flush();
self.db.execute("update glitchrange set max=(select max(vcc) from glitches where glitches.time=glitchrange.time and count=0);");
+ print "Minimums...";
+ sys.stdout.flush();
self.db.execute("update glitchrange set min=(select min(vcc) from glitches where glitches.time=glitchrange.time and count>0);");
-
+ print "Ranges calculated.";
def graphx11(self):
try:
import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils
tstop=self.client.glitchstarttime();
times=range(tstart,tstop);
random.shuffle(times);
- self.buildglitchvoltages();
+ #self.crunch();
count=0.0;
- total=1.0*len(t);
+ total=1.0*len(times);
for t in times:
voltages=self.glitchvoltages(t);
count=count+1.0;
On a sample chip for the same model as the target,
1) Run 'goodfet $chip learn' in order to learn the glitching voltages.
-2) Run 'goodfet $chip explore' to find a time at which to glitch.
+2) Run 'goodfet $chip crunch' in order to precompute glitching ranges.
+3) Run 'goodfet $chip explore' to find a time at which to glitch.
Then on a chip to be extracted,
3) Run 'goodfet $chip exploit' to exploit a chip and recover its firmware."""
glitcher.graph();
exit();
+if(sys.argv[2]=="crunch"):
+ glitcher.crunch();
+ exit();
+
glitcher.setup(sys.argv[1]);
if(sys.argv[2]=="learn"):