mirror of
https://github.com/cea-sec/miasm
synced 2026-08-17 10:26:03 -04:00
Replace jitter.run boolean by jitter.running
This commit is contained in:
parent
acfb6e552b
commit
e0abd462ce
21 changed files with 28 additions and 28 deletions
|
|
@ -223,7 +223,7 @@ Create a sentinelle to catch the return of the shellcode:
|
|||
|
||||
```Python
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
jitter.pc = 0
|
||||
return True
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ parser.add_argument("addr",
|
|||
machine = Machine("mips32l")
|
||||
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
jitter.pc = 0
|
||||
return True
|
||||
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@ log_func.setLevel(logging.ERROR)
|
|||
# Run
|
||||
sb.run()
|
||||
|
||||
assert(sb.jitter.run is False)
|
||||
assert(sb.jitter.running is False)
|
||||
|
|
|
|||
|
|
@ -15,4 +15,4 @@ sb = Sandbox_Win_x86_32(loc_db, options.filename, options, globals())
|
|||
# Run
|
||||
sb.run()
|
||||
|
||||
assert(sb.jitter.run is False)
|
||||
assert(sb.jitter.running is False)
|
||||
|
|
|
|||
|
|
@ -16,4 +16,4 @@ sb = Sandbox_Win_x86_64(loc_db, options.filename, options, globals())
|
|||
# Run
|
||||
sb.run()
|
||||
|
||||
assert(sb.jitter.run is False)
|
||||
assert(sb.jitter.running is False)
|
||||
|
|
|
|||
|
|
@ -59,4 +59,4 @@ sb.jitter.add_breakpoint(win_api_x86_32_seh.return_from_exception, return_from_s
|
|||
# Run
|
||||
sb.run()
|
||||
|
||||
assert(sb.jitter.run is False)
|
||||
assert(sb.jitter.running is False)
|
||||
|
|
|
|||
|
|
@ -58,5 +58,5 @@ start_time = time.time()
|
|||
sb.run()
|
||||
stop_time = time.time()
|
||||
|
||||
assert sb.jitter.run is False
|
||||
assert sb.jitter.running is False
|
||||
print("Instr speed: %02.f / sec" % (instr_count / (stop_time - start_time)))
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ def stop(jitter):
|
|||
logging.info('OEP reached')
|
||||
|
||||
# Stop execution
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
return False
|
||||
|
||||
# Set callbacks
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ parser.add_argument("-j", "--jitter",
|
|||
args = parser.parse_args()
|
||||
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
jitter.pc = 0
|
||||
return True
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ SYSCALL = {
|
|||
|
||||
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
jitter.pc = 0
|
||||
return True
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ jitter.push_uint32_t(0)
|
|||
|
||||
# Handle return
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
return False
|
||||
|
||||
ret_addr = 0x1337beef
|
||||
|
|
@ -108,7 +108,7 @@ while todo:
|
|||
# Restore state, while keeping already found solutions
|
||||
dse.restore_snapshot(snapshot, keep_known_solutions=True)
|
||||
|
||||
# Reinit jitter (reset jitter.run, etc.)
|
||||
# Reinit jitter (reset jitter.running, etc.)
|
||||
jitter.init_run(run_addr)
|
||||
|
||||
# Set the argument value in the jitter context
|
||||
|
|
@ -140,4 +140,3 @@ print(
|
|||
len(reaches)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Sandbox(object):
|
|||
|
||||
@staticmethod
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -212,6 +212,7 @@ class Jitter(object):
|
|||
self.arch = lifter.arch
|
||||
self.attrib = lifter.attrib
|
||||
arch_name = lifter.arch.name # (lifter.arch.name, lifter.attrib)
|
||||
self.running = False
|
||||
|
||||
try:
|
||||
if arch_name == "x86":
|
||||
|
|
@ -418,7 +419,7 @@ class Jitter(object):
|
|||
"""
|
||||
self.run_iterator = self.runiter_once(pc)
|
||||
self.pc = pc
|
||||
self.run = True
|
||||
self.running = True
|
||||
|
||||
def continue_run(self, step=False, trace=False):
|
||||
"""PRE: init_run.
|
||||
|
|
@ -430,7 +431,7 @@ class Jitter(object):
|
|||
|
||||
if trace:
|
||||
self.set_trace_log()
|
||||
while self.run:
|
||||
while self.running:
|
||||
try:
|
||||
return next(self.run_iterator)
|
||||
except StopIteration:
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ def sys_generic_exit_group(jitter, linux_env):
|
|||
|
||||
# Stub
|
||||
log.debug("Exit with status code %d", status)
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
|
||||
|
||||
def sys_generic_read(jitter, linux_env):
|
||||
|
|
|
|||
|
|
@ -141,4 +141,4 @@ sb.jitter.vm.add_memory_page(0x7fff0000 + 0x14, PAGE_READ | PAGE_WRITE, b"AAAA")
|
|||
# Run
|
||||
sb.run(addr)
|
||||
|
||||
assert(sb.jitter.run is False)
|
||||
assert(sb.jitter.running is False)
|
||||
|
|
|
|||
|
|
@ -137,4 +137,4 @@ sb.jitter.vm.add_memory_page(0x7fff0000 + 0x28, PAGE_READ | PAGE_WRITE, b"AAAAAA
|
|||
# Run
|
||||
sb.run(addr)
|
||||
|
||||
assert(sb.jitter.run is False)
|
||||
assert(sb.jitter.running is False)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from miasm.analysis.machine import Machine
|
|||
from miasm.core.locationdb import LocationDB
|
||||
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
jitter.pc = 0
|
||||
return True
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ run_addr = 0x40000000
|
|||
loc_db = LocationDB()
|
||||
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
jitter.pc = 0
|
||||
return True
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ myjit = init_jitter(loc_db)
|
|||
myjit.init_run(run_addr)
|
||||
myjit.continue_run()
|
||||
|
||||
assert myjit.run is False
|
||||
assert myjit.running is False
|
||||
assert myjit.cpu.EAX == 0x0
|
||||
|
||||
## Let's specify a max_exec_per_call
|
||||
|
|
@ -74,7 +74,7 @@ myjit.init_run(run_addr)
|
|||
myjit.exec_cb = cb
|
||||
myjit.continue_run()
|
||||
|
||||
assert myjit.run is True
|
||||
assert myjit.running is True
|
||||
# Use a '>=' because it's a 'max_...'
|
||||
assert myjit.cpu.EAX >= 0xA
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ myjit.init_run(run_addr)
|
|||
myjit.exec_cb = cb
|
||||
myjit.continue_run()
|
||||
|
||||
assert myjit.run is False
|
||||
assert myjit.running is False
|
||||
assert myjit.cpu.EAX == 0x00
|
||||
## main(2) + (loop_main(3))*(0x10) + loop_end(1) + 0x1337beef (1)
|
||||
assert counter == 52
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ myjit.vm.add_memory_page(run_addr, PAGE_READ | PAGE_WRITE, data)
|
|||
|
||||
# Sentinelle called on terminate
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
jitter.pc = 0
|
||||
return True
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ myjit.init_run(run_addr)
|
|||
myjit.continue_run()
|
||||
|
||||
# Check end
|
||||
assert myjit.run is False
|
||||
assert myjit.running is False
|
||||
|
||||
# Check resulting state / accessors
|
||||
assert myjit.cpu.EAX == 0
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from miasm.core.locationdb import LocationDB
|
|||
|
||||
|
||||
def code_sentinelle(jitter):
|
||||
jitter.run = False
|
||||
jitter.running = False
|
||||
jitter.pc = 0
|
||||
return True
|
||||
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@ sb = sandbox(loc_db, options.filename, options, globals())
|
|||
# Run
|
||||
sb.run()
|
||||
|
||||
assert(sb.jitter.run is False)
|
||||
assert(sb.jitter.running is False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue