about summary refs log tree commit diff stats
path: root/miasm2/analysis/sandbox.py
diff options
context:
space:
mode:
authorAymeric Vincent <aymeric.vincent@cea.fr>2015-10-27 21:27:27 +0100
committerAymeric Vincent <aymeric.vincent@cea.fr>2015-10-27 21:27:27 +0100
commit5dbf046bbe07a28485a84eca14405d271d1ea7fa (patch)
tree5cabdd356882f4d2606a02cc0ed468894f68a586 /miasm2/analysis/sandbox.py
parentfb32efb74e2dc1077586a2214de558db6940b70b (diff)
downloadmiasm-5dbf046bbe07a28485a84eca14405d271d1ea7fa.tar.gz
miasm-5dbf046bbe07a28485a84eca14405d271d1ea7fa.zip
In interactive use, allow C-like prefixes to choose the base of integers
Use Python's int(s, 0) to allow string "s" to specify its base where
addresses and offsets can be supplied.
This change makes the situation homogeneous among the various examples and
interactive usage.
Diffstat (limited to 'miasm2/analysis/sandbox.py')
-rw-r--r--miasm2/analysis/sandbox.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/miasm2/analysis/sandbox.py b/miasm2/analysis/sandbox.py
index 9dc800fc..b3184626 100644
--- a/miasm2/analysis/sandbox.py
+++ b/miasm2/analysis/sandbox.py
@@ -97,7 +97,7 @@ class Sandbox(object):
         @addr: (int) start address
         """
         if addr is None and self.options.address is not None:
-            addr = int(self.options.address, 16)
+            addr = int(self.options.address, 0)
 
         if any([self.options.debugging, self.options.gdbserver]):
             dbg = debugging.Debugguer(self.jitter)
@@ -252,7 +252,7 @@ class OS_Linux_str(OS):
         self.libs = libs
 
         data = open(self.fname).read()
-        self.options.load_base_addr = int(self.options.load_base_addr, 16)
+        self.options.load_base_addr = int(self.options.load_base_addr, 0)
         self.jitter.vm.add_memory_page(self.options.load_base_addr, PAGE_READ | PAGE_WRITE, data)
 
         # Library calls handler
@@ -479,7 +479,7 @@ class Sandbox_Linux_armb_str(Sandbox, Arch_armb, OS_Linux_str):
 
     def run(self, addr = None):
         if addr is None and self.options.address is not None:
-            addr = int(self.options.address, 16)
+            addr = int(self.options.address, 0)
         super(Sandbox_Linux_armb_str, self).run(addr)
 
 
@@ -496,7 +496,7 @@ class Sandbox_Linux_arml_str(Sandbox, Arch_arml, OS_Linux_str):
 
     def run(self, addr = None):
         if addr is None and self.options.address is not None:
-            addr = int(self.options.address, 16)
+            addr = int(self.options.address, 0)
         super(Sandbox_Linux_arml_str, self).run(addr)
 
 
@@ -513,5 +513,5 @@ class Sandbox_Linux_aarch64l(Sandbox, Arch_aarch64l, OS_Linux):
 
     def run(self, addr = None):
         if addr is None and self.options.address is not None:
-            addr = int(self.options.address, 16)
+            addr = int(self.options.address, 0)
         super(Sandbox_Linux_aarch64l, self).run(addr)