1 local getopt = require('getopt')
2 local bin = require('bin')
3 local dumplib = require('html_dumplib')
6 1. script run emul2dump
7 2. script run emul2dump -i myfile.eml
8 3. script run emul2dump -i myfile.eml -o myfile.bin
11 usage = "script run emul2dump [-i <file>] [-o <file>]"
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"
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.
22 -- This is only meant to be used when errors occur
30 print("Example usage")
36 print( string.rep('--',20) )
37 print( string.rep('--',20) )
42 local function main(args)
44 local input = "dumpdata.eml"
45 local output = os.date("%Y-%m-%d_%H%M%S.bin");
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
54 local filename, err = dumplib.convert_eml_to_bin(input,output)
55 if err then return oops(err) end
57 ExitMsg(("Wrote a BIN dump to the file %s"):format(filename))