diff --git a/client/luascripts/hf_mfu_ultra.lua b/client/luascripts/hf_mfu_ultra.lua index d8dc1ab5f..f96becad8 100644 --- a/client/luascripts/hf_mfu_ultra.lua +++ b/client/luascripts/hf_mfu_ultra.lua @@ -13,16 +13,17 @@ The script provides functionality for writing Mifare Ultralight Ultra/UL-5 tags. ]] example = [[ -- restpre (write) dump to tag - ]]..ansicolors.yellow..[[script run hf_mfu_ultra -k ffffffff -r hf-mfu-3476FF1514D866-dump.bin]]..ansicolors.reset..[[ + ]]..ansicolors.yellow..[[script run hf_mfu_ultra -f hf-mfu-3476FF1514D866-dump.bin -k ffffffff -r]]..ansicolors.reset..[[ -- wipe tag (]]..ansicolors.red..[[Do not use it with UL-5!]]..ansicolors.reset..[[) ]]..ansicolors.yellow..[[script run hf_mfu_ultra -k 1d237f76 -w ]]..ansicolors.reset..[[ ]] usage = [[ -script run hf_mfu_ultra -h -k -w -r +script run hf_mfu_ultra -h -f -k -w -r ]] arguments = [[ -h this help + -f filename for the datadump to read (bin) -k pwd to use with the restore and wipe operations -r restore a binary dump to tag -w wipe tag (]]..ansicolors.red..[[Do not use it with UL-5!]]..ansicolors.reset..[[) @@ -181,6 +182,7 @@ local function writeDump(filename) if not info then return info, err end -- load dump from file + if not filename then return false, 'No dump filename provided' end io.write('Loading dump from file '..filename..'...') local dump dump, err = utils.ReadDumpFile(filename) @@ -337,12 +339,15 @@ end local function main(args) if #args == 0 then return help() end - for opt, value in getopt.getopt(args, 'hk:r:w') do + local dumpFilename = nil + + for opt, value in getopt.getopt(args, 'hf:k:rw') do local res, err res = true if opt == "h" then return help() end + if opt == "f" then dumpFilename = value end if opt == 'k' then res, err = setPassword(value) end - if opt == 'r' then res, err = writeDump(value) end + if opt == 'r' then res, err = writeDump(dumpFilename) end if opt == 'w' then res, err = wipe() end if not res then return error(err) end end diff --git a/doc/magic_cards_notes.md b/doc/magic_cards_notes.md index 76de2cd32..1b43873e5 100644 --- a/doc/magic_cards_notes.md +++ b/doc/magic_cards_notes.md @@ -2365,7 +2365,7 @@ Use the script `hf_mfu_ultra.lua` to restore (write) dump to tag or clear previo Usage: 1. Restore dump to tag: ``` - script run hf_mfu_ultra -k -r + script run hf_mfu_ultra -f -k -r ``` 2. Wipe tag (use it to prepare tag for restoring another dump): ``` @@ -2379,7 +2379,7 @@ Usage: Examples: 1. Restore dump to tag: ``` - script run hf_mfu_ultra -k ffffffff -r hf-mfu-3476FF1514D866-dump.bin + script run hf_mfu_ultra -f hf-mfu-3476FF1514D866-dump.bin -k ffffffff -r ``` 2. Wipe tag: ``` @@ -2428,7 +2428,7 @@ Use the script `hf_mfu_ultra.lua` to restore (write) dump to tag. Usage: 1. Restore dump to tag: ``` - script run hf_mfu_ultra -k -r + script run hf_mfu_ultra -f -k -r ``` 3. Show help: ``` @@ -2438,7 +2438,7 @@ Usage: Examples: 1. Restore dump to tag: ``` - script run hf_mfu_ultra -k ffffffff -r hf-mfu-3476FF1514D866-dump.bin + script run hf_mfu_ultra -f hf-mfu-3476FF1514D866-dump.bin -k ffffffff -r ``` ## UL, other chips