mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-22 05:00:29 +08:00
chg: 'script run formatMifare' - added the 'x' parameter. when using this parameter, the generated commands will also be EXECUTED against your card. This will wipe your card.
This commit is contained in:
parent
fdd4186aa0
commit
6bae0b8590
1 changed files with 19 additions and 6 deletions
|
@ -5,11 +5,19 @@ local lib14a = require('read14a')
|
||||||
local utils = require('utils')
|
local utils = require('utils')
|
||||||
|
|
||||||
example =[[
|
example =[[
|
||||||
|
-- generate commands
|
||||||
1. script run formatMifare
|
1. script run formatMifare
|
||||||
|
|
||||||
|
-- generate command, replacing key with new key.
|
||||||
2. script run formatMifare -k aabbccddeeff -n 112233445566 -a FF0780
|
2. script run formatMifare -k aabbccddeeff -n 112233445566 -a FF0780
|
||||||
|
|
||||||
|
-- generate commands and excute them against card.
|
||||||
|
3. script run formatMifare -x
|
||||||
]]
|
]]
|
||||||
author = "Iceman"
|
author = "Iceman"
|
||||||
usage = "script run formatMifare -k <key>"
|
usage = [[
|
||||||
|
script run formatMifare -k <key> -n <key> -a <access> -x
|
||||||
|
]]
|
||||||
desc =[[
|
desc =[[
|
||||||
This script will generate 'hf mf wrbl' commands for each block to format a Mifare card.
|
This script will generate 'hf mf wrbl' commands for each block to format a Mifare card.
|
||||||
|
|
||||||
|
@ -20,11 +28,13 @@ The GDB will become 0x00
|
||||||
|
|
||||||
The script will skip the manufactoring block 0.
|
The script will skip the manufactoring block 0.
|
||||||
|
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
-h - this help
|
-h - this help
|
||||||
-k <key> - the current six byte key with write access
|
-k <key> - the current six byte key with write access
|
||||||
-n <key> - the new key that will be written to the card
|
-n <key> - the new key that will be written to the card
|
||||||
-a <access> - the new access bytes that will be written to the card
|
-a <access> - the new access bytes that will be written to the card
|
||||||
|
-x - execute the commands aswell.
|
||||||
]]
|
]]
|
||||||
local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
|
local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
|
||||||
local DEBUG = true -- the debug flag
|
local DEBUG = true -- the debug flag
|
||||||
|
@ -118,16 +128,16 @@ local function main(args)
|
||||||
print( string.rep('--',20) )
|
print( string.rep('--',20) )
|
||||||
print()
|
print()
|
||||||
|
|
||||||
local OldKey
|
local OldKey, NewKey, Accessbytes
|
||||||
local NewKey
|
local x = false
|
||||||
local Accessbytes
|
|
||||||
|
|
||||||
-- Arguments for the script
|
-- Arguments for the script
|
||||||
for o, a in getopt.getopt(args, 'hk:n:a:') do
|
for o, a in getopt.getopt(args, 'hk:n:a:x') do
|
||||||
if o == "h" then return help() end
|
if o == "h" then return help() end
|
||||||
if o == "k" then OldKey = a end
|
if o == "k" then OldKey = a end
|
||||||
if o == "n" then NewKey = a end
|
if o == "n" then NewKey = a end
|
||||||
if o == "a" then Accessbytes = a end
|
if o == "a" then Accessbytes = a end
|
||||||
|
if o == "x" then x = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- validate input args.
|
-- validate input args.
|
||||||
|
@ -164,6 +174,9 @@ local function main(args)
|
||||||
dbg( string.format('New emptyblock: %s',EMPTY_BL))
|
dbg( string.format('New emptyblock: %s',EMPTY_BL))
|
||||||
dbg('')
|
dbg('')
|
||||||
|
|
||||||
|
if x then
|
||||||
|
print('[Warning] you have used the EXECUTE parameter, which means this will run these commands against card.')
|
||||||
|
end
|
||||||
-- Ask
|
-- Ask
|
||||||
local dialogResult = utils.confirm("Do you want to erase this card")
|
local dialogResult = utils.confirm("Do you want to erase this card")
|
||||||
if dialogResult == false then
|
if dialogResult == false then
|
||||||
|
@ -185,7 +198,7 @@ local function main(args)
|
||||||
|
|
||||||
if block ~= 0 then
|
if block ~= 0 then
|
||||||
print(cmd)
|
print(cmd)
|
||||||
--core.console(cmd)
|
if x then core.console(cmd) end
|
||||||
end
|
end
|
||||||
|
|
||||||
if core.ukbhit() then
|
if core.ukbhit() then
|
||||||
|
|
Loading…
Add table
Reference in a new issue