Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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))
m.add_hook(apis['StreamString'], hook(hook_StreamString))
def main():
args = DeepManticore.parse_args()
consts.procs = args.num_workers
consts.timeout = args.timeout
consts.mprocessing = consts.mprocessing.single
try:
m = manticore.native.Manticore(args.binary)
except Exception as e:
L.critical("Cannot create Manticore instance on binary {}: {}".format(
args.binary, e))
return 1
log.set_verbosity(args.verbosity)
if args.take_over:
return main_takeover(m, args, 'DeepState_TakeOver')
elif args.klee:
return main_takeover(m, args, 'main')
else:
return main_unit_test(m, args)