diff --git a/client/scripts/htmldump.lua b/client/scripts/htmldump.lua index afd76abee..0101c14a8 100644 --- a/client/scripts/htmldump.lua +++ b/client/scripts/htmldump.lua @@ -4,12 +4,18 @@ getopt = require('getopt') bin = require('bin') dumplib = require('html_dumplib') -example = "script run htmldump -o mifarecard_foo.html" -author = "Martin Holst Swende" -usage = "script run htmldump [-i ] [-o ]" +copyright = '' +author = 'Martin Holst Swende' +version = 'v1.0.1' desc =[[ This script takes a dumpfile and produces a html based dump, which is a bit more easily analyzed. +]] +example = [[ + script run htmldump -o mifarecard_foo.html +]] +usage = [[ +script run htmldump [-i ] [-o ] Arguments: -h This help @@ -17,44 +23,56 @@ Arguments: -o Speciies the output file. If omitted, .html is used. ]] - ------------------------------- -- Some utilities ------------------------------- --- -- A debug printout-function -function dbg(args) - if DEBUG then - print("###", args) +local function dbg(args) + if not DEBUG then return end + if type(args) == 'table' then + local i = 1 + while args[i] do + dbg(args[i]) + i = i+1 + end + else + print('###', args) end end --- -- This is only meant to be used when errors occur -function oops(err) - print("ERROR: ",err) +local function oops(err) + print('ERROR:', err) + core.clearCommandBuffer() + return nil, err end --- -- Usage help -function help() +local function help() + print(copyright) + print(author) + print(version) print(desc) - print("Example usage") + print('Example usage') print(example) + print(usage) end local function main(args) - local input = "dumpdata.bin" - local output = os.date("%Y-%m-%d_%H%M%S.html"); + local input = 'dumpdata.bin' + local output = os.date('%Y-%m-%d_%H%M%S.html'); for o, a in getopt.getopt(args, 'i:o:h') do - if o == "h" then return help() end - if o == "i" then input = a end - if o == "o" then output = a end + if o == 'h' then return help() end + if o == 'i' then input = a end + if o == 'o' then output = a 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 - print(("Wrote a HTML dump to the file %s"):format(filename)) + print(('Wrote a HTML dump to the file %s'):format(filename)) end --[[ diff --git a/client/scripts/iso15_magic.lua b/client/scripts/iso15_magic.lua index 939c7a943..ba94465e4 100644 --- a/client/scripts/iso15_magic.lua +++ b/client/scripts/iso15_magic.lua @@ -5,7 +5,7 @@ local utils = require('utils') copyright = 'Copyright (c) 2018 IceSQL AB. All rights reserved.' author = 'Christian Herrmann' -version = 'v1.0.4' +version = 'v1.0.5' desc = [[ This script tries to set UID on a IS15693 SLIX magic card Remember the UID ->MUST<- start with 0xE0 @@ -32,20 +32,21 @@ local DEBUG = true -- A debug printout-function local function dbg(args) if not DEBUG then return end - if type(args) == "table" then + if type(args) == 'table' then local i = 1 while args[i] do dbg(args[i]) i = i+1 end else - print("###", args) + print('###', args) end end --- -- This is only meant to be used when errors occur local function oops(err) - print("ERROR: ",err) + print('ERROR:', err) + core.clearCommandBuffer() return nil, err end --- @@ -57,24 +58,25 @@ local function help() print(desc) print('Example usage') print(example) + print(usage) end -- --- Set UID on magic command enabled on a ICEMAN based REPO local function magicUID_iceman(b0, b1) print('Using backdoor Magic tag function') - core.console("hf 15 raw -2 -c 02213E00000000") - core.console("hf 15 raw -2 -c 02213F69960000") - 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 02213E00000000') + core.console('hf 15 raw -2 -c 02213F69960000') + core.console('hf 15 raw -2 -c 022138'..b1) + core.console('hf 15 raw -2 -c 022139'..b0) end -- --- Set UID on magic command enabled, OFFICAL REPO local function magicUID_offical(b0, b1) print('Using backdoor Magic tag function OFFICAL REPO') - core.console("hf 15 cmd raw -c 02213E00000000") - core.console("hf 15 cmd raw -c 02213F69960000") - 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 02213E00000000') + core.console('hf 15 cmd raw -c 02213F69960000') + core.console('hf 15 cmd raw -c 022138'..b1) + core.console('hf 15 cmd raw -c 022139'..b0) end --- -- The main entry point @@ -89,9 +91,9 @@ function main(args) -- Read the parameters for o, a in getopt.getopt(args, 'hu:a') do - if o == "h" then return help() end - if o == "u" then uid = a end - if o == "a" then use_iceman = false end + if o == 'h' then return help() end + if o == 'u' then uid = a end + if o == 'a' then use_iceman = false end end -- uid string checks