]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/scripts/emul2dump.lua
Various scripts from iceman
[proxmark3-svn] / client / scripts / emul2dump.lua
diff --git a/client/scripts/emul2dump.lua b/client/scripts/emul2dump.lua
new file mode 100644 (file)
index 0000000..315ad99
--- /dev/null
@@ -0,0 +1,60 @@
+local getopt = require('getopt')\r
+local bin = require('bin')\r
+local dumplib = require('html_dumplib')\r
+\r
+example =[[\r
+       1. script run emul2dump\r
+       2. script run emul2dump -i myfile.eml\r
+       3. script run emul2dump -i myfile.eml -o myfile.bin\r
+]]\r
+author = "Iceman"\r
+usage = "script run emul2dump [-i <file>] [-o <file>]"\r
+desc =[[\r
+This script takes an dumpfile on EML (ASCII) format and converts it to the PM3 dumpbin file to be used with "hf mf restore"\r
+\r
+Arguments:\r
+       -h              This help\r
+       -i <filename>   Specifies the dump-file (input). If omitted, 'dumpdata.eml' is used     \r
+       -o <filename>   Specifies the output file. If omitted, <currdate>.bin is used.  \r
+]]\r
+\r
+--- \r
+-- This is only meant to be used when errors occur\r
+function oops(err)\r
+       print("ERROR: ",err)\r
+end\r
+--- \r
+-- Usage help\r
+function help()\r
+       print(desc)\r
+       print("Example usage")\r
+       print(example)\r
+end\r
+--\r
+-- Exit message\r
+function ExitMsg(msg)\r
+       print( string.rep('--',20) )\r
+       print( string.rep('--',20) )\r
+       print(msg)\r
+       print()\r
+end\r
+\r
+local function main(args)\r
+       \r
+       local input = "dumpdata.eml"\r
+       local output  = os.date("%Y-%m-%d_%H%M%S.bin");\r
+       \r
+       -- Arguments for the script\r
+       for o, a in getopt.getopt(args, 'hi:o:') do\r
+               if o == "h" then return help() end              \r
+               if o == "i" then input = a      end\r
+               if o == "o" then output = a end\r
+       end\r
+\r
+       local filename, err = dumplib.convert_eml_to_bin(input,output)\r
+       if err then return oops(err) end\r
+\r
+       ExitMsg(("Wrote a BIN dump to the file %s"):format(filename))\r
+end\r
+\r
+main(args)
\ No newline at end of file
Impressum, Datenschutz