diff --git a/lab7/sol.py b/lab7/sol.py index e69de29b..a2549f85 100644 --- a/lab7/sol.py +++ b/lab7/sol.py @@ -0,0 +1,17 @@ +import angr,sys +project = angr.Project('./login') +init_state = project.factory.entry_state() +simulation = project.factory.simgr(init_state) + +def success_condition(state): + return b"Login successful" in state.posix.dumps(sys.stdout.fileno()) + +def fail_condition(state): + return b"Login failed" in state.posix.dumps(sys.stdout.fileno()) + +simulation.explore(find=success_condition, avoid=fail_condition) + +solution_state = simulation.found[0] + +print (solution_state.posix.dumps(sys.stdin.fileno())) +