This commit is contained in:
iceman1001 2019-05-07 23:41:41 +02:00
parent 9c95a2e8aa
commit d313804e78
2 changed files with 53 additions and 33 deletions

View file

@ -4,12 +4,18 @@ getopt = require('getopt')
bin = require('bin') bin = require('bin')
dumplib = require('html_dumplib') dumplib = require('html_dumplib')
example = "script run htmldump -o mifarecard_foo.html" copyright = ''
author = "Martin Holst Swende" author = 'Martin Holst Swende'
usage = "script run htmldump [-i <file>] [-o <file>]" version = 'v1.0.1'
desc =[[ desc =[[
This script takes a dumpfile and produces a html based dump, which is a This script takes a dumpfile and produces a html based dump, which is a
bit more easily analyzed. bit more easily analyzed.
]]
example = [[
script run htmldump -o mifarecard_foo.html
]]
usage = [[
script run htmldump [-i <file>] [-o <file>]
Arguments: Arguments:
-h This help -h This help
@ -17,44 +23,56 @@ Arguments:
-o <filename> Speciies the output file. If omitted, <curtime>.html is used. -o <filename> Speciies the output file. If omitted, <curtime>.html is used.
]] ]]
------------------------------- -------------------------------
-- Some utilities -- Some utilities
------------------------------- -------------------------------
--- ---
-- A debug printout-function -- A debug printout-function
function dbg(args) local function dbg(args)
if DEBUG then if not DEBUG then return end
print("###", args) if type(args) == 'table' then
local i = 1
while args[i] do
dbg(args[i])
i = i+1
end
else
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(author)
print(version)
print(desc) print(desc)
print("Example usage") print('Example usage')
print(example) print(example)
print(usage)
end end
local function main(args) local function main(args)
local input = "dumpdata.bin" local input = 'dumpdata.bin'
local output = os.date("%Y-%m-%d_%H%M%S.html"); local output = os.date('%Y-%m-%d_%H%M%S.html');
for o, a in getopt.getopt(args, 'i:o:h') do for o, a in getopt.getopt(args, 'i:o:h') do
if o == "h" then return help() end if o == 'h' then return help() end
if o == "i" then input = a end if o == 'i' then input = a end
if o == "o" then output = a end if o == 'o' then output = a end
end end
local filename, err = dumplib.convert_bin_to_html(input,output,16) local filename, err = dumplib.convert_bin_to_html(input,output, 16)
if err then return oops(err) end if err then return oops(err) end
print(("Wrote a HTML dump to the file %s"):format(filename)) print(('Wrote a HTML dump to the file %s'):format(filename))
end end
--[[ --[[

View file

@ -5,7 +5,7 @@ local utils = require('utils')
copyright = 'Copyright (c) 2018 IceSQL AB. All rights reserved.' copyright = 'Copyright (c) 2018 IceSQL AB. All rights reserved.'
author = 'Christian Herrmann' author = 'Christian Herrmann'
version = 'v1.0.4' version = 'v1.0.5'
desc = [[ desc = [[
This script tries to set UID on a IS15693 SLIX magic card This script tries to set UID on a IS15693 SLIX magic card
Remember the UID ->MUST<- start with 0xE0 Remember the UID ->MUST<- start with 0xE0
@ -32,20 +32,21 @@ local DEBUG = true
-- A debug printout-function -- A debug printout-function
local function dbg(args) local function dbg(args)
if not DEBUG then return end if not DEBUG then return end
if type(args) == "table" then if type(args) == 'table' then
local i = 1 local i = 1
while args[i] do while args[i] do
dbg(args[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
local function oops(err) local function oops(err)
print("ERROR: ",err) print('ERROR:', err)
core.clearCommandBuffer()
return nil, err return nil, err
end end
--- ---
@ -57,24 +58,25 @@ local function help()
print(desc) print(desc)
print('Example usage') print('Example usage')
print(example) print(example)
print(usage)
end end
-- --
--- Set UID on magic command enabled on a ICEMAN based REPO --- Set UID on magic command enabled on a ICEMAN based REPO
local function magicUID_iceman(b0, b1) local function magicUID_iceman(b0, b1)
print('Using backdoor Magic tag function') print('Using backdoor Magic tag function')
core.console("hf 15 raw -2 -c 02213E00000000") core.console('hf 15 raw -2 -c 02213E00000000')
core.console("hf 15 raw -2 -c 02213F69960000") core.console('hf 15 raw -2 -c 02213F69960000')
core.console("hf 15 raw -2 -c 022138"..b1) core.console('hf 15 raw -2 -c 022138'..b1)
core.console("hf 15 raw -2 -c 022139"..b0) core.console('hf 15 raw -2 -c 022139'..b0)
end end
-- --
--- Set UID on magic command enabled, OFFICAL REPO --- Set UID on magic command enabled, OFFICAL REPO
local function magicUID_offical(b0, b1) local function magicUID_offical(b0, b1)
print('Using backdoor Magic tag function OFFICAL REPO') print('Using backdoor Magic tag function OFFICAL REPO')
core.console("hf 15 cmd raw -c 02213E00000000") core.console('hf 15 cmd raw -c 02213E00000000')
core.console("hf 15 cmd raw -c 02213F69960000") core.console('hf 15 cmd raw -c 02213F69960000')
core.console("hf 15 cmd raw -c 022138"..b1) core.console('hf 15 cmd raw -c 022138'..b1)
core.console("hf 15 cmd raw -c 022139"..b0) core.console('hf 15 cmd raw -c 022139'..b0)
end end
--- ---
-- The main entry point -- The main entry point
@ -89,9 +91,9 @@ function main(args)
-- Read the parameters -- Read the parameters
for o, a in getopt.getopt(args, 'hu:a') do for o, a in getopt.getopt(args, 'hu:a') do
if o == "h" then return help() end if o == 'h' then return help() end
if o == "u" then uid = a end if o == 'u' then uid = a end
if o == "a" then use_iceman = false end if o == 'a' then use_iceman = false end
end end
-- uid string checks -- uid string checks