mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
fix legic reading and writing
This commit is contained in:
parent
affee79b69
commit
00fdac0986
1 changed files with 49 additions and 47 deletions
|
@ -506,8 +506,9 @@ function tagToBytes(tag)
|
|||
function readFromPM3()
|
||||
local tag, bytes, infile
|
||||
infile="legic.temp"
|
||||
core.console("hf legic reader")
|
||||
core.console("hf legic esave "..infile)
|
||||
-- core.console("hf legic reader")
|
||||
-- core.console("hf legic esave "..infile)
|
||||
core.console("hf legic dump o "..infile)
|
||||
tag=readFile(infile..".bin")
|
||||
return tag
|
||||
end
|
||||
|
@ -558,7 +559,7 @@ function writeToTag(tag)
|
|||
if (bytes) then
|
||||
print("write temp-file '"..filename.."'")
|
||||
print(accyan)
|
||||
writeFile(bytes, filename)
|
||||
writeFile(bytes, filename..".bin")
|
||||
--writeToTag(bytes, taglen, 'MylegicClone.hex')
|
||||
print(acoff)
|
||||
end
|
||||
|
@ -568,17 +569,18 @@ function writeToTag(tag)
|
|||
WriteBytes = utils.input(acyellow.."enter number of bytes to write?"..acoff, taglen)
|
||||
-- load file into pm3-buffer
|
||||
if (type(filename) ~= "string") then filename=input(acyellow.."filename to load to pm3-buffer?"..acoff,"legic.temp") end
|
||||
cmd = 'hf legic load '..filename
|
||||
cmd = 'hf legic eload '..filename
|
||||
core.console(cmd)
|
||||
-- write pm3-buffer to Tag
|
||||
for i=0, WriteBytes do
|
||||
if ( i<5 or i>6) then
|
||||
cmd = ('hf legic write o 0x%02x d 0x01'):format(i)
|
||||
cmd = ('hf legic write o %02x d 01'):format(i)
|
||||
print(cmd)
|
||||
core.console(cmd)
|
||||
--print(cmd)
|
||||
elseif (i == 6) then
|
||||
-- write DCF in reverse order (requires 'mosci-patch')
|
||||
cmd = 'hf legic write o 0x05 d 0x02'
|
||||
cmd = 'hf legic write o 05 d 02'
|
||||
print(acgreen..cmd..acoff)
|
||||
core.console(cmd)
|
||||
--print(cmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue