forked from gmhzxy/w9scan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
w9scan.py
73 lines (62 loc) · 2.15 KB
/
w9scan.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: w8ay
# @Date: 2017年12月17日 19:21:35
import sys
sys.dont_write_bytecode = True # 不生成pyc文件
from lib.core.common import weAreFrozen
from lib.core.common import getUnicode
from lib.core.common import setPaths
from lib.core.common import banner
from lib.core.log import logger
import os
import inspect
from distutils.version import LooseVersion
from lib.core.settings import VERSION
from lib.core.data import cmdLineOptions
from lib.core.exploit import Exploit_run
def modulePath():
"""
This will get us the program's directory, even if we are frozen
using py2exe
"""
try:
_ = sys.executable if weAreFrozen() else __file__
except NameError:
_ = inspect.getsourcefile(modulePath)
return getUnicode(os.path.dirname(os.path.realpath(_)), encoding=sys.getfilesystemencoding())
def checkEnvironment():
try:
os.path.isdir(modulePath())
except UnicodeEncodeError:
errMsg = "your system does not properly handle non-ASCII paths. "
errMsg += "Please move the w9scan's directory to the other location"
logger.critical(errMsg)
raise SystemExit
if LooseVersion(VERSION) < LooseVersion("1.0"):
errMsg = "your runtime environment (e.g. PYTHONPATH) is "
errMsg += "broken. Please make sure that you are not running "
errMsg += "newer versions of w9scan with runtime scripts for older "
errMsg += "versions"
logger.critical(errMsg)
raise SystemExit
def main():
"""
Main function of w9scan when running from command line.
"""
try:
checkEnvironment() # 检测环境
setPaths(modulePath()) # 为一些目录和文件设置了绝对路径
banner()
Test_Url = raw_input('Input url > ')
Test_Url = Test_Url.strip()
#Test_Url = "https://blog.hacking8.com/"
e = Exploit_run(Test_Url)
print '[***] ScanStart Target:%s' % Test_Url
e.load_modules("www",Test_Url)
logger.report()
except KeyboardInterrupt:
logger.critical("[***] UserInterrupt")
exit()
if __name__ == '__main__':
main()