Implement comments for fingerprints.txt

Add start of an implementation of rfid characteristics
Update fingerprints after encounter with two real german passports


git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@206 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
hploetz 2007-06-01 20:42:45 +00:00
parent 7819b38ec2
commit 85335da1b6
2 changed files with 31 additions and 10 deletions

View File

@ -63,6 +63,16 @@ def connect(reader = None):
print "ATR: %s" % utils.hexdump(newState[0]['Atr'], short = True)
return pycsc.pycsc(reader = readerName, protocol = pycsc.SCARD_PROTOCOL_ANY)
def fingerprint_rfid(card):
# Need RFID
if not isinstance(card, cards.rfid_card.RFID_Card):
return [""]
uid = card.get_uid()
return "%02X" % ord(uid[0])
# FIXME: Determine ISO type and then return a value depending on A-fixed UID vs. A-random UID vs. B
def fingerprint_7816(card):
# Need ISO 7816-4
if not isinstance(card, cards.iso_7816_4_card.ISO_7816_4_Card):
@ -190,6 +200,7 @@ def fingerprint(card):
catr = "F:%s" % binascii.b2a_hex(atr)
result.append( catr )
result.extend( fingerprint_7816(card) )
result.append( fingerprint_rfid(card) )
return ",".join(result)
@ -202,9 +213,12 @@ def match_fingerprint(fingerprint, database="fingerprints.txt"):
matched = False
def do_match(line, fingerprint):
return re.match(line.strip()+"$", fingerprint.strip()) is not None
return re.match(line.strip(), fingerprint.strip()) is not None
for line in fp.readlines():
if line[0] == "#":
continue
if line.strip() == "":
matched = False
if len(current_result) > 0:
@ -245,7 +259,9 @@ if __name__ == "__main__":
cards.generic_card.DEBUG = False
print >>sys.stderr, "Using %s" % card.DRIVER_NAME
if isinstance(card, cards.rfid_card.RFID_Card):
print "UID: %s" % utils.hexdump(card.get_uid(), short=True)
fp = fingerprint(card)
print "Fingerprint: %s" % fp
matches = match_fingerprint(fp)

View File

@ -1,21 +1,26 @@
1:0b0014
1:0b0014$
ICode
0:8080,N
0:8080,N$
DESfire
1:030003
1:030003$
Mifare Ultralight
1:030001
1:030001$
Mifare Classic 1k
0:80919131f06477e30300838290001c,P,.*
0:80919131f06477e30300838290001c,P[^,]*,
Belgian Passport
(imported from Ludovic Rousseau)
0:00640411010131800090005a,P,.*
German Passport
0:006404150102009000ee,P:6700,1,569AAA9A
Electronic Passport Specimen, issued by Bundesdruckerei, Germany
0:[^,]*,P:6700,1,5AAAAAAA,08
German Passport
# Observed ATRS:
# Passport issued Nov 06: 3b 8b 80 01 00 64 04 11 01 01 31 80 00 90 00 5a
# corresponding fingerprint: 0:00640411010131800090005a,P:6700,1,5AAAAAAA,08
# Passport issued Apr 07: 3b 89 80 01 00 64 04 15 01 02 00 90 00 ee
# corresponding fingerprint: 0:006404150102009000ee,P:6700,1,5AAAAAAA,08