added packet fuzzing
[goodfet] / client / GoodFETConsole.py
index ca23bb9..a7eccd3 100644 (file)
@@ -11,6 +11,23 @@ import binascii;
 from GoodFET import GoodFET;
 from intelhex import IntelHex;
 
+
+#grep CMD GoodFETConsole.py | grep def | sed s/\(sel.\*// | sed 's/def CMD//'
+commands="""
+    info
+    lock
+    erase
+    test
+    status
+    halt
+    resume
+    peek
+    flash
+    dump
+    where
+    chip
+"""
+
 class GoodFETConsole():
     """An interactive goodfet driver."""
     
@@ -19,6 +36,7 @@ class GoodFETConsole():
         client.serInit();
         client.setup();
         client.start();
+        client.loadsymbols();
     def prompt(self):
         sys.stdout.write("gf% ");
         sys.stdout.flush();
@@ -33,6 +51,11 @@ class GoodFETConsole():
             self.prompt();
     def handle(self, str):
         """Handle a command string.  First word is command."""
+        #Lines beginning with ? are cries for help.
+        if(str[0]=="?"):  
+            print "Term Commands:"
+            print commands
+            return;
         #Lines beginning with # are comments.
         if(str[0]=="#"):  return;
         #Lines beginning with ! are Python.
@@ -74,11 +97,15 @@ class GoodFETConsole():
     def CMDresume(self,args):
         print self.client.resume();
     def CMDpeek(self,args):
-        adr=eval(args[1]);
+        adr=args[1];
         memory="vn";
         if(len(args)>2):
             memory=args[2];
-        print "0x%08x:= 0x%04x" % (adr, self.client.peek16(adr,memory));
+        adr= self.client.name2adr(adr);
+        #print "%i" % adr;
+        print "0x%08x:= 0x%04x" % (
+            adr, self.client.peek16(adr,
+                                  memory));
     def CMDflash(self,args):
         file=args[1];
         self.client.flash(self.expandfilename(file));