diff --git a/lab7/sol.py b/lab7/sol.py index e69de29b..f6742508 100644 --- a/lab7/sol.py +++ b/lab7/sol.py @@ -0,0 +1,18 @@ +import angr, sys + + +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()) + +proj = angr.Project('./login') +init_state =proj.factory.entry_state() +simulation =proj.factory.simgr(init_state) + +simulation.explore(find=success_condition, avoid=fail_condition) + +solution = simulation.found[0] + +print(solution.posix.dumps(sys.stdin.fileno()))