forked from springhack/alxw_judge_core_src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bde06ad
Showing
12 changed files
with
2,836 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 @@ | ||
runner |
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,2 @@ | ||
all: | ||
gcc src/main.c src/cjson/cJSON.c -lm -o runner |
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,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) |
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,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; | ||
} |
Oops, something went wrong.