How to use the manticore.native function in manticore

To help you get started, we’ve selected a few manticore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trailofbits / deepstate / bin / deepstate / main_manticore.py View on Github external
def do_run_test(state, apis, test, hook_test=False):
  """Run an individual test case."""
  state.cpu.PC = test.ea
  m = manticore.native.Manticore(state, sys.argv[1:])
  #m = MainThreadWrapper(m, _CONTROLLER)
  m.verbosity(1)

  state = m.initial_state
  mc = DeepManticore(state)

  # Tell the system that we're using symbolic execution.
  mc.write_uint32_t(apis["UsingSymExec"], 8589934591)

  mc.begin_test(test)
  del mc

  m.add_hook(apis['IsSymbolicUInt'], hook(hook_IsSymbolicUInt))
  m.add_hook(apis['ConcretizeData'], hook(hook_ConcretizeData))
  m.add_hook(apis['ConcretizeCStr'], hook(hook_ConcretizeCStr))
  m.add_hook(apis['MinUInt'], hook(hook_MinUInt))
github trailofbits / deepstate / bin / deepstate / executors / symex / manticore.py View on Github external
"""Run an individual test case."""
  state.cpu.PC = test.ea

  mc = DeepManticore(state)
  mc.context['apis'] = apis

  # Tell the system that we're using symbolic execution.
  mc.write_uint32_t(apis["UsingSymExec"], 8589934591)

  mc.begin_test(test)

  del mc

  # NOTE(alan): cannot init State with new native.Manticore in 0.3.0 as it
  # will try to delete the non-existent stored state from new workspace
  m = manticore.native.Manticore(state, sys.argv[1:], workspace_url=workspace)
  log.set_verbosity(1)

  m.add_hook(apis['IsSymbolicUInt'], hook(hook_IsSymbolicUInt))
  m.add_hook(apis['ConcretizeData'], hook(hook_ConcretizeData))
  m.add_hook(apis['ConcretizeCStr'], hook(hook_ConcretizeCStr))
  m.add_hook(apis['MinUInt'], hook(hook_MinUInt))
  m.add_hook(apis['MaxUInt'], hook(hook_MaxUInt))
  m.add_hook(apis['Assume'], hook(hook_Assume))
  m.add_hook(apis['Pass'], hook(hook_Pass))
  m.add_hook(apis['Crash'], hook(hook_Crash))
  m.add_hook(apis['Fail'], hook(hook_Fail))
  m.add_hook(apis['SoftFail'], hook(hook_SoftFail))
  m.add_hook(apis['Abandon'], hook(hook_Abandon))
  m.add_hook(apis['Log'], hook(hook_Log))
  m.add_hook(apis['StreamInt'], hook(hook_StreamInt))
  m.add_hook(apis['StreamFloat'], hook(hook_StreamFloat))