]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/scripts/emul2dump.lua
FIX: removed printBits reference.
[proxmark3-svn] / client / scripts / emul2dump.lua
1 local getopt = require('getopt')
2 local bin = require('bin')
3 local dumplib = require('html_dumplib')
4
5 example =[[
6 1. script run emul2dump
7 2. script run emul2dump -i myfile.eml
8 3. script run emul2dump -i myfile.eml -o myfile.bin
9 ]]
10 author = "Iceman"
11 usage = "script run emul2dump [-i <file>] [-o <file>]"
12 desc =[[
13 This script takes an dumpfile on EML (ASCII) format and converts it to the PM3 dumpbin file to be used with "hf mf restore"
14
15 Arguments:
16 -h This help
17 -i <filename> Specifies the dump-file (input). If omitted, 'dumpdata.eml' is used
18 -o <filename> Specifies the output file. If omitted, <currdate>.bin is used.
19 ]]
20
21 ---
22 -- This is only meant to be used when errors occur
23 function oops(err)
24 print("ERROR: ",err)
25 end
26 ---
27 -- Usage help
28 function help()
29 print(desc)
30 print("Example usage")
31 print(example)
32 end
33 --
34 -- Exit message
35 function ExitMsg(msg)
36 print( string.rep('--',20) )
37 print( string.rep('--',20) )
38 print(msg)
39 print()
40 end
41
42 local function main(args)
43
44 local input = "dumpdata.eml"
45 local output = os.date("%Y-%m-%d_%H%M%S.bin");
46
47 -- Arguments for the script
48 for o, a in getopt.getopt(args, 'hi:o:') do
49 if o == "h" then return help() end
50 if o == "i" then input = a end
51 if o == "o" then output = a end
52 end
53
54 local filename, err = dumplib.convert_eml_to_bin(input,output)
55 if err then return oops(err) end
56
57 ExitMsg(("Wrote a BIN dump to the file %s"):format(filename))
58 end
59
60 main(args)
Impressum, Datenschutz