Skip to content

Instantly share code, notes, and snippets.

@dtouch3d
Created October 13, 2016 21:50
Show Gist options
  • Save dtouch3d/7e2dbadc03c482b6f7bddae58d6c40de to your computer and use it in GitHub Desktop.
Save dtouch3d/7e2dbadc03c482b6f7bddae58d6c40de to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import angr
p = angr.Project(sys.argv[1], load_options={'auto_load_libs': False})
s = p.factory.entry_state()
def malloc_print(state):
print("Called malloc!")
def free_print(state):
print("Called Free!")
p.hook_symbol('free', free_print)
p.hook_symbol('malloc', malloc_print)
pg = p.factory.path_group(s)
pg.explore()
/* compiled with gcc -o test test.c */
#include <stdlib.h>
int main(void)
{
int* ptr = malloc(1024);
free(ptr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment