about summary refs log tree commit diff stats
path: root/test/os_dep/linux/test_env.py
diff options
context:
space:
mode:
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)