-
Notifications
You must be signed in to change notification settings - Fork 223
/
nfcid.py
99 lines (84 loc) · 2.58 KB
/
nfcid.py
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
#!/usr/bin/python
#
# NFC ID.py - Python code for Identifying NFC cards
# version 0.1
# Nick von Dadelszen (nick@lateralsecurity.com)
# Lateral Security (www.lateralsecurity.com)
#
# This code is copyright (c) Lateral Security, 2011, All rights reserved.
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#import RFIDIOtconfig
import sys
import os
import pyandroid
import datetime
Verbose= True
Quiet= True
aidlist= [
['MASTERCARD', 'a0000000041010'],
['MASTERCARD', 'a0000000049999'],
['VISA', 'a000000003'],
['VISA Debit/Credit', 'a0000000031010'],
['VISA Credit', 'a000000003101001'],
['VISA Debit', 'a000000003101002'],
['VISA Electron', 'a0000000032010'],
['VISA V Pay', 'a0000000032020'],
['VISA Interlink', 'a0000000033010'],
['VISA Plus', 'a0000000038010'],
['VISA ATM', 'a000000003999910'],
['Maestro', 'a0000000043060'],
['Maestro UK', 'a0000000050001'],
['Maestro TEST', 'b012345678'],
['Self Service', 'a00000002401'],
['American Express', 'a000000025'],
['ExpressPay', 'a000000025010701'],
['Link', 'a0000000291010'],
['Alias AID', 'a0000000291010'],
['Cirrus', 'a0000000046000'],
['Snapper Card', 'D4100000030001'],
['Passport', 'A0000002471001'],
]
n = pyandroid.Android()
while(42):
uid = n.select()
print 'GMT Timestamp: ' + str(datetime.datetime.now())
if not Quiet:
print '\nID: ' + uid
print ' Data:'
current = 0
cc_data = False
while current < len(aidlist):
if Verbose:
print 'Trying AID: '+ aidlist[current][0] + ':' + aidlist[current][1]
apdu = '00A4040007' + aidlist[current][1]
r = n.sendAPDU(apdu)
#print r
#print r[-4:]
if not r[-4:] == '9000':
apdu = apdu + '00'
r = n.sendAPDU(apdu)
#print r
#print r[-4:]
if r[-4:] == '9000':
#print card.data + card.errorcode
uid = uid[:-1]
n.sendResults("Card found-UID: " + uid + "-Card type: " + aidlist[current][0])
break
current += 1
if not Quiet:
print 'Ending now ...'
n.deconfigure()
print