about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2015-12-13 23:21:03 +0100
committerserpilliere <serpilliere@users.noreply.github.com>2015-12-13 23:21:03 +0100
commit50bd2c19a44cf511264f4d56f833a3e416441fef (patch)
treecf9993960896e31517690118d6ee2ce098dedec6
parentb32eb145fce7dd09bef025a9f82b2507bd4e02ee (diff)
parent8afddf15d33f6aa593e640e36c17b1afbe3ec175 (diff)
downloadmiasm-50bd2c19a44cf511264f4d56f833a3e416441fef.tar.gz
miasm-50bd2c19a44cf511264f4d56f833a3e416441fef.zip
Merge pull request #292 from p-l-/fix-sandbox-options
Fix sandbox options
-rw-r--r--example/jitter/unpack_upx.py4
-rw-r--r--miasm2/analysis/sandbox.py7
2 files changed, 6 insertions, 5 deletions
diff --git a/example/jitter/unpack_upx.py b/example/jitter/unpack_upx.py
index c329244e..58507506 100644
--- a/example/jitter/unpack_upx.py
+++ b/example/jitter/unpack_upx.py
@@ -43,7 +43,9 @@ parser.add_argument("--graph",
                     help="Export the CFG graph in graph.dot",
                     action="store_true")
 options = parser.parse_args()
-sb = Sandbox_Win_x86_32(options.filename, options, globals(), parse_reloc=False)
+options.load_hdr = True
+sb = Sandbox_Win_x86_32(options.filename, options, globals(),
+                        parse_reloc=False)
 
 
 if options.verbose is True:
diff --git a/miasm2/analysis/sandbox.py b/miasm2/analysis/sandbox.py
index 078663fe..115fd521 100644
--- a/miasm2/analysis/sandbox.py
+++ b/miasm2/analysis/sandbox.py
@@ -184,7 +184,8 @@ class OS_Win(OS):
 
         # Load main pe
         with open(self.fname) as fstream:
-            self.pe = vm_load_pe(self.jitter.vm, fstream.read(), **kwargs)
+            self.pe = vm_load_pe(self.jitter.vm, fstream.read(),
+                                 load_hdr=self.options.load_hdr, **kwargs)
             self.name2module[fname_basename] = self.pe
 
         # Load library
@@ -231,10 +232,8 @@ class OS_Win(OS):
 
     @classmethod
     def update_parser(cls, parser):
-        parser.add_argument('-o', "--loadhdr", action="store_true",
+        parser.add_argument('-o', "--load-hdr", action="store_true",
                             help="Load pe hdr")
-        parser.add_argument('-e', "--loadmainpe", action="store_true",
-                            help="Load main pe")
         parser.add_argument('-y', "--use-seh", action="store_true",
                             help="Use windows SEH")
         parser.add_argument('-l', "--loadbasedll", action="store_true",