File tree Expand file tree Collapse file tree 2 files changed +515
-18
lines changed Expand file tree Collapse file tree 2 files changed +515
-18
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ #
3
+ # Cross Platform and Multi Architecture Advanced Binary Emulation Framework
4
+ # Built on top of Unicorn emulator (www.unicorn-engine.org)
5
+ # The 'freebsd_syscall' can be download at 'https://github.com/freebsd/freebsd/blob/master/sys/kern/syscalls.master'.
6
+
7
+ import re
8
+
9
+ def is_number (s ):
10
+ try :
11
+ float (s )
12
+ return True
13
+ except ValueError :
14
+ pass
15
+
16
+ try :
17
+ import unicodedata
18
+ unicodedata .numeric (s )
19
+ return True
20
+ except (TypeError , ValueError ):
21
+ pass
22
+
23
+ return False
24
+
25
+ def read_file (f ):
26
+ line = f .readline ()
27
+ while line :
28
+ if is_number (line [0 ]):
29
+ index = re .findall (r"\d+\.?\d*" , line )
30
+ line = f .readline ()
31
+ if not is_number (line [0 ]) and line [0 ] != ';' :
32
+ name = line .split ('(' )[0 ]
33
+ name = name .split (' ' )[- 1 ]
34
+ # print(index[0], name)
35
+ if name != '\n ' :
36
+ print (" \" " + name + "\" : (" + index [0 ]+ ")," )
37
+ else :
38
+ continue
39
+ line = f .readline ()
40
+
41
+ if __name__ == '__main__' :
42
+ file = open ('./freebsd_syscall' )
43
+ read_file (file )
You can’t perform that action at this time.
0 commit comments