1 local utils
= require('utils')
2 local getopt
= require('getopt')
3 local ansicolors
= require('ansicolors')
4 -- this script writes bytes 8 to 256 on the Legic MIM256
11 This is a script which writes value 0x01 to bytes from
12 position 0x07 until 0xFF on a Legic Prime Tag (MIM256 or MIM1024)
13 -- (created with 'hf legic dump -f my_dump.hex') --
16 script run hf_legic_buffer2card
19 script run hf_legic_buffer2card -h
26 -- This is only meant to be used when errors occur
27 local function oops(err
)
29 core
.clearCommandBuffer()
39 print(ansicolors
.cyan
..'Usage'..ansicolors
.reset
)
41 print(ansicolors
.cyan
..'Arguments'..ansicolors
.reset
)
43 print(ansicolors
.cyan
..'Example usage'..ansicolors
.reset
)
47 -- simple loop-write from 0x07 to 0xff
50 -- parse arguments for the script
51 for o
, a
in getopt
.getopt(args
, 'h') do
52 if o
== 'h' then return help() end
58 cmd
= ('hf legic wrbl -o %02x -d 01'):format(i
)
60 core
.clearCommandBuffer()
63 -- got a 'cmd-buffer overflow' on my mac - so just wait a little
64 -- works without that pause on my linux-box