forked from omgneeq/ps3utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find_syscall.c
54 lines (48 loc) · 1.26 KB
/
find_syscall.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
FILE *in = NULL;
char *buf;
int i;
int ret;
if (argc != 2) {
printf ("Usage : %s dump.bin\n", argv[0]);
return -1;
}
in = fopen (argv[1], "rb");
if (in == NULL) {
perror ("Could not open input file ");
return -1;
}
buf = malloc (8*1024*1024);
ret = fread(buf, 1, 8*1024*1024, in);
printf ("Read %d bytes\n", ret);
for (i = 0; i < ret; i+=8) {
uint64_t *syscall_table = (uint64_t *)(buf + i);
uint64_t sc0 = syscall_table[0];
if (syscall_table[1] != sc0 &&
syscall_table[2] != sc0 &&
syscall_table[3] != sc0 &&
syscall_table[14] != sc0 &&
syscall_table[15] == sc0 &&
syscall_table[16] == sc0 &&
syscall_table[17] == sc0 &&
syscall_table[18] != sc0 &&
syscall_table[19] != sc0 &&
syscall_table[20] == sc0 &&
syscall_table[21] != sc0 &&
syscall_table[31] != sc0 &&
syscall_table[32] == sc0 &&
syscall_table[33] == sc0 &&
syscall_table[41] != sc0 &&
syscall_table[42] == sc0 &&
syscall_table[43] != sc0) {
printf ("Syscall table found at 0x%X\n", i);
}
}
fclose (in);
free (buf);
return 0;
}