]> git.zerfleddert.de Git - proxmark3-svn/blame - client/scripts/mifare.lua
Finishing touches on new mifare classic hack rework
[proxmark3-svn] / client / scripts / mifare.lua
CommitLineData
3510cdff 1local desc = "How would the classic mifare hack look in lua? Let's find out "
2print(desc);
3
4print("This script isn't even remotely finished!")
5print("Checking preconditions");
6print("core", core)
7print("core.SendCommand", core.SendCommand)
8print("core.WaitForResponseTimeout", core.WaitForResponseTimeout)
9print("core.nonce2key", core.nonce2key)
10-- To actually send something meaningful, we need to include the 'Binlib' or 'lpack' library.
f057bddb 11local cmd = 0x0611 -- CMD_READER_MIFARE - uint_64
12local arg1, arg2, arg3 = "0","0","0" -- 3 x uint_64
13local d = string.rep("00",512)-- 512 bytes
14local usbcommand = bin.pack("LLLLH",cmd, arg1, arg2, arg3,d);
15print("len(usbcommand): ", string.len(usbcommand));
16local x = core.SendCommand(usbcommand);
17local result
18repeat
19 result = core.WaitForResponseTimeout(cmd,1000)
20 print(".")
21until result
22
23local r_cmd, r_arg1, r_arg2, r_arg3,r_data;
24--[[
25response = bin.unpack()
26isOK = resp.arg[0] & 0xff;
27
28uid = (uint32_t)bytes_to_num(resp.d.asBytes + 0, 4);
29nt = (uint32_t)bytes_to_num(resp.d.asBytes + 4, 4);
30par_list = bytes_to_num(resp.d.asBytes + 8, 8);
31ks_list = bytes_to_num(resp.d.asBytes + 16, 8);
32
33
34end
35--]]
3510cdff 36--- Oh, and nonce2Key is not 'glued' yet.
37print("err", result)
Impressum, Datenschutz