The '-f' option replaces the direct specification of the dump filename in the '-r' command.

This commit is contained in:
Dmitry Malenok 2025-05-12 22:33:26 +03:00
parent 0cbf42e0ec
commit a9244b8ea4
2 changed files with 13 additions and 8 deletions

View file

@ -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 <passwd> -w -r <dump filename>
script run hf_mfu_ultra -h -f <dump filename> -k <passwd> -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

View file

@ -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 <passwd> -r <dump filename>
script run hf_mfu_ultra -f <dump filename> -k <passwd> -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 <passwd> -r <dump filename>
script run hf_mfu_ultra -f <dump filename> -k <passwd> -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