-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyexp.py
63 lines (50 loc) · 1.52 KB
/
pyexp.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
#!/usr/bin/env python
"""
Copyright (c) 2016 seviezhou (http://pwdme.cc/)
"""
import sys
import os
import time
from lib.core.data import logger
from lib.core.common import dataToStdout
try:
from lib.core.data import conf
from lib.core.data import cmdLineOptions
from lib.core.data import paths
from lib.core.option import initOptions
from lib.core.option import init
from lib.core.common import banner
from lib.core.common import setPaths
from lib.parse.cmdline import cmdLineParser
from lib.controller.controller import run
from lib.core.expection import PyExpSyntaxException
from lib.core.expection import PyExpSystemException
except KeyboardInterrupt:
errMsg = "Be aborted by user"
logger.error(errMsg)
def rootPath():
_ = __file__
return os.path.dirname(os.path.realpath(_))
def setEnvironment():
paths.PYEXP_ROOT_PATH = rootPath()
def main():
try:
setEnvironment()
setPaths()
banner()
cmdLineOptions.update(cmdLineParser().__dict__)
initOptions(cmdLineOptions)
init()
run()
except PyExpSyntaxException as ex:
logger.error(ex)
msg = "\n[*] Pyexp is shutting down at %s.\n\n" % time.strftime("%H:%M:%S")
dataToStdout(msg)
raise SystemExit
except PyExpSystemException as ex:
logger.critical(ex)
msg = "\n[*] Pyexp is shutting down at %s.\n\n" % time.strftime("%H:%M:%S")
dataToStdout(msg)
raise SystemExit
if __name__ == "__main__":
main()