]>
Commit | Line | Data |
---|---|---|
4df3eb3f | 1 | local cmds = require('commands') |
2 | local desc = | |
3 | [[ | |
4 | ||
5 | This script is a work in progress, not yet functional. It is an attempt to use the raw-writing | |
6 | capabilities already present within the devices | |
7 | ||
8 | ]] | |
9 | ||
10 | print(desc) | |
11 | ||
12 | -- Some raw data | |
13 | local rawdata = "6000F57b" --mf_auth | |
14 | local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds | |
15 | ||
16 | function show(usbpacket) | |
17 | if usbpacket then | |
18 | local response = Command.parse(usbpacket) | |
19 | print(response) | |
20 | end | |
21 | end | |
22 | ||
23 | -- Want to do both connect and send raw, so we should AND the two commands | |
24 | -- ISO14A_COMMAND.ISO14A_RAW and ISO14A_CONNECT. However, we don't have a | |
25 | -- bitlib yet, so we'll do it manually, 1 & 8 == 9 | |
26 | -- ISO14A_NO_DISCONNECT = 2 | |
27 | ||
28 | print(string.len(rawdata)) | |
29 | local command = Command:new{cmd = cmds.CMD_READER_ISO_14443a, | |
30 | arg1 = 9, | |
31 | arg2 = string.len(rawdata), | |
32 | data = rawdata} | |
33 | core.clearCommandBuffer() | |
34 | print("Sending") | |
35 | print(command) | |
36 | local err = core.SendCommand(command:getBytes()) | |
37 | if err then | |
38 | print(err) | |
39 | return nil, err | |
40 | end | |
41 | local cardselect = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) | |
42 | print("Card select:") | |
43 | show(cardselect) | |
44 | local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) | |
45 | print("Raw response:") | |
46 | show(response) |