X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/4df3eb3f739af80b6fdc8f737fc906d254ebd0b5..24d48e60fc5b29d317467cc260c40cad2bb6f695:/client/scripts/writeraw.lua diff --git a/client/scripts/writeraw.lua b/client/scripts/writeraw.lua index 25250864..1dc8c0df 100644 --- a/client/scripts/writeraw.lua +++ b/client/scripts/writeraw.lua @@ -21,18 +21,33 @@ function show(usbpacket) end -- Want to do both connect and send raw, so we should AND the two commands --- ISO14A_COMMAND.ISO14A_RAW and ISO14A_CONNECT. However, we don't have a +-- ISO14A_COMMAND.ISO14A_RAW(8) and ISO14A_CONNECT (1). However, we don't have a -- bitlib yet, so we'll do it manually, 1 & 8 == 9 --- ISO14A_NO_DISCONNECT = 2 +-- ISO14A_NO_DISCONNECT = 2 ==> 11 print(string.len(rawdata)) local command = Command:new{cmd = cmds.CMD_READER_ISO_14443a, - arg1 = 9, - arg2 = string.len(rawdata), + arg1 = 3, -- Connect (1) and don't disconnect (2) + arg2 = 0 + } +local mf_auth = Command:new{cmd = cmds.CMD_READER_ISO_14443a, + arg1 = 10, -- Send raw + -- arg2 contains the length. + -- Remember; rawdata is an ascii string containing + -- ASCII characters. Thus; rawdata= "FF" are two bytes in length + -- but when converted to true hexvalues internally inside the Command + -- constructor, 0xFF is only one byte. So, the bytelength is the + -- length of the ASCII-string divided by two. Thanks jonor! + + arg2 = string.len(rawdata)/2, data = rawdata} +local quit = Command:new{cmd = cmds.CMD_READER_ISO_14443a, + arg1 = 0, -- Nothing + } + core.clearCommandBuffer() -print("Sending") -print(command) +--print("Sending") +--print(command) local err = core.SendCommand(command:getBytes()) if err then print(err) @@ -41,6 +56,23 @@ end local cardselect = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) print("Card select:") show(cardselect) -local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) -print("Raw response:") -show(response) +--local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) +--print("Raw response:") +--show(response) + +local answer = "" +while answer ~='q' do + + local err = core.SendCommand(mf_auth:getBytes()) + if err then + print(err) + return nil, err + end + local nonce = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) + print("Nonce:") + show(nonce) + io.write("Write q to quit, hit any char to get a nonce ") + io.flush() + answer=io.read(1) + +end--]]