Skip to content

Instantly share code, notes, and snippets.

@Agnishom
Created June 23, 2017 05:32
Show Gist options
  • Select an option

  • Save Agnishom/3bf47dd714e9a0ac502752b82d492391 to your computer and use it in GitHub Desktop.

Select an option

Save Agnishom/3bf47dd714e9a0ac502752b82d492391 to your computer and use it in GitHub Desktop.
Logging System Calls along Unique Execution Paths
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