From: <lu...@us...> - 2009-10-04 13:26:39
|
Revision: 317 http://pyscard.svn.sourceforge.net/pyscard/?rev=317&view=rev Author: ludov Date: 2009-10-04 13:26:23 +0000 (Sun, 04 Oct 2009) Log Message: ----------- try to find card description for a given ATR Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2009-10-04 11:17:03 UTC (rev 316) +++ trunk/contrib/parseATR/parseATR.py 2009-10-04 13:26:23 UTC (rev 317) @@ -652,6 +652,25 @@ return "\n".join([colorize(t) for t in text]) +def match_atr(atr): + """ try to find card description for a given ATR """ + card = [] + file = open("smartcard_list.txt") + for line in file: + if line.startswith("#"): + continue + line = line.rstrip("\n") + + if line == atr: + # found the ATR + for desc in file: + if desc == "\n": + break; + # get all the possible card descriptions + card.append(desc.strip()) + file.close() + return card + if __name__ == "__main__": import sys if len(sys.argv) > 1: @@ -663,3 +682,9 @@ print "ATR:", ATR text = atr_display_txt(atr) print text + + card = match_atr(ATR) + if card: + print "\nPossibly identified card:", " ".join(card) + else: + print "\nUnknown card" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |