Proxmark3 community

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.

Announcement

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.

#1 2020-12-26 19:46:09

ebodyyy
Contributor
Registered: 2019-10-02
Posts: 14

Attempting to index a nil value - Error

Hello,

I tried the code that was posted http://www.proxmark.org/forum/viewtopic.php?id=6330. I just made a new topic because the other one doesn't seem active.

I 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 and I'm not really sure why this is happening.

BTW I do have an 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()

Any help would be greatly appreciated. Thanks.

Offline

Board footer

Powered by FluxBB