2 //-----------------------------------------------------------------------------
3 // Salvador Mendoza (salmg.net), 2021
5 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
6 // at your option, any later version. See the LICENSE.txt file for the text of
8 //-----------------------------------------------------------------------------
9 // Code to test Proxmark3 Standalone mode aka reblay by Salvador Mendoza
10 //-----------------------------------------------------------------------------
14 from smartcard
.util
import toHexString
16 ser
= serial
.Serial('/dev/rfcomm0') # open Proxmark3 Bluetooth port
19 rapdu
= map(ord, data
)
23 [0x00, 0xA4, 0x04, 0x00, 0x0e, 0x32, 0x50, 0x41, 0x59, 0x2e, 0x53, 0x59, 0x53, 0x2e, 0x44, 0x44, 0x46, 0x30, 0x31, 0x00], # PPSE
24 [0x00, 0xA4, 0x04, 0x00, 0x07, 0xa0, 0x00, 0x00, 0x00, 0x03, 0x10, 0x10, 0x00], # Visa card
25 [0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00, 0x00], # GET PROCESSING
26 [0x00, 0xb2, 0x01, 0x0c, 0x00] # SFI
29 print('Testing code: bluetooth has to be connected with the right rfcomm port!')
30 print('Waiting for data...')
33 bufferlen
= pd(initd
)[0]
34 rping
= ser
.read(bufferlen
)
39 print(toHexString(ping
[:4]))
41 print(toHexString(ping
[4:-1]))
43 print(toHexString(ping
[-1:]))
44 elif (len(ping
) == 10):
46 print(toHexString(ping
[:7]))
48 print(toHexString(ping
[7:-1]))
50 print(toHexString(ping
[-1:]))
52 print('got ping, no sure what it means: '),
56 print('Sending cmd: '),
60 lenpk
= ser
.read(1) #first byte is the buffer length
61 bufferlen
= pd(lenpk
)[0]
63 buffer = pd(ser
.read(bufferlen
))
64 print('Card Response:'),
65 print(toHexString(buffer))
68 ser
.write(b
'1') #tell Proxmark3 that we finish the communication