Repository navigation
Expand file tree
/
Copy pathisotype.py
More file actions
executable file
·109 lines (100 loc) · 3.5 KB
/
Copy pathisotype.py
File metadata and controls
executable file
·109 lines (100 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/python3
# isotype.py - determine ISO tag type
#
# Adam Laurie <adam@algroup.co.uk>
# http://rfidiot.org/
#
# This code is copyright (c) Adam Laurie, 2006, All rights reserved.
# For non-commercial use only, the following terms apply - for all other
# uses, please contact the author:
#
# This code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
import sys
# import os
## import string
import rfidiot
try:
card = rfidiot.card
except Exception as e:
print("Couldn't open reader! (%s)" % e)
sys.exit(True)
card.info("isotype v3.1c")
typed = 0
if card.readertype == card.READER_ACG:
for command, cardtype in card.ISOTags.items():
if not card.settagtype(command):
print("Could not test for card type: " + cardtype)
continue
if card.select():
print(" ID: " + card.uid)
print(" Tag is " + cardtype)
typed = True
if command == card.ISO15693:
print(" Manufacturer:", end="")
try:
print(card.ISO7816Manufacturer[card.uid[2:4]])
except:
print("Unknown (%s)" % card.uid[2:4])
for command, cardtype in card.ISOTagsA.items():
if not card.settagtype(command):
print("Could not reset reader to " + cardtype + "!")
sys.exit(True)
if card.readertype == card.READER_PCSC:
if card.select():
print(" ID: " + card.uid)
print(" Tag is " + card.tagtype)
# if string.find(card.tagtype, "ISO 15693") >= 0:
if "ISO 15693" in card.tagtype:
print(" Manufacturer:", end="")
try:
print(card.ISO7816Manufacturer[card.uid[2:4]])
except:
print(f"Unknown ({card.uid[2:4]})")
typed = True
print()
print()
if not card.readersubtype == card.READER_ACS:
card.PCSCPrintATR(card.pcsc_atr)
else:
print(card.get_error_str(card.errorcode))
sys.exit(True)
if card.readertype in (card.READER_LIBNFC, card.READER_TWN4):
if card.select("A"):
print(" ID: " + card.uid)
if card.sens_res:
print(" ATQA: " + card.sens_res)
if card.sel_res:
print(" SAK: " + card.sel_res)
if card.atr:
print(" ATS: " + card.atr)
print(" Tag is ISO 14443A - " + card.iso14443a_type())
typed = True
if card.select("B"):
print(" PUPI: " + card.pupi)
print(" APP: " + card.appdata)
print(" PROTO: " + card.protocol)
print(" CID: " + card.cid)
print(" Tag is ISO 14443B")
typed = True
if card.select("ICLASS"):
print(" ID: " + card.uid)
print(" Tag is ICLASS")
typed = True
if card.select("JEWEL"):
print("SENSRES: " + card.btsensres)
print(" ID: " + card.btid)
print(" Tag is JEWEL")
typed = True
if not typed:
print("Could not determine type")
sys.exit(True)
sys.exit(False)