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,
I’m currently try to refactor the Legic_clone.lua script so that it is working again with the current rrg repo (Issue 209).
I’ve got stuck with handling commands.
I want to get the first 4 bytes of a legic tag. On CLI I would call
hf legic rdmem 0 4
.
To get the bytes in LUA I use a function readlegicdata()
- read LEGIC data
local function readlegicdata( offset, length, iv )
-- Read data
local command = Command:newMIX{
cmd = cmds.CMD_HF_LEGIC_READER
, arg1 = offset
, arg2 = length
, arg3 = iv
, data = nil
}
local result, err = command:sendMIX()
if not result then return oops(err) end
print("DEBUG: "..type(result).." "..#result.." "..result.." "..('%02x'):format(result:byte(1))..('%02x'):format(result:byte(2))..('%02x'):format(result:byte(3))..('%02x'):format(result:byte(4)))
return result
end
When calling the function like
readbytes = readlegicdata(0, 4, 0x55)
result seems to be a string with 544 length. So I guess I have to
bin.unpack(????, result)
the result. However I have currently no clue of the structure of result.
Any hints, ideas how to get on here?
Thanks!
Last edited by pizza_4u (2020-04-04 07:59:29)
Offline
I though the legic script problem was releated to the import reading of a binary file vs eml file.
Offline
Yes. That is/was one problem. However there are some more problems.
One of them is that the script uses outdated commands like
hf legic read 0x00 0x04
With the current implementation the user has to type in the returned bytes. Therefore I wanted to have a direct call to skip the user input.
Offline
OK, I've figured out that data starts at offset 33. So I will use this dirty but working way ;-)
Offline
there is under lualibs/ folder some help libs, which uses the unpack function to extract different parts of data.
And now I have changed many legic commands input params...so you are up for a bumpy ride
Offline
Pages: 1