aboutsummaryrefslogtreecommitdiffstats
path: root/cards
diff options
context:
space:
mode:
authorhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2006-11-20 22:54:57 +0000
committerhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2006-11-20 22:54:57 +0000
commitdddcdad519332868c1fcaf34cded5e0117f72536 (patch)
tree5242420c037031422234186bbf42b70932b9ca49 /cards
parentc6537acc516b44ab7a3ab7f0323cc0780d6de2be (diff)
At least shows the name now.
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@132 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'cards')
-rw-r--r--cards/postcard_card.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/cards/postcard_card.py b/cards/postcard_card.py
index d248313..13aa5d0 100644
--- a/cards/postcard_card.py
+++ b/cards/postcard_card.py
@@ -1,4 +1,4 @@
-import utils
+import utils, re
from iso_7816_4_card import *
class Postcard_Card(ISO_7816_4_Card):
@@ -44,6 +44,31 @@ class Postcard_Card(ISO_7816_4_Card):
for name,_ in self.ZONE_ADDRESSES:
print "%s: %04x" % (name, result[name])
+ def cmd_read_identification_zone(self):
+ "Read the identification zone"
+ data = self._get_binary(0x0948, length=0x60)
+
+ chaine_initiale = binascii.b2a_hex(data[4:])
+ print "chaine initiale", chaine_initiale
+ #suppression_des_3 = re.sub(r'x', '3', re.sub(r'3', '', re.sub(r'33', "x", chaine_initiale) ) )
+ #suppression_des_3 = "".join(chaine_initiale.split("3")) + "0"
+ suppression_des_3 = []
+ still_there = True
+ for index,char in enumerate(chaine_initiale):
+ if still_there and index % 8 == 0:
+ if char == "3":
+ continue
+ else:
+ still_there = False
+ suppression_des_3.append(char)
+ suppression_des_3 = "".join(suppression_des_3)
+
+ print "suppression des 3", suppression_des_3
+ new_data = binascii.a2b_hex(suppression_des_3)
+ print utils.hexdump(new_data)
+
+
COMMANDS = {
"calculate_zone_addresses": cmd_calculate_zone_addresses,
+ "read_identification_zone": cmd_read_identification_zone,
}