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