]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/scripts/htmldump.lua
FIX: coverity scan error CID 121781, unused value. error 0x88 will be overritten...
[proxmark3-svn] / client / scripts / htmldump.lua
CommitLineData
d78792f5 1-- The getopt-functionality is loaded from pm3/getopt.lua
2-- Have a look there for further details
3getopt = require('getopt')
4bin = require('bin')
6742c089 5dumplib = require('html_dumplib')
d78792f5 6
2fca3ad9 7example = "script run htmldump -o mifarecard_foo.html"
d78792f5 8author = "Martin Holst Swende"
2fca3ad9 9usage = "script run htmldump [-i <file>] [-o <file>]"
d78792f5 10desc =[[
11This script takes a dumpfile and produces a html based dump, which is a
12bit more easily analyzed.
13
14Arguments:
15 -h This help
16 -i <file> Specifies the dump-file (input). If omitted, 'dumpdata.bin' is used
17 -o <filename> Speciies the output file. If omitted, <curtime>.html is used.
18
19]]
20
21-------------------------------
22-- Some utilities
23-------------------------------
24
25---
26-- A debug printout-function
27function dbg(args)
28 if DEBUG then
29 print("###", args)
30 end
31end
32---
33-- This is only meant to be used when errors occur
34function oops(err)
35 print("ERROR: ",err)
36end
d78792f5 37---
38-- Usage help
39function help()
40 print(desc)
41 print("Example usage")
42 print(example)
43end
44
d78792f5 45local function main(args)
46
d78792f5 47 local input = "dumpdata.bin"
48 local output = os.date("%Y-%m-%d_%H%M%S.html");
49 for o, a in getopt.getopt(args, 'i:o:h') do
50 if o == "h" then return help() end
51 if o == "i" then input = a end
52 if o == "o" then output = a end
53 end
6742c089 54 local filename, err = dumplib.convert_bin_to_html(input,output,16)
55 if err then return oops(err) end
d78792f5 56
6742c089 57 print(("Wrote a HTML dump to the file %s"):format(filename))
d78792f5 58end
59
d78792f5 60--[[
61In the future, we may implement so that scripts are invoked directly
62into a 'main' function, instead of being executed blindly. For future
63compatibility, I have done so, but I invoke my main from here.
64--]]
65main(args)
Impressum, Datenschutz