-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #603 from patty5531998/lab7
[LAB7] 311552005
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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())) |