mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
textual
This commit is contained in:
parent
3c533db308
commit
6b472f6c56
1 changed files with 45 additions and 45 deletions
|
@ -4,6 +4,19 @@ local bin = require('bin')
|
||||||
local lib14a = require('read14a')
|
local lib14a = require('read14a')
|
||||||
local utils = require('utils')
|
local utils = require('utils')
|
||||||
|
|
||||||
|
copyright = ''
|
||||||
|
author = 'Iceman'
|
||||||
|
version = 'v1.0.1'
|
||||||
|
desc = [[
|
||||||
|
This script will generate 'hf mf wrbl' commands for each block to format a Mifare card.
|
||||||
|
|
||||||
|
Alla datablocks gets 0x00
|
||||||
|
As default the script sets the keys A/B to 0xFFFFFFFFFFFF
|
||||||
|
and the access bytes will become 0x78,0x77,0x88
|
||||||
|
The GDB will become 0x00
|
||||||
|
|
||||||
|
The script will skip the manufactoring block 0.
|
||||||
|
]]
|
||||||
example = [[
|
example = [[
|
||||||
-- generate commands
|
-- generate commands
|
||||||
1. script run formatMifare
|
1. script run formatMifare
|
||||||
|
@ -14,22 +27,8 @@ example = [[
|
||||||
-- generate commands and execute them against card.
|
-- generate commands and execute them against card.
|
||||||
3. script run formatMifare -x
|
3. script run formatMifare -x
|
||||||
]]
|
]]
|
||||||
copyright = ''
|
|
||||||
version = ''
|
|
||||||
author = 'Iceman'
|
|
||||||
usage = [[
|
usage = [[
|
||||||
script run formatMifare -k <key> -n <key> -a <access> -x
|
script run formatMifare -k <key> -n <key> -a <access> -x
|
||||||
]]
|
|
||||||
desc = [[
|
|
||||||
This script will generate 'hf mf wrbl' commands for each block to format a Mifare card.
|
|
||||||
|
|
||||||
Alla datablocks gets 0x00
|
|
||||||
As default the script sets the keys A/B to 0xFFFFFFFFFFFF
|
|
||||||
and the access bytes will become 0x78,0x77,0x88
|
|
||||||
The GDB will become 0x00
|
|
||||||
|
|
||||||
The script will skip the manufactoring block 0.
|
|
||||||
|
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
-h - this help
|
-h - this help
|
||||||
|
@ -38,6 +37,7 @@ Arguments:
|
||||||
-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.
|
-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
|
||||||
local CmdString = 'hf mf wrbl %d B %s %s'
|
local CmdString = 'hf mf wrbl %d B %s %s'
|
||||||
|
@ -45,39 +45,39 @@ local numBlocks = 64
|
||||||
local numSectors = 16
|
local numSectors = 16
|
||||||
---
|
---
|
||||||
-- A debug printout-function
|
-- A debug printout-function
|
||||||
function dbg(args)
|
local function dbg(args)
|
||||||
if not DEBUG then
|
if not DEBUG then return end
|
||||||
return
|
if type(args) == 'table' then
|
||||||
end
|
|
||||||
|
|
||||||
if type(args) == "table" then
|
|
||||||
local i = 1
|
local i = 1
|
||||||
while result[i] do
|
while args[i] do
|
||||||
dbg(result[i])
|
dbg(args[i])
|
||||||
i = i+1
|
i = i+1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("###", args)
|
print('###', args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
---
|
---
|
||||||
-- This is only meant to be used when errors occur
|
-- This is only meant to be used when errors occur
|
||||||
function oops(err)
|
local function oops(err)
|
||||||
print("ERROR: ",err)
|
print('ERROR:', err)
|
||||||
|
core.clearCommandBuffer()
|
||||||
|
return nil, err
|
||||||
end
|
end
|
||||||
---
|
---
|
||||||
-- Usage help
|
-- Usage help
|
||||||
function help()
|
local function help()
|
||||||
print(copyright)
|
print(copyright)
|
||||||
print(author)
|
print(author)
|
||||||
print(version)
|
print(version)
|
||||||
print(desc)
|
print(desc)
|
||||||
print("Example usage")
|
print('Example usage')
|
||||||
print(example)
|
print(example)
|
||||||
|
print(usage)
|
||||||
end
|
end
|
||||||
--
|
--
|
||||||
-- Exit message
|
-- Exit message
|
||||||
function ExitMsg(msg)
|
local function ExitMsg(msg)
|
||||||
print( string.rep('--',20) )
|
print( string.rep('--',20) )
|
||||||
print( string.rep('--',20) )
|
print( string.rep('--',20) )
|
||||||
print(msg)
|
print(msg)
|
||||||
|
@ -91,7 +91,7 @@ function GetCardInfo()
|
||||||
print(err)
|
print(err)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
print(("Found: %s"):format(result.name))
|
print(('Found: %s'):format(result.name))
|
||||||
|
|
||||||
core.clearCommandBuffer()
|
core.clearCommandBuffer()
|
||||||
|
|
||||||
|
@ -138,11 +138,11 @@ local function main(args)
|
||||||
|
|
||||||
-- Arguments for the script
|
-- Arguments for the script
|
||||||
for o, a in getopt.getopt(args, 'hk:n:a:x') 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
|
if o == 'x' then x = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- validate input args.
|
-- validate input args.
|
||||||
|
@ -183,7 +183,7 @@ local function main(args)
|
||||||
print('[Warning] you have used the EXECUTE parameter, which means this will run these commands against card.')
|
print('[Warning] you have used the EXECUTE parameter, which means this will run these commands against card.')
|
||||||
end
|
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
|
||||||
return ExitMsg('Quiting it is then. Your wish is my command...')
|
return ExitMsg('Quiting it is then. Your wish is my command...')
|
||||||
end
|
end
|
||||||
|
@ -207,7 +207,7 @@ local function main(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
if core.ukbhit() then
|
if core.ukbhit() then
|
||||||
print("aborted by user")
|
print('aborted by user')
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue