Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
springhack committed Nov 24, 2016
0 parents commit bde06ad
Show file tree
Hide file tree
Showing 12 changed files with 2,836 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runner
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all:
gcc src/main.c src/cjson/cJSON.c -lm -o runner
8 changes: 8 additions & 0 deletions calls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python
import re

with open('/usr/include/asm/unistd_64.h') as f:
defs = re.findall(r'#define __NR_(\w+)\s+(\d+)', f.read())

for name, num in defs:
print(name, num)
19 changes: 19 additions & 0 deletions src/access.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <sys/user.h>
#include <sys/syscall.h>
#include <sys/ptrace.h>
#include <fcntl.h>
#include <string.h>

int checkAccess(int pid, struct user_regs_struct *regs) {
if (!calls[REG_SYS_CALL(regs)])
{
printf("Illegal syscall: %d\n", REG_SYS_CALL(regs));
return ACCESS_CALL_ERR;
}
if (REG_SYS_CALL(regs) == SYS_open)
{
printf("Try to open file!\n");
return ACCESS_FILE_ERR;
}
return ACCESS_OK;
}
Loading

0 comments on commit bde06ad

Please sign in to comment.