]> cvs.zerfleddert.de Git - proxmark3-svn/blame_incremental - client/scripts/emul2html.lua
fixing iso14443b (issue #103): fix timing issue (speeding up
[proxmark3-svn] / client / scripts / emul2html.lua
... / ...
CommitLineData
1-- The getopt-functionality is loaded from pm3/getopt.lua
2-- Have a look there for further details
3getopt = require('getopt')
4bin = require('bin')
5dumplib = require('html_dumplib')
6
7example = "script run emul2html -o dumpdata.eml "
8author = "Martin Holst Swende"
9usage = "script run htmldump [-i <file>] [-o <file>]"
10desc =[[
11This script takes a dumpfile on EML (ASCII) format 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.eml' is used
17 -o <filename> Speciies the output file. If omitted, <curdate>.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
37
38
39---
40-- Usage help
41function help()
42 print(desc)
43 print("Example usage")
44 print(example)
45end
46
47local function main(args)
48
49 local input = "dumpdata.eml"
50 local output = os.date("%Y-%m-%d_%H%M%S.html");
51 for o, a in getopt.getopt(args, 'i:o:h') do
52 if o == "h" then return help() end
53 if o == "i" then input = a end
54 if o == "o" then output = a end
55 end
56 local filename, err = dumplib.convert_eml_to_html(input,output)
57 if err then return oops(err) end
58
59 print(("Wrote a HTML dump to the file %s"):format(filename))
60end
61
62--[[
63In the future, we may implement so that scripts are invoked directly
64into a 'main' function, instead of being executed blindly. For future
65compatibility, I have done so, but I invoke my main from here.
66--]]
67main(args)
Impressum, Datenschutz