1 local getopt
= require('getopt')
2 local bin
= require('bin')
3 local dumplib
= require('html_dumplib')
4 local ansicolors
= require('ansicolors')
10 This script takes an dumpfile in EML (ASCII) format and converts it to the PM3 dumpbin file to be used with `hf mf restore`
13 1. script run data_mf_eml2bin
14 2. script run data_mf_eml2bin -i myfile.eml
15 3. script run data_mf_eml2bin -i myfile.eml -o myfile.bin
18 script run data_mf_eml2bin [-i <file>] [-o <file>]
22 -i <filename> Specifies the dump-file (input). If omitted, 'dumpdata.eml' is used
23 -o <filename> Specifies the output file. If omitted, <currdate>.bin is used.
27 -- This is only meant to be used when errors occur
28 local function dbg(args
)
29 if not DEBUG
then return end
30 if type(args
) == 'table' then
41 -- This is only meant to be used when errors occur
42 local function oops(err
)
43 print('[!!] ERROR:', err
)
44 core
.clearCommandBuffer()
54 print(ansicolors
.cyan
..'Usage'..ansicolors
.reset
)
56 print(ansicolors
.cyan
..'Arguments'..ansicolors
.reset
)
58 print(ansicolors
.cyan
..'Example usage'..ansicolors
.reset
)
63 local function ExitMsg(msg
)
64 print( string.rep('--',20) )
65 print( string.rep('--',20) )
70 local function main(args
)
72 local input
= 'dumpdata.eml'
73 local output
= os
.date('%Y-%m-%d_%H%M%S.bin');
75 -- Arguments for the script
76 for o
, a
in getopt
.getopt(args
, 'hi:o:') do
77 if o
== 'h' then return help() end
78 if o
== 'i' then input
= a
end
79 if o
== 'o' then output
= a
end
82 local filename
, err
= dumplib
.convert_eml_to_bin(input
,output
)
83 if err
then return oops(err
) end
85 ExitMsg(('[+] Wrote a BIN dump to the file %s'):format(filename
))