1 local getopt
= require('getopt')
2 local lib14a
= require('read14a')
3 local cmds
= require('commands')
4 local ansicolors
= require('ansicolors')
6 copyright
= 'Copyright 2020 A. Ozkal, released under GPLv2+.'
10 This script writes a bunch of random blocks to a Mifare Classic card
13 script run mfc_hammerlite -w 1000 -k FFFFFFFFFFFF
16 script run mfc_hammerlite [-h] [-w <writecount>] [-k <key>]
20 -w <writeroundcount> : Amount of write rounds to be done to each block (optional, default: 100)
21 -k <key> : A key for the sectors
28 print(ansicolors
.cyan
..'Usage'..ansicolors
.reset
)
30 print(ansicolors
.cyan
..'Arguments'..ansicolors
.reset
)
32 print(ansicolors
.cyan
..'Example usage'..ansicolors
.reset
)
40 -- 48-57 numbers, 65-70 a-f
41 hex
= math
.random(0, 15)
45 result
= result
..string.char(48 + hex
)
51 -- The main entry point
58 -- Read the parameters
59 for o
, a
in getopt
.getopt(args
, 'hw:k:') do
60 if o
== 'h' then return help() end
61 if o
== 'w' then loopcount
= tonumber(a
) end
62 if o
== 'k' then key
= a
end
71 if ((a
+ 1) % 4 ~= 0) and a
~= 0 then -- :)
73 -- core.console('hf mf rdbl --blk '..a..' -k FFFFFFFFFFFF')
74 core
.console('hf mf wrbl --blk '..a
..' -k '..key
..' -d '..data
)
79 print("Hammering complete.")