From: travisutk Date: Fri, 19 Feb 2010 22:01:31 +0000 (+0000) Subject: Beginnings of smartcard client. X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=5d28f76d0b8e8fa540ffb5409ba5e9408cede34a;ds=sidebyside Beginnings of smartcard client. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@335 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/GoodFETAVR.py b/client/GoodFETAVR.py index c0af361..f480017 100644 --- a/client/GoodFETAVR.py +++ b/client/GoodFETAVR.py @@ -55,7 +55,7 @@ class GoodFETAVR(GoodFET): }; def setup(self): - """Move the FET into the SPI application.""" + """Move the FET into the AVR application.""" self.writecmd(self.AVRAPP,0x10,0,self.data); #SPI/SETUP def trans(self,data): diff --git a/client/GoodFETSmartCard.py b/client/GoodFETSmartCard.py new file mode 100755 index 0000000..135ad0d --- /dev/null +++ b/client/GoodFETSmartCard.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# GoodFET SPI and SPIFlash Client Library +# +# (C) 2009 Travis Goodspeed +# +# This code is being rewritten and refactored. You've been warned! + +import sys, time, string, cStringIO, struct, glob, serial, os; + +from GoodFET import GoodFET; + +class GoodFETSmartCard(GoodFET): + SMARTCARDAPP=0x73; + APP=SMARTCARDAPP; + + def setup(self): + """Move the FET into the SmartCard application.""" + self.writecmd(self.APP,0x10,0,self.data); + def start(self): + """Start the connection, reat ATR.""" + self.writecmd(self.APP,0x20,0,None); diff --git a/client/goodfet.cc b/client/goodfet.cc index 3c00dc7..6682650 100755 --- a/client/goodfet.cc +++ b/client/goodfet.cc @@ -90,6 +90,8 @@ if(sys.argv[1]=="dumpdata"): h.write_hex_file(f); if(sys.argv[1]=="status"): print "Status: %s" %client.CCstatusstr(); +if(sys.argv[1]=="info"): + print "%s" % client.CCidentstr(); if(sys.argv[1]=="erase"): print "Status: %s" % client.CCstatusstr(); client.CCchiperase(); diff --git a/client/goodfet.sc b/client/goodfet.sc new file mode 100755 index 0000000..115be85 --- /dev/null +++ b/client/goodfet.sc @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import sys; +import binascii; + +from GoodFETSmartCard import GoodFETSmartCard; +from intelhex import IntelHex16bit, IntelHex; + +#Initialize FET and set baud rate +client=GoodFETSmartCard(); +client.serInit() + +#Connect to target +client.start();