mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
fix: 14a raw commands - running lua scripts works again for MIX/NG frames
This commit is contained in:
parent
2d972f8cb9
commit
abc66484e5
3 changed files with 54 additions and 31 deletions
|
@ -142,33 +142,18 @@ function Command:sendMIX( ignore_response, timeout )
|
|||
end
|
||||
|
||||
-- lets digest
|
||||
local data
|
||||
local count, cmd, length, magic, status, crc, arg1, arg2, arg3 = bin.unpack('SSIsSLLL', response)
|
||||
data = nil
|
||||
cmd = nil
|
||||
arg1 = nil
|
||||
arg2 = nil
|
||||
arg3 = nil
|
||||
local count, length, magic, status, crc, ng
|
||||
|
||||
-- S S I s S L L L
|
||||
count, cmd, length, magic, status, crc, arg1, arg2, arg3 = bin.unpack('SSIsSLLL', response)
|
||||
count, data, ng = bin.unpack('H'..length..'C', response, count)
|
||||
|
||||
--[[ uncomment if you want to debug
|
||||
self.resp_cmd = cmd
|
||||
self.resp_length = length
|
||||
self.resp_magic = magic
|
||||
self.resp_status = status
|
||||
self.resp_crc = crc
|
||||
self.resp_arg1 = arg1
|
||||
self.resp_arg2 = arg2
|
||||
self.resp_arg3 = arg3
|
||||
self.resp_data = data
|
||||
self.resp_ng = ng
|
||||
self:__responsetostring()
|
||||
--]]
|
||||
|
||||
local packed = bin.pack("LLLLH", cmd, arg1, arg2, arg3, data)
|
||||
--[[
|
||||
return { Cmd = cmd,
|
||||
Arg1 = arg1,
|
||||
Arg2 = arg2,
|
||||
Arg3 = arg3,
|
||||
Data = data,
|
||||
}
|
||||
--]]
|
||||
return packed, nil;
|
||||
end
|
||||
function Command:sendNG( ignore_response, timeout )
|
||||
|
@ -185,8 +170,12 @@ function Command:sendNG( ignore_response, timeout )
|
|||
if response == nil then
|
||||
return nil, 'Error, waiting for response timed out :: '..msg
|
||||
end
|
||||
local data
|
||||
local count, cmd, length, magic, status, crc, arg0, arg1, arg2 = bin.unpack('SSIsSLLL', response)
|
||||
|
||||
data = nil
|
||||
cmd = nil
|
||||
local count, length, magic, status, crc, arg0, arg1, arg2
|
||||
|
||||
count, cmd, length, magic, status, crc, arg0, arg1, arg2 = bin.unpack('SSIsSLLL', response)
|
||||
count, data, ng = bin.unpack('H'..length..'C', response, count)
|
||||
|
||||
--[[ uncomment if you want to debug
|
||||
|
|
|
@ -63,7 +63,7 @@ local function parse14443a(data)
|
|||
} __attribute__((__packed__)) iso14a_card_select_t;
|
||||
--]]
|
||||
|
||||
local count, uid, uidlen, atqa, sak, ats_len, ats = bin.unpack('H10CH2CC',data)
|
||||
local count, uid, uidlen, atqa, sak, ats_len, ats = bin.unpack('H10CH2CC', data)
|
||||
uid = uid:sub(1, 2 * uidlen)
|
||||
local man_byte = tonumber(uid:sub(1,2), 16)
|
||||
|
||||
|
@ -98,8 +98,8 @@ local function read14443a(dont_disconnect, no_rats)
|
|||
|
||||
local result, err = command:sendMIX()
|
||||
if result then
|
||||
local count,cmd,arg0,arg1,arg2 = bin.unpack('LLLL',result)
|
||||
if arg0 == 0 then
|
||||
local count, cmd, arg1, arg2, arg3 = bin.unpack('LLLL',result)
|
||||
if arg1 == 0 then
|
||||
return nil, 'iso14443a card select failed'
|
||||
end
|
||||
data = string.sub(result, count)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue