diff options
Diffstat (limited to 'miasm2/analysis')
| -rw-r--r-- | miasm2/analysis/debugging.py | 25 | ||||
| -rw-r--r-- | miasm2/analysis/sandbox.py | 10 |
2 files changed, 10 insertions, 25 deletions
diff --git a/miasm2/analysis/debugging.py b/miasm2/analysis/debugging.py index 3fffbf66..74551a72 100644 --- a/miasm2/analysis/debugging.py +++ b/miasm2/analysis/debugging.py @@ -273,10 +273,7 @@ class DebugCmd(cmd.Cmd, object): def add_breakpoints(self, bp_addr): for addr in bp_addr: - if "0x" in addr: - addr = int(addr, 16) - else: - addr = int(addr) + addr = int(addr, 0) good = True for i, dbg_obj in enumerate(self.dbg.bp_list): @@ -359,17 +356,11 @@ class DebugCmd(cmd.Cmd, object): args = arg.split(" ") if len(args) >= 2: - if "0x" in args[1]: - size = int(args[1], 16) - else: - size = int(args[1]) + size = int(args[1], 0) else: size = 0xF - if "0x" in args[0]: - addr = int(args[0], 16) - else: - addr = int(args[0]) + addr = int(args[0], 0) self.dbg.watch_mem(addr, size) @@ -445,16 +436,10 @@ class DebugCmd(cmd.Cmd, object): else: args = arg.split(" ") if len(args) >= 2: - if "0x" in args[1]: - size = int(args[1], 16) - else: - size = int(args[1]) + size = int(args[1], 0) else: size = 0xF - if "0x" in args[0]: - addr = int(args[0], 16) - else: - addr = int(args[0]) + addr = int(args[0], 0) self.dbg.get_mem(addr, size) 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) |