-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutil.py
More file actions
41 lines (32 loc) · 963 Bytes
/
util.py
File metadata and controls
41 lines (32 loc) · 963 Bytes
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/python3
# -*- coding: utf-8 -*-
# util 脚本执行处,避免python包导入的问题
import getopt
import sys
from utils import privilege_escalation, init
FUN_DICT = {
"PE": privilege_escalation,
"privilege_escalation": privilege_escalation,
"INI": init,
"init": init
}
def fun_name():
return ", ".join(key for key in FUN_DICT.keys())
def fun_choose(opts_list):
try:
for [(o, a)] in opts_list:
if o in ("-f", "--fun"):
fun = FUN_DICT.get(a)
if not fun:
print("Wrong function name!")
print(fun_name(), "can be chosen!")
return
fun()
return
except Exception:
print("-f or --fun= is necessary!")
else:
print("-f or --fun= is necessary!")
if __name__ == "__main__":
opts_list = getopt.getopt(sys.argv[1:], "f:", ["fun="])
fun_choose(opts_list)