Enhance 4 or 7 bytes UID management in hf_mf_uidbruteforce script

This commit is contained in:
Sebastien Copin 2022-02-07 13:55:16 +01:00
commit 3d0c8974bc

View file

@ -86,6 +86,7 @@ local function main(args)
local start_id = 0
local end_id = 0xFFFFFFFFFFFFFF
local mftype = 'mfc'
local uid_format = '%14x'
for o, a in getopt.getopt(args, 'e:s:t:x:h') do
if o == 's' then start_id = a end
@ -98,11 +99,16 @@ local function main(args)
-- template
local command = ''
-- if the end_id is equals or inferior to 0xFFFFFFFF then use the 4 bytes UID format by default
if string.len(end_id) <= 10 then
uid_format = '%08x'
end
if mftype == 'mfc' then
command = 'hf 14a sim -t 1 -u %014x'
command = 'hf 14a sim -t 1 -u ' .. uid_format
msg('Bruteforcing Mifare Classic card numbers')
elseif mftype == 'mfu' then
command = 'hf 14a sim -t 2 -u %014x'
command = 'hf 14a sim -t 2 -u ' .. uid_format
msg('Bruteforcing Mifare Ultralight card numbers')
else
return print(usage)