Research, development and trades concerning the powerful Proxmark3 device.
Remember; sharing is caring. Bring something back to the community.
"Learn the tools of the trade the hard way." +Fravia
You are not logged in.
Time changes and with it the technology
Proxmark3 @ discord
Users of this forum, please be aware that information stored on this site is not private.
Pages: 1
Hi everybody,
After sending commands to a tag (e.g. hf mf wrbl ...), a result code is sent to the output : isOk:00 or isOk:01.
I would like to get the value of this return code in order to use it in my scripts. How can I do that ?
Thanks
Offline
you need to not use the console command but rather implement that direct calls. Lots of scripts, which lets you get ideas how to solve your problem
Offline
you need to not use the console command but rather implement that direct calls. Lots of scripts, which lets you get ideas how to solve your problem
Iceman, could you please show an example and we see how it to get?
Scripts has using a core.consele method to send and I never seen way for the returning a responce from the console.
Many Thanks
Offline
Here is an example :
Instead of doing something like
...
local command="hf mf rdbl 0 A FFFFFFFFFFFF"
core.console(command)
...
you can do this
local function getblockdata(response)
if not response then
-- print("No response from device")
return nil, "No response from device"
end
if response.Status == PM3_SUCCESS then
return response.Data, "Success"
else
-- print("Couldn't read block .. ["..response.Status.."]")
return nil, "Couldn't read block .. ["..response.Status.."]"
end
end
...
local function main()
...
local data = "0000FFFFFFFFFFFF"
local c = Command:newNG{cmd = cmds.CMD_HF_MIFARE_READBL, data = data}
local b, err = getblockdata(c:sendNG(false))
-- you now have access to b.Status, b.Data, ...
...
Last edited by loupetre (2020-03-26 21:24:28)
Offline
Hello,
I tried the code above and entered in a few of the missing "require" commands, but I'm getting an error with reading block 0. . I've looked at all the Lua examples in the Luascripts directory and reviewed the Lua libs.
BTW i do have a MF fob on the proxmark as i run this.
Here's the error i'm getting when i run the script:
Couldn't read block .. [0]
[-] ⛔ error - ...oel/proxmark4/proxmark3/client/luascripts/e_test.lua:25: attempt to index local 'b' (a nil value)
Here's the code:
local cmds = require('commands')
local getopt = require('getopt')
local function getblockdata(response)
if not response then
-- print("No response from device")
return nil, "No response from device"
end
if response.Status == PM3_SUCCESS then
return response.Data, "Success"
else
-- print("Couldn't read block .. ["..response.Status.."]")
return nil, "Couldn't read block .. ["..response.Status.."]"
end
end
local function main()
local data = "0000FFFFFFFFFFFF"
local c = Command:newNG{cmd = cmds.CMD_HF_MIFARE_READBL, data = data}
local b, err = getblockdata(c:sendNG(false))
print(b.Data)
end
main()
Last edited by ebodyyy (2020-12-25 21:42:16)
Offline
Pages: 1