From: <lu...@us...> - 2009-12-18 17:14:37
|
Revision: 365 http://pyscard.svn.sourceforge.net/pyscard/?rev=365&view=rev Author: ludov Date: 2009-12-18 17:14:30 +0000 (Fri, 18 Dec 2009) Log Message: ----------- improve display of "Possibly identified card" list Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2009-12-15 09:12:05 UTC (rev 364) +++ trunk/contrib/parseATR/parseATR.py 2009-12-18 17:14:30 UTC (rev 365) @@ -712,6 +712,6 @@ card = match_atr(ATR) if card: - print "Possibly identified card:", " ".join(card) + print "Possibly identified card:", "\n\t".join(card) else: print "Unknown card" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2009-12-31 10:48:19
|
Revision: 366 http://pyscard.svn.sourceforge.net/pyscard/?rev=366&view=rev Author: ludov Date: 2009-12-31 10:48:12 +0000 (Thu, 31 Dec 2009) Log Message: ----------- add missing \n Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2009-12-18 17:14:30 UTC (rev 365) +++ trunk/contrib/parseATR/parseATR.py 2009-12-31 10:48:12 UTC (rev 366) @@ -569,7 +569,7 @@ (lcs, sw1, sw2) = status[:3] text.append(" Mandatory status indicator (3 last bytes)\n") - text.append(" LCS (life card cycle): %d (%s)" % (lcs, life_cycle_status(lcs))) + text.append(" LCS (life card cycle): %d (%s)\n" % (lcs, life_cycle_status(lcs))) text.append(" SW: %02X%02X (%s)" % (sw1, sw2, "")) #Chipcard::PCSC::Card::ISO7816Error("$sw1 $sw2")) elif hb_category == 0x80: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-02-11 19:53:16
|
Revision: 371 http://pyscard.svn.sourceforge.net/pyscard/?rev=371&view=rev Author: ludov Date: 2010-02-11 19:52:47 +0000 (Thu, 11 Feb 2010) Log Message: ----------- TBi = BWI defined only for T=1. Invalid ATR? Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-02-05 21:11:26 UTC (rev 370) +++ trunk/contrib/parseATR/parseATR.py 2010-02-11 19:52:47 UTC (rev 371) @@ -222,6 +222,8 @@ CWI = v % 16 text = "Block Waiting Integer: %d - Character Waiting Integer: %d" % (BWI, CWI) + else: + text = "BWI defined only for T=1. Invalid ATR?" return text def TC1(v): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-02-12 08:26:25
|
Revision: 372 http://pyscard.svn.sourceforge.net/pyscard/?rev=372&view=rev Author: ludov Date: 2010-02-12 08:26:18 +0000 (Fri, 12 Feb 2010) Log Message: ----------- Add TBi (i>2) parsing according to ETSI TS 102 221 V8.3.0 (2009-08) Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-02-11 19:52:47 UTC (rev 371) +++ trunk/contrib/parseATR/parseATR.py 2010-02-12 08:26:18 UTC (rev 372) @@ -216,14 +216,24 @@ return TBn(4, v) def TBn(i, v): - text = "" + text = "Undocumented" if (T == 1): BWI = v >> 4 CWI = v % 16 text = "Block Waiting Integer: %d - Character Waiting Integer: %d" % (BWI, CWI) else: - text = "BWI defined only for T=1. Invalid ATR?" + if (i > 2 and T == 15): + # see ETSI TS 102 221 V8.3.0 (2009-08) + # Smart Cards; UICC-Terminal interface; + # Physical and logical characteristics (Release 8) + texts = {0x00: "No additional global interface parameters supported", + 0x88: "Secure Channel supported as defined in TS 102 484", + 0x8C: "Secured APDU - Platform to Platform required as defined in TS 102 484", + 0x90: "Low Impedance drivers and protocol available on the I/O line available (see clause 7.2.1)", + 0xA0: "UICC-CLF interface supported as defined in TS 102 613", + 0xC0: "Inter-Chip USB UICC-Terminal interface supported as defined in TS 102 600"} + text = texts.get(v, "RFU") return text def TC1(v): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-02-12 08:28:58
|
Revision: 373 http://pyscard.svn.sourceforge.net/pyscard/?rev=373&view=rev Author: ludov Date: 2010-02-12 08:28:51 +0000 (Fri, 12 Feb 2010) Log Message: ----------- fix pep8 E302 expected 2 blank lines, found 1 Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-02-12 08:26:18 UTC (rev 372) +++ trunk/contrib/parseATR/parseATR.py 2010-02-12 08:28:51 UTC (rev 373) @@ -39,6 +39,7 @@ """ return a hex list """ return " ".join(["%02X" % b for b in bytes]) + def normalize(atr): """ transform an ATR in list of integers valid input formats are @@ -58,6 +59,7 @@ atr = map(lambda x: int(x, 16), res) return atr + def int2bin(i, padding=8): """ convert an integer into its binary representation """ b = "" @@ -67,6 +69,7 @@ b = "0" * (padding - len(b)) + b return b + def parseATR(atr_txt): atr_txt = normalize(atr_txt) atr = {} @@ -131,6 +134,7 @@ return atr + def TA1(v): Fi = (372, 372, 558, 744, 1116, 1488, 1860, "RFU", "RFU", 512, 768, 1024, 1536, 2048, "RFU", "RFU") Di = ("RFU", 1, 2, 4, 8, 16, 32, "RFU", 12, 20, "RFU", "RFU", "RFU", "RFU", "RFU", "RFU") @@ -147,6 +151,7 @@ return text + def TA2(v): F = v >> 4 D = v & 0xF @@ -163,12 +168,15 @@ return ''.join(text) + def TA3(v): return TAn(3, v) + def TA4(v): return TAn(4, v) + def TAn(i, v): XI = ("not supported", "state L", "state H", "no preference") if (T == 1): @@ -192,6 +200,7 @@ text = "Clock stop: %s - Class accepted by the card: %s" % (XI[F], ''.join(Class)) return text + def TB1(v): I = v >> 5 PI = v & 0x1F @@ -201,6 +210,7 @@ text = "Programming Param P: %d Volts, I: %d milliamperes" % (PI, I) return text + def TB2(v): text = ["Programming param PI2 (PI1 should be ignored): %d" % v, ] if ((v > 49) or (v < 251)): @@ -209,12 +219,15 @@ text.append(" is RFU") return ''.join(text) + def TB3(v): return TBn(3, v) + def TB4(v): return TBn(4, v) + def TBn(i, v): text = "Undocumented" if (T == 1): @@ -236,21 +249,26 @@ text = texts.get(v, "RFU") return text + def TC1(v): text = ["Extra guard time: %d" % v] if (v == 255): text.append(" (special value)") return ''.join(text) + def TC2(v): return "Work waiting time: 960 x %d x (Fi/F)" % v + def TC3(v): return TCn(3, v) + def TC4(v): return TCn(4, v) + def TCn(i, v): text = [] if (T == 1): @@ -264,18 +282,23 @@ text.append("RFU") return ''.join(text) + def TD1(v): return TDn(1, v) + def TD2(v): return TDn(2, v) + def TD3(v): return TDn(3, v) + def TD4(v): return TDn(4, v) + def TDn(i, v): global T Y = v >> 4 @@ -283,6 +306,7 @@ text = "Y(i+1) = b%s, Protocol T=%d" % (int2bin(Y, 4), T) return text + def life_cycle_status(lcs): # Table 13 - Life cycle status byte # ISO 7816-4:2004, page 21 @@ -306,6 +330,7 @@ return text + def data_coding(dc): # Table 87 - Second software function table (data coding byte) # ISO 7816-4:2004, page 60 @@ -329,6 +354,7 @@ return ''.join(text) + def selection_methods(sm): # Table 86 - First software function table (selection methods) # ISO 7816-4:2004, page 60 @@ -360,6 +386,7 @@ return ''.join(text) + def selection_mode(sm): # Table 87 - Second software function table (data coding byte) # ISO 7816-4:2004, page 60 @@ -391,6 +418,7 @@ return ''.join(text) + def command_chaining(cc): # Table 88 - Third software function table (command chaining, length fields and logical channels) # ISO 7816-4:2004, page 61 @@ -413,6 +441,7 @@ return ''.join(text) + def card_service(cs): # Table 85 - Card service data byte # ISO 7816-4:2004, page 59 @@ -448,6 +477,7 @@ return ''.join(text) + def compact_tlv(historical_bytes): text = "" tlv = historical_bytes.pop(0) @@ -554,6 +584,7 @@ return ''.join(text) + def analyse_histrorical_bytes(historical_bytes): text = [] @@ -602,6 +633,7 @@ return text + def compute_tck(atr): # do not include TS byte s = atr["atr"][0] @@ -611,6 +643,7 @@ s ^= atr["atr"][-1] return s + def colorize_txt(l): magenta = "\033[35m" normal = "\033[0m" @@ -619,6 +652,7 @@ text += " --> " + magenta + "".join(l[1:]) + normal return text + def atr_display_txt(atr): return atr_display(atr, colorize_txt) @@ -630,6 +664,7 @@ "<": "<", } + def html_escape(text): """Produce entities within text.""" L = [] @@ -637,6 +672,7 @@ L.append(html_escape_table.get(c, c)) return "".join(L) + def colorize_html(l): text = '<span class="left">' + html_escape(l[0]) + '</span>' if len(l) > 1: @@ -645,9 +681,11 @@ text = l[0] return text + def atr_display_html(atr): return atr_display(atr, colorize_html) + def atr_display(atr, colorize): text = [] TS = {0x3B: "Direct Convention", 0x3F: "Inverse Convention"} @@ -690,6 +728,7 @@ return "\n".join([colorize(t) for t in text]) + def match_atr(atr, atr_file="smartcard_list.txt"): """ try to find card description for a given ATR """ card = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-03-17 14:46:21
|
Revision: 383 http://pyscard.svn.sourceforge.net/pyscard/?rev=383&view=rev Author: ludov Date: 2010-03-17 14:46:09 +0000 (Wed, 17 Mar 2010) Log Message: ----------- use regular expression to match ATR Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-03-12 10:34:04 UTC (rev 382) +++ trunk/contrib/parseATR/parseATR.py 2010-03-17 14:46:09 UTC (rev 383) @@ -23,6 +23,7 @@ T = -1 import exceptions +import re class ParseAtrException(exceptions.Exception): @@ -735,12 +736,16 @@ atr = toHexString(normalize(atr)) file = open(atr_file) for line in file: - if line.startswith("#"): + if line.startswith("#") or line.startswith("\t") or line == "\n": continue line = line.rstrip("\n") - if line == atr: + pattern = re.compile(line) + if pattern.match(atr): # found the ATR + if atr != line: + card.append("") + card.append(line) for desc in file: if desc == "\n": break This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-03-17 17:29:40
|
Revision: 384 http://pyscard.svn.sourceforge.net/pyscard/?rev=384&view=rev Author: ludov Date: 2010-03-17 17:29:34 +0000 (Wed, 17 Mar 2010) Log Message: ----------- do not give a defailt value to toHexString as pylint complaints Dangerous default value [] as argument Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-03-17 14:46:09 UTC (rev 383) +++ trunk/contrib/parseATR/parseATR.py 2010-03-17 17:29:34 UTC (rev 384) @@ -36,7 +36,7 @@ return self.text -def toHexString(bytes=[]): +def toHexString(bytes): """ return a hex list """ return " ".join(["%02X" % b for b in bytes]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-04-07 06:44:04
|
Revision: 387 http://pyscard.svn.sourceforge.net/pyscard/?rev=387&view=rev Author: ludov Date: 2010-04-07 06:43:58 +0000 (Wed, 07 Apr 2010) Log Message: ----------- add a missing \n Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-03-17 19:34:37 UTC (rev 386) +++ trunk/contrib/parseATR/parseATR.py 2010-04-07 06:43:58 UTC (rev 387) @@ -351,7 +351,7 @@ text.append("in") text.append("valid\n") - text.append(" - Data unit in quartets: %d" % (dc & 15)) + text.append(" - Data unit in quartets: %d\n" % (dc & 15)) return ''.join(text) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-04-07 06:48:56
|
Revision: 388 http://pyscard.svn.sourceforge.net/pyscard/?rev=388&view=rev Author: ludov Date: 2010-04-07 06:48:50 +0000 (Wed, 07 Apr 2010) Log Message: ----------- Correctly format the Logical channel number assignment line Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-04-07 06:43:58 UTC (rev 387) +++ trunk/contrib/parseATR/parseATR.py 2010-04-07 06:48:50 UTC (rev 388) @@ -436,7 +436,7 @@ v = (cc >> 3) & 3 t = ["No logical channel\n", "by the interface device\n", "by the card\n", "by the interface device and card\n"] - text.append(t[v]) + text.append(" - Logical channel number assignment: " + t[v]) text.append(" - Maximum number of logical channels: %d\n" % (cc & 7)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-05-15 12:53:48
|
Revision: 411 http://pyscard.svn.sourceforge.net/pyscard/?rev=411&view=rev Author: ludov Date: 2010-05-15 12:53:38 +0000 (Sat, 15 May 2010) Log Message: ----------- Use the RE engine only when needed. Speed gain: x5 Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-05-15 12:15:08 UTC (rev 410) +++ trunk/contrib/parseATR/parseATR.py 2010-05-15 12:53:38 UTC (rev 411) @@ -735,13 +735,23 @@ card = [] atr = toHexString(normalize(atr)) file = open(atr_file) + + # find a . * or [ in the ATR to know if we must use a RE or not + re_match = re.compile("[\\.\\*\\[]") + for line in file: if line.startswith("#") or line.startswith("\t") or line == "\n": continue line = line.rstrip("\n") - pattern = re.compile(line) - if pattern.match(atr): + # does the ATR in the file uses a RE? + if re_match.search(line): + # use the RE engine (slow) + found = re.match(line, atr) + else: + # use string compare (fast) + found = line == atr + if found: # found the ATR if atr != line: card.append("") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-07-28 09:41:38
|
Revision: 502 http://pyscard.svn.sourceforge.net/pyscard/?rev=502&view=rev Author: ludov Date: 2010-07-28 09:41:32 +0000 (Wed, 28 Jul 2010) Log Message: ----------- Add value for Di=7 (7816-3:2006 page 19) Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-06-23 17:05:38 UTC (rev 501) +++ trunk/contrib/parseATR/parseATR.py 2010-07-28 09:41:32 UTC (rev 502) @@ -138,7 +138,7 @@ def TA1(v): Fi = (372, 372, 558, 744, 1116, 1488, 1860, "RFU", "RFU", 512, 768, 1024, 1536, 2048, "RFU", "RFU") - Di = ("RFU", 1, 2, 4, 8, 16, 32, "RFU", 12, 20, "RFU", "RFU", "RFU", "RFU", "RFU", "RFU") + Di = ("RFU", 1, 2, 4, 8, 16, 32, 64, 12, 20, "RFU", "RFU", "RFU", "RFU", "RFU", "RFU") FMax = (4, 5, 6, 8, 12, 16, 20, "RFU", "RFU", 5, 7.5, 10, 15, 20, "RFU", "RFU") F = v >> 4 D = v & 0xF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-08-03 14:13:31
|
Revision: 503 http://pyscard.svn.sourceforge.net/pyscard/?rev=503&view=rev Author: ludov Date: 2010-08-03 14:13:25 +0000 (Tue, 03 Aug 2010) Log Message: ----------- reformat comments Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-07-28 09:41:32 UTC (rev 502) +++ trunk/contrib/parseATR/parseATR.py 2010-08-03 14:13:25 UTC (rev 503) @@ -100,12 +100,12 @@ pointer += 1 atr["TB%d" % pn] = atr_txt[pointer] - # Check TCi is present + # Check TCi is present if ((TDi | 0xBF) == 0xFF): pointer += 1 atr["TC%d" % pn] = atr_txt[pointer] - # Check TDi is present + # Check TDi is present if ((TDi | 0x7F) == 0xFF): pointer += 1 atr["TD%d" % pn] = TDi = atr_txt[pointer] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-08-03 14:41:51
|
Revision: 506 http://pyscard.svn.sourceforge.net/pyscard/?rev=506&view=rev Author: ludov Date: 2010-08-03 14:22:04 +0000 (Tue, 03 Aug 2010) Log Message: ----------- Update Copyrigth date Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-08-03 14:20:46 UTC (rev 505) +++ trunk/contrib/parseATR/parseATR.py 2010-08-03 14:22:04 UTC (rev 506) @@ -1,7 +1,7 @@ #! /usr/bin/env python """ parseATR: convert an ATR in a human readable format - Copyright (C) 2009 Ludovic Rousseau + Copyright (C) 2009-2010 Ludovic Rousseau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-08-03 14:54:53
|
Revision: 504 http://pyscard.svn.sourceforge.net/pyscard/?rev=504&view=rev Author: ludov Date: 2010-08-03 14:18:20 +0000 (Tue, 03 Aug 2010) Log Message: ----------- Also display a possible TD(5) Example: 3B FF 11 00 00 C0 0A F1 20 01 00 FF 01 00 00 8F 0F 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 8A Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-08-03 14:13:25 UTC (rev 503) +++ trunk/contrib/parseATR/parseATR.py 2010-08-03 14:18:20 UTC (rev 504) @@ -299,7 +299,10 @@ def TD4(v): return TDn(4, v) +def TD5(v): + return TDn(5, v) + def TDn(i, v): global T Y = v >> 4 @@ -696,7 +699,7 @@ K = atr["T0"] & 0xF text.append(["T0 = 0x%02X" % atr["T0"], "Y(1): b%s, K: %d (historical bytes)" % (int2bin(Y1, padding=4), K)]) - for i in (1, 2, 3, 4): + for i in (1, 2, 3, 4, 5): separator = False for p in ("A", "B", "C", "D"): key = "T%s%d" % (p, i) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2011-04-17 16:53:26
|
Revision: 527 http://pyscard.svn.sourceforge.net/pyscard/?rev=527&view=rev Author: ludov Date: 2011-04-17 16:53:20 +0000 (Sun, 17 Apr 2011) Log Message: ----------- Display extra bytes from invalid ATR Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2011-02-04 14:57:05 UTC (rev 526) +++ trunk/contrib/parseATR/parseATR.py 2011-04-17 16:53:20 UTC (rev 527) @@ -123,6 +123,10 @@ # Store historical bytes atr["hb"] = atr_txt[pointer + 1: pointer + 1 + hb_length] + last = pointer + 1 + hb_length + if len(atr_txt) > last: + atr["extra"] = atr_txt[last:] + if len(atr["hb"]) < hb_length: missing = hb_length - len(atr["hb"]) if missing > 1: @@ -301,6 +305,7 @@ def TD4(v): return TDn(4, v) + def TD5(v): return TDn(5, v) @@ -732,6 +737,9 @@ t.append("WRONG CHECKSUM, expected 0x%02X" % tck) text.append(t) + if "extra" in atr: + text.append(["Extra bytes", toHexString(atr["extra"])]) + return "\n".join([colorize(t) for t in text]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2011-04-26 16:51:19
|
Revision: 529 http://pyscard.svn.sourceforge.net/pyscard/?rev=529&view=rev Author: ludov Date: 2011-04-26 16:51:13 +0000 (Tue, 26 Apr 2011) Log Message: ----------- Correctly get the TCK (checksum) byte Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2011-04-23 15:02:33 UTC (rev 528) +++ trunk/contrib/parseATR/parseATR.py 2011-04-26 16:51:13 UTC (rev 529) @@ -123,7 +123,12 @@ # Store historical bytes atr["hb"] = atr_txt[pointer + 1: pointer + 1 + hb_length] + # Store TCK last = pointer + 1 + hb_length + if "TCK" in atr: + atr["TCK"] = atr_txt[last] + last += 1 + if len(atr_txt) > last: atr["extra"] = atr_txt[last:] @@ -135,10 +140,6 @@ (t1, t2) = ("", "is") raise ParseAtrException("ERROR! ATR is truncated: %d byte%s %s missing" % (missing, t1, t2)) - # Store TCK - if "TCK" in atr: - atr["TCK"] = atr_txt[-1] - return atr This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-16 15:09:22
|
Revision: 566 http://pyscard.svn.sourceforge.net/pyscard/?rev=566&view=rev Author: jdaussel Date: 2011-10-16 15:09:16 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Fixed E261 pep8 at least two spaces before inline comment Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2011-10-16 15:07:32 UTC (rev 565) +++ trunk/contrib/parseATR/parseATR.py 2011-10-16 15:09:16 UTC (rev 566) @@ -625,7 +625,7 @@ (lcs, sw1, sw2) = status[:3] text.append(" Mandatory status indicator (3 last bytes)\n") text.append(" LCS (life card cycle): %d (%s)\n" % (lcs, life_cycle_status(lcs))) - text.append(" SW: %02X%02X (%s)" % (sw1, sw2, "")) #Chipcard::PCSC::Card::ISO7816Error("$sw1 $sw2")) + text.append(" SW: %02X%02X (%s)" % (sw1, sw2, "")) # Chipcard::PCSC::Card::ISO7816Error("$sw1 $sw2")) elif hb_category == 0x80: text.append(" (compact TLV data object)\n") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2011-12-15 19:35:46
|
Revision: 588 http://pyscard.svn.sourceforge.net/pyscard/?rev=588&view=rev Author: ludov Date: 2011-12-15 19:35:40 +0000 (Thu, 15 Dec 2011) Log Message: ----------- nalyse_histrorical_bytes(): display the ASCII equivalent of the bytes in proprietary format. Example: 3B FF 13 00 00 81 31 FE 45 4F 57 4F 4B 31 30 2D 4A 33 31 34 30 32 34 31 AC [...] Historical bytes --> 4F 57 4F 4B 31 30 2D 4A 33 31 34 30 32 34 31 Category indicator byte: 0x4F --> (proprietary format) WOK10-J3140241 Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2011-10-29 10:23:49 UTC (rev 587) +++ trunk/contrib/parseATR/parseATR.py 2011-12-15 19:35:40 UTC (rev 588) @@ -642,6 +642,13 @@ else: text.append(" (proprietary format)") + ascii = " " + for b in historical_bytes: + if b > 31: + ascii += chr(b) + else: + ascii += '.' + text.append(''.join(ascii)) return text This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2012-01-28 15:05:58
|
Revision: 589 http://pyscard.svn.sourceforge.net/pyscard/?rev=589&view=rev Author: ludov Date: 2012-01-28 15:05:52 +0000 (Sat, 28 Jan 2012) Log Message: ----------- Display ASCII char only if < 127 If not display a '.' instead Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2011-12-15 19:35:40 UTC (rev 588) +++ trunk/contrib/parseATR/parseATR.py 2012-01-28 15:05:52 UTC (rev 589) @@ -644,7 +644,7 @@ text.append(" (proprietary format)") ascii = " " for b in historical_bytes: - if b > 31: + if b > 31 and b < 127: ascii += chr(b) else: ascii += '.' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2012-09-27 16:41:12
|
Revision: 597 http://pyscard.svn.sourceforge.net/pyscard/?rev=597&view=rev Author: ludov Date: 2012-09-27 16:41:06 +0000 (Thu, 27 Sep 2012) Log Message: ----------- Make it clear the text is the equivalent ASCII string Historical Bytes in proprietary format are also displayed as an ASCII string. Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2012-04-08 11:07:18 UTC (rev 596) +++ trunk/contrib/parseATR/parseATR.py 2012-09-27 16:41:06 UTC (rev 597) @@ -642,12 +642,13 @@ else: text.append(" (proprietary format)") - ascii = " " + ascii = " equivalent ASCII string: \"" for b in historical_bytes: if b > 31 and b < 127: ascii += chr(b) else: ascii += '.' + ascii += '"' text.append(''.join(ascii)) return text This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2012-09-28 09:20:32
|
Revision: 598 http://pyscard.svn.sourceforge.net/pyscard/?rev=598&view=rev Author: ludov Date: 2012-09-28 09:20:26 +0000 (Fri, 28 Sep 2012) Log Message: ----------- Add toASCIIString() function Convert a list of bytes to an ASCII string Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2012-09-27 16:41:06 UTC (rev 597) +++ trunk/contrib/parseATR/parseATR.py 2012-09-28 09:20:26 UTC (rev 598) @@ -43,6 +43,17 @@ return " ".join(["%02X" % b for b in bytes]) +def toASCIIString(bytes): + """ return a string """ + ascii = "" + for b in bytes: + if b > 31 and b < 127: + ascii += chr(b) + else: + ascii += '.' + return ascii + + def normalize(atr): """ transform an ATR in list of integers valid input formats are This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2012-09-28 09:23:59
|
Revision: 599 http://pyscard.svn.sourceforge.net/pyscard/?rev=599&view=rev Author: ludov Date: 2012-09-28 09:23:49 +0000 (Fri, 28 Sep 2012) Log Message: ----------- Use toASCIIString() to factorize code Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2012-09-28 09:20:26 UTC (rev 598) +++ trunk/contrib/parseATR/parseATR.py 2012-09-28 09:23:49 UTC (rev 599) @@ -654,13 +654,9 @@ else: text.append(" (proprietary format)") ascii = " equivalent ASCII string: \"" - for b in historical_bytes: - if b > 31 and b < 127: - ascii += chr(b) - else: - ascii += '.' + ascii += toASCIIString(historical_bytes) ascii += '"' - text.append(''.join(ascii)) + text.append(ascii) return text This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2012-09-28 12:27:21
|
Revision: 600 http://pyscard.svn.sourceforge.net/pyscard/?rev=600&view=rev Author: ludov Date: 2012-09-28 12:27:11 +0000 (Fri, 28 Sep 2012) Log Message: ----------- Display ASCII strings for multi-bytes values After most of the hex dumps of data we also display an ASCII string equivalent since the data may be or contain text. Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2012-09-28 09:23:49 UTC (rev 599) +++ trunk/contrib/parseATR/parseATR.py 2012-09-28 12:27:11 UTC (rev 600) @@ -538,15 +538,21 @@ elif tag == 4: text.append(" (initial access data)\n") - text.append(" Initial access data: " + toHexString(historical_bytes[:len]) + "\n") + text.append(" Initial access data: " + + toHexString(historical_bytes[:len]) + " \"" + + toASCIIString(historical_bytes[:len]) + "\"\n") elif tag == 5: text.append(" (card issuer's data)\n") - text.append(" Card issuer data: " + toHexString(historical_bytes[:len]) + "\n") + text.append(" Card issuer data: " + + toHexString(historical_bytes[:len]) + " \"" + + toASCIIString(historical_bytes[:len]) + "\"\n") elif tag == 6: text.append(" (pre-issuing data)\n") - text.append(" Data: " + toHexString(historical_bytes[:len]) + "\n") + text.append(" Data: " + + toHexString(historical_bytes[:len]) + " \"" + + toASCIIString(historical_bytes[:len]) + "\"\n") elif tag == 7: text.append(" (card capabilities)\n") @@ -596,11 +602,15 @@ elif tag == 15: text.append(" (application identifier)\n") - text.append(" Application identifier: " + toHexString(historical_bytes[:len])) + text.append(" Application identifier: " + + toHexString(historical_bytes[:len]) + " \"" + + toASCIIString(historical_bytes[:len]) + "\"\n") else: text.append(" (unknown)\n") - text.append(" Value: " + toHexString(historical_bytes[:len])) + text.append(" Value: " + + toHexString(historical_bytes[:len]) + " \"" + + toASCIIString(historical_bytes[:len]) + "\"\n") # consume len bytes of historic del historical_bytes[0:len] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2012-09-28 12:28:13
|
Revision: 601 http://pyscard.svn.sourceforge.net/pyscard/?rev=601&view=rev Author: ludov Date: 2012-09-28 12:28:07 +0000 (Fri, 28 Sep 2012) Log Message: ----------- parseATR.py:436:7: E271 multiple spaces after keyword Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2012-09-28 12:27:11 UTC (rev 600) +++ trunk/contrib/parseATR/parseATR.py 2012-09-28 12:28:07 UTC (rev 601) @@ -433,7 +433,7 @@ if sm & 32: text.append(" - DF selection by path\n") - if sm & 64: + if sm & 64: text.append(" - DF selection by partial DF name\n") if sm & 128: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2012-09-28 12:33:22
|
Revision: 602 http://pyscard.svn.sourceforge.net/pyscard/?rev=602&view=rev Author: ludov Date: 2012-09-28 12:33:12 +0000 (Fri, 28 Sep 2012) Log Message: ----------- parseATR.py:509:12: E711 comparison to None should be 'if cond is None:' parseATR.py:533:19: E711 comparison to None should be 'if cond is None:' Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2012-09-28 12:28:07 UTC (rev 601) +++ trunk/contrib/parseATR/parseATR.py 2012-09-28 12:33:12 UTC (rev 602) @@ -506,7 +506,7 @@ tlv = historical_bytes.pop(0) # return if we have NO historical bytes - if tlv == None: + if tlv is None: return text tag = tlv / 16 @@ -530,7 +530,7 @@ except IndexError: text.append("Error in the ATR: expecting 1 byte and got 0\n") else: - if cs == None: + if cs is None: text.append(" Error in the ATR: expecting 1 byte and got 0") else: text.append(" Card service data byte: %d\n" % cs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |