Created
June 23, 2017 05:32
-
-
Save Agnishom/3bf47dd714e9a0ac502752b82d492391 to your computer and use it in GitHub Desktop.
Logging System Calls along Unique Execution Paths
This file contains hidden or 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
| import angr | |
| import strace | |
| import subprocess | |
| def getSysCalls(command): | |
| p = angr.Project(command) | |
| pg = p.factory.path_group() | |
| while len(pg.active) > 0: | |
| deadNow = len(pg.deadended) | |
| pg.step() | |
| if len(pg.deadended) > deadNow: | |
| path = pg.deadended[-1] | |
| testCase = path.state.posix.dumps(0) | |
| process = subprocess.Popen(["strace", "-ttt", "-o", "worktmp.out", str(command)], stdin=subprocess.PIPE) | |
| process.communicate(testCase) | |
| with open("worktmp.out") as f: | |
| yield strace.StraceInputStream(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment