about summary refs log tree commit diff stats
path: root/test/os_dep/linux/test_env.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2017-04-05 15:54:52 +0200
committerAjax <commial@gmail.com>2017-04-06 13:47:38 +0200
commitf85d5e8f261db7b4c0fc519df056561ad9e45418 (patch)
tree815d678a09bd7997eeb679251f85c90e78d0d18d /test/os_dep/linux/test_env.py
parent53c7778ca9a8877dc56db55ade07afc8864e0270 (diff)
downloadmiasm-f85d5e8f261db7b4c0fc519df056561ad9e45418.tar.gz
miasm-f85d5e8f261db7b4c0fc519df056561ad9e45418.zip
Add regression test for command-line/env support in Sandbox
Diffstat (limited to 'test/os_dep/linux/test_env.py')
-rw-r--r--test/os_dep/linux/test_env.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/os_dep/linux/test_env.py b/test/os_dep/linux/test_env.py
new file mode 100644
index 00000000..a44d62c4
--- /dev/null
+++ b/test/os_dep/linux/test_env.py
@@ -0,0 +1,36 @@
+import os
+import sys
+from pdb import pm
+from miasm2.analysis.binary import Container
+from miasm2.analysis.sandbox import Sandbox_Linux_x86_32, Sandbox_Linux_x86_64,\
+    Sandbox_Linux_arml, Sandbox_Linux_aarch64l
+
+if len(sys.argv) < 2:
+    print "Usage: %s <arch> ..." % sys.argv[0]
+    exit(0)
+
+arch = sys.argv[1]
+
+if arch == "x86_32":
+    sandbox = Sandbox_Linux_x86_32
+elif arch == "x86_64":
+    sandbox = Sandbox_Linux_x86_64
+elif arch == "arml":
+    sandbox = Sandbox_Linux_arml
+elif arch == "aarch64l":
+    sandbox = Sandbox_Linux_aarch64l
+else:
+    raise ValueError("Unsuported arch: %s" % arch)
+
+# Parse arguments
+parser = sandbox.parser(description="ELF sandboxer")
+parser.add_argument("filename", help="ELF Filename")
+options = parser.parse_args(sys.argv[2:])
+
+# Create sandbox
+sb = sandbox(options.filename, options, globals())
+
+# Run
+sb.run()
+
+assert(sb.jitter.run is False)