-
Notifications
You must be signed in to change notification settings - Fork 0
/
pbrExtractor.py
41 lines (28 loc) · 878 Bytes
/
pbrExtractor.py
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
#!/usr/bin/env python3
import importlib
import os
def trace(func):
def wrapper(*args, **kwargs):
print(f'TRACE: calling {func.__name__}() with {args}, {kwargs}')
original_result = func(*args, **kwargs)
print(f'TRACE: {func.__name__}() returned {original_result}')
return original_result
return wrapper
@trace
def get_plugin_names():
file_list = []
for files in os.listdir("plugins"):
if files.endswith(".py") and not files.endswith("__.py"):
file_list.append(files)
return file_list
def import_plugin():
for file in get_plugin_names():
print(f"[+] Running {file}...")
plugin_module = importlib.import_module("plugins." + file[:-3])
plugin = plugin_module.Plugin()
plugin.main()
# @trace
def main():
import_plugin()
if __name__ == "__main__":
main()