mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-04-16 17:35:03 +08:00
fix: 'script run ndef_dump.lua' - move function
This commit is contained in:
parent
11f86c2d95
commit
dcdb2ee218
1 changed files with 18 additions and 19 deletions
|
@ -66,8 +66,6 @@ local utils = {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Usage help
|
-- Usage help
|
||||||
local function help()
|
local function help()
|
||||||
|
@ -83,6 +81,24 @@ local function debug(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- This function is a lua-implementation of
|
||||||
|
-- cmdhf14a.c:waitCmd(uint8_t iSelect)
|
||||||
|
local function waitCmd(iSelect)
|
||||||
|
local response = core.WaitForResponseTimeout(cmds.CMD_ACK,1000)
|
||||||
|
if response then
|
||||||
|
local count,cmd,arg0,arg1,arg2 = bin.unpack('LLLL',response)
|
||||||
|
|
||||||
|
local iLen = arg0
|
||||||
|
if iSelect then iLen = arg1 end
|
||||||
|
debug(("Received %i octets (arg0:%d, arg1:%d)"):format(iLen, arg0, arg1))
|
||||||
|
if iLen == 0 then return nil, "No response from tag" end
|
||||||
|
local recv = string.sub(response,count, iLen+count-1)
|
||||||
|
return recv
|
||||||
|
end
|
||||||
|
return nil, "No response from device"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function show(data)
|
local function show(data)
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
local formatString = ("H%d"):format(string.len(data))
|
local formatString = ("H%d"):format(string.len(data))
|
||||||
|
@ -156,23 +172,6 @@ local function getBlock(block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- This function is a lua-implementation of
|
|
||||||
-- cmdhf14a.c:waitCmd(uint8_t iSelect)
|
|
||||||
local function waitCmd(iSelect)
|
|
||||||
local response = core.WaitForResponseTimeout(cmds.CMD_ACK,1000)
|
|
||||||
if response then
|
|
||||||
local count,cmd,arg0,arg1,arg2 = bin.unpack('LLLL',response)
|
|
||||||
|
|
||||||
local iLen = arg0
|
|
||||||
if iSelect then iLen = arg1 end
|
|
||||||
debug(("Received %i octets (arg0:%d, arg1:%d)"):format(iLen, arg0, arg1))
|
|
||||||
if iLen == 0 then return nil, "No response from tag" end
|
|
||||||
local recv = string.sub(response,count, iLen+count-1)
|
|
||||||
return recv
|
|
||||||
end
|
|
||||||
return nil, "No response from device"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function main( args)
|
local function main( args)
|
||||||
|
|
Loading…
Add table
Reference in a new issue