REVEN-Axion User Documentation 2015-v1
controlling_runs.py

Here is a small example demonstrating how to plug an inspector, add start an execution, pause, and test the current progress.

Here are the involved services:

import reven
import time
rvn = reven.reven_connection("localhost", 13370)
if len(rvn.run_get_all()) > 0:
sys.stderr.write("[!] An analysis has already been done. Let's not start a new one.\n")
sys.exit(1)
# Here is a list of inspectors that you can plug into Reven.
print reven.inspector_list
# Let's see what arguments are available in the stop_execution inspector:
for arg in reven.inspector_list["stop_execution"].arguments:
print arg
# stop_at_top_level = False, symbol='Malloc', sequence_number=0 (unlimited)
stopper = reven.stop_execution(False, "malloc", 0)
rvn.engine_plug_inspector(stopper)
# Launch the execution from the scenario start
rvn.engine_start_execution()
# At this point, the execution is running in background
# Let's wait up to 10 seconds, or until we reach malloc.
max = 10
progress = rvn.engine_get_progress()
while progress.busy and max > 0:
print "Analyzing %s" % progress.text
time.sleep(1)
progress = rvn.engine_get_progress()
max -= 1
if max < 0 and progress.busy:
# In this case, this means malloc was still not reached after 10 seconds of analysis.
rvn.engine_pause_execution()
# do some stuff with Reven
rvn.engine_resume_execution()
# Wait again that Reven finishes some work, etc