Skip to content

Commit 15338a4

Browse files
authored
Create get_fun.py
This is used to extract functions list for a specific file, can be used during fuzzing.
1 parent ca2a9ed commit 15338a4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

get_fun.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import re
2+
3+
def extract_functions(file_content):
4+
5+
function_pattern = re.compile(r'^\s*\w+\s+\*?(\w+)\s*\([^)]*\)\s*\{', re.MULTILINE)
6+
7+
matches = function_pattern.findall(file_content)
8+
return matches
9+
10+
file_path = 'path_to_your_source_file.c' # File path goes here
11+
with open(file_path, 'r') as file:
12+
content = file.read()
13+
14+
function_list = extract_functions(content)
15+
for function in function_list:
16+
print(f'fun: {function}')

0 commit comments

Comments
 (0)