From 760a463e7f47c3fa5b7c0c92d532562b04289b9a Mon Sep 17 00:00:00 2001 From: travisutk Date: Sat, 11 Dec 2010 18:56:26 +0000 Subject: [PATCH] Shellcode is now only loaded when a new filename is presented. Old code remains in place without reloading, which significantly reduces the number of dropped Simpliciti packets. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@789 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETCC.py | 25 +++++++++++++------------ client/goodfet.cc | 12 +++++++++--- shellcode/chipcon/cc1110/reflex.c | 5 +++-- shellcode/chipcon/cc1110/rxpacket.c | 14 +++++--------- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/client/GoodFETCC.py b/client/GoodFETCC.py index 67c1be9..01b6668 100644 --- a/client/GoodFETCC.py +++ b/client/GoodFETCC.py @@ -126,21 +126,22 @@ class GoodFETCC(GoodFET): hz=freq*396.728515625; return hz; + lastshellcode="none"; def shellcodefile(self,filename,wait=1): """Run a fragment of shellcode by name.""" #FIXME: should identify chip model number, use shellcode for that chip. - file=__file__; - file=file.replace("GoodFETCC.pyc","GoodFETCC.py"); - path=file.replace("client/GoodFETCC.py","shellcode/chipcon/cc1110/"); - #print "File\t%s" % file; - #print "Path\t%s" % path; - filename=path+filename; - #print "Loading shelcode from %s" % filename; - - #Load the shellcode. - h=IntelHex(filename); - for i in h._buf.keys(): - self.CCpokedatabyte(i,h[i]); + + if self.lastshellcode!=filename: + self.lastshellcode=filename; + file=__file__; + file=file.replace("GoodFETCC.pyc","GoodFETCC.py"); + path=file.replace("client/GoodFETCC.py","shellcode/chipcon/cc1110/"); + filename=path+filename; + + #Load the shellcode. + h=IntelHex(filename); + for i in h._buf.keys(): + self.CCpokedatabyte(i,h[i]); #Execute it. self.CCdebuginstr([0x02, 0xf0, 0x00]); #ljmp 0xF000 diff --git a/client/goodfet.cc b/client/goodfet.cc index e8de384..20b0405 100755 --- a/client/goodfet.cc +++ b/client/goodfet.cc @@ -48,11 +48,16 @@ def handlesimplicitipacket(packet): port=packet[9]; info=packet[10]; seq=packet[11]; - #payload begins at byte 12. + #payload begins at byte 10. - - if port==0x03: + if port==0x20: + #data packet + x=packet[11]; + y=packet[13]; + z=packet[15]; + print "%02x: %i %i %i" % (seq,x,y,z); + elif port==0x03: #print "Join request."; if packet[12]!=1: print "Not a join request. WTF?"; @@ -145,6 +150,7 @@ if(sys.argv[1]=="reflex"): rssi=0; rssi=client.peek8(0xFE00,"xdata"); print "Activated jamming with RSSI of %i, going again for another packet." % rssi; + #client.CCdebuginstr([0x02, 0xf0, 0x00]); #ljmp 0xF000 client.resume(); RFST=0xDFE1 diff --git a/shellcode/chipcon/cc1110/reflex.c b/shellcode/chipcon/cc1110/reflex.c index 6bfec59..ced2f90 100644 --- a/shellcode/chipcon/cc1110/reflex.c +++ b/shellcode/chipcon/cc1110/reflex.c @@ -19,12 +19,13 @@ void main(){ RFTXRXIE=0; //idle a bit. - RFST=RFST_SIDLE; - while(MARCSTATE!=MARC_STATE_IDLE); + //RFST=RFST_SIDLE; + //while(MARCSTATE!=MARC_STATE_IDLE); while(1){ //Wait for the transmission. RFST=RFST_SRX; + while(MARCSTATE!=MARC_STATE_RX); rssi=0; //Wait for RSSI to settle. sleepMillis(10); diff --git a/shellcode/chipcon/cc1110/rxpacket.c b/shellcode/chipcon/cc1110/rxpacket.c index a294aac..5ba32a5 100644 --- a/shellcode/chipcon/cc1110/rxpacket.c +++ b/shellcode/chipcon/cc1110/rxpacket.c @@ -17,8 +17,8 @@ void main(){ RFTXRXIE=0; //idle a bit. - RFST=RFST_SIDLE; - while(MARCSTATE!=MARC_STATE_IDLE); + //RFST=RFST_SIDLE; + //while(MARCSTATE!=MARC_STATE_IDLE); //Begin to receive. RFST=RFST_SRX; @@ -28,13 +28,9 @@ void main(){ while(!RFTXRXIF); //Wait for byte to be ready. RFTXRXIF=0; //Clear the flag. - if (MARCSTATE == MARC_STATE_RX) { - packet[i]=RFD; //Grab the next byte. - i++; - len=packet[0]; //First byte of the packet is the length. - }else - HALT; - + packet[i]=RFD; //Grab the next byte. + i++; + len=packet[0]; //First byte of the packet is the length. } RFST = RFST_SIDLE; //End receive. HALT; -- 2.20.1