-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpStorm.py
87 lines (67 loc) · 2.11 KB
/
expStorm.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import os
import sys
import threading
import time
import traceback
try:
import pocsuite3
except ImportError:
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
from pocsuite3.lib.core.option import init
from pocsuite3.lib.core.option import init_options
from pocsuite3.lib.core.exception import PocsuiteUserQuitException, PocsuiteSystemException
from pocsuite3.lib.core.exception import PocsuiteShellQuitException
from pocsuite3.lib.core.common import set_paths
from pocsuite3.lib.core.common import banner
from pocsuite3.lib.core.common import data_to_stdout
from pocsuite3.lib.core.data import logger
from pocsuite3.lib.parse.cmd import cmd_line_parser
from pocsuite3.lib.controller.controller import start
def module_path():
"""
This will get us the program's directory
"""
return os.path.dirname(os.path.realpath(__file__))
def check_environment():
try:
os.path.isdir(module_path())
except Exception:
err_msg = "your system does not properly handle non-ASCII paths. "
err_msg += "Please move the pocsuite's directory to the other location"
logger.critical(err_msg)
raise SystemExit
def main():
"""
@function Main function of pocsuite when running from command line.
"""
try:
check_environment()
set_paths(module_path())
banner()
init_options(cmd_line_parser().__dict__)
data_to_stdout("[*] starting at {0}\n\n".format(time.strftime("%X")))
init()
try:
start()
except threading.ThreadError:
raise
except PocsuiteUserQuitException:
pass
except PocsuiteShellQuitException:
pass
except PocsuiteSystemException:
pass
except KeyboardInterrupt:
pass
except EOFError:
pass
except SystemExit:
pass
except Exception:
exc_msg = traceback.format_exc()
data_to_stdout(exc_msg)
raise SystemExit
finally:
data_to_stdout("\n[*] shutting down at {0}\n\n".format(time.strftime("%X")))
if __name__ == "__main__":
main()