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