Acunetix Web Vulnerability Scanner Python辅助脚本
WvsScannerQueue.py
Version: Python 2.7.*
Acunetix Web Vulnerability Scanner 辅助Python脚本的第一个版本。
功能:
扫描URL.TXT文件中所有URL
扫描完成一个URL后立即过滤报告,并且提权漏洞标题发送给自己
存在的问题:
扫描一些网站很慢
毕竟这个就是调用Acunetix Web Vulnerability Scanner 的Console端直接进行扫描的
有时候扫描个网站好几天,没有写相应的方法去取消,以后看写不写
有时候自己在外面,扫到了严重漏洞就可直接回去Duang~
源码地址:
https://github.com/yanyueoo7/WvsScannerQueue
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Author:Tea
#date 2014/06/25
#The WVS Scanner Report Auxiliary Tool import os
import sys
import time
import Queue
import smtplib
import threading
import subprocess
from xml.dom import minidom #解析XML模块
from email.mime.text import MIMEText #发送邮件模块 mailto_list = ['mailqq@qq.com'] #收件人
mail_host = "smtp.126.com"
mail_user = "mail126" #发件帐号
mail_pass = "mail126123" #发件密码
mail_postfix = "126.com" #读取文件内容取出URL,并且去重
def read_url(filepath):
tmpfileurl = []
filecontent = open(filepath)
for url in filecontent:
if url.__len__() > 4:
tmpfileurl.append(url.replace('\n', ''))
filecontent.close()
fileurl = {}.fromkeys(tmpfileurl).keys()
return fileurl #调用扫描函数后判断结果
def call_wvsscan_result(url):
Rcode = start_wvsscanner(url)
check_result_load(Rcode) #扫描结果进行读取,并且发送邮件,这里还可以写简洁
def check_result_load(Rcode):
(RRcode, Mtag, RRdir) = Rcode.split('|')
MTitle = 'WvsScanner Report--' + Mtag
RRdir += '\\export.xml'
if int(RRcode) == 3:
MResult = '\n'.join(laod_xml_report(RRdir))
send_mail(mailto_list, MTitle, MResult)
elif int(RRcode) == 2:
MResult = '\n'.join(laod_xml_report(RRdir))
send_mail(mailto_list, MTitle, MResult)
elif int(RRcode) == 1:
MResult = '\n'.join(laod_xml_report(RRdir))
send_mail(mailto_list, MTitle, MResult)
else:
print 'Info' #调用软件进行扫描操作
def start_wvsscanner(url):
wvs = 'D:\Software\Web Vulnerability Scanner 9.5\wvs_console.exe' #定义的WVS_CONSLEL路径
Time = time.strftime('%Y-%m-%d', time.localtime(time.time()))
savefolder = 'D:\\Log\\Wvs\\' + Time + '\\' + httpreplace(url) #定义扫描以后的LOG结果
if os.path.lexists(savefolder) is False:
os.makedirs(savefolder)
wvscommand = wvs + ' /Scan ' + url + ' /Profile default /Save /SaveFolder ' + savefolder \
+ ' /exportxml --UseAcuSensor=FALSE --ScanningMode=Heuristic'
print wvscommand
doscan = subprocess.call(wvscommand)
retresult = str(doscan) + '|' + url + '|' + savefolder
return retresult #替换掉URL的http://字符跟特殊字符,为的是创建日志保存目录没得非法字符
def httpreplace(httpstr):
return httpstr.replace('https://', '').replace('http://', '').replace('/', '').replace(':', '-') #解析XML报告文件,提取漏洞标题
def laod_xml_report(xmlname):
Result = []
HeadInfo = []
tmpResult = []
ResultContact = {'red': 'High', 'orange': 'Medium', 'blue': 'Low', 'green': 'Info'}
dom = minidom.parse(xmlname)
count = dom.getElementsByTagName('ReportItem')
HeadInfo.append(dom.getElementsByTagName("StartURL")[0])
HeadInfo.append(dom.getElementsByTagName("StartTime")[0])
HeadInfo.append(dom.getElementsByTagName("FinishTime")[0])
HeadInfo.append(dom.getElementsByTagName("ScanTime")[0])
for i in HeadInfo:
for n in i.childNodes:
Result.append(n.nodeValue)
for i in xrange(len(count)):
color = dom.getElementsByTagName('ReportItem')[i].getAttribute('color')
ReportItem = dom.getElementsByTagName("ReportItem")[i]
Name = ReportItem.getElementsByTagName("Name")[0]
if color in ResultContact:
colorResult = ResultContact[color] + '\t'
else:
colorResult = 'Other\t'
for textNode in Name.childNodes:
tmpResult.append(colorResult + textNode.nodeValue)
Result2 = {}.fromkeys(tmpResult).keys()
Result2 = sortresultlist(Result2)
Result.append('Vulnerable Count:' + str(len(Result2)))
for n in xrange(len(Result2)):
Result.append(Result2[n])
return Result #将扫描结果进行排序,这太渣了
def sortresultlist(List):
Result = []
for i in List:
if i.startswith('High'):
Result.append(i)
for i in List:
if i.startswith('Medium'):
Result.append(i)
for i in List:
if i.startswith('Low'):
Result.append(i)
for i in List:
if i.startswith('Info'):
Result.append(i)
for i in List:
if i.startswith('Other'):
Result.append(i)
return Result #发送通知邮件
def send_mail(to_list, sub, content):
me = "WvsScanner<" + mail_user + "@" + mail_postfix + ">"
msg = MIMEText(content, _subtype='plain', _charset='utf-8')
msg['Subject'] = sub
msg['From'] = me
msg['To'] = ";".join(to_list)
try:
server = smtplib.SMTP()
server.connect(mail_host)
server.login(mail_user, mail_pass)
server.sendmail(me, to_list, msg.as_string())
server.close()
return True
except Exception, e:
catchwrite(str(e))
return False #异常写入文件记录
def catchwrite(errcode):
filestr = "mailerror.txt"
errtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
errfile = open(filestr, 'a')
errfile.write(errtime + '\t' + errcode + '\n')
errfile.close() class ScanManager(object):
def __init__(self, work_num=100, thread_num=5, res_list=[]):
self.work_queue = Queue.Queue()
self.threads = []
self.work_list = res_list
print work_num
self.__init_work_queue(work_num)
self.__init_thread_pool(thread_num) def __init_thread_pool(self, thread_num):
for i in xrange(thread_num):
self.threads.append(ScanWork(self.work_queue)) def __init_work_queue(self, jobs_num):
for i in xrange(jobs_num):
self.add_job(do_job, self.work_list[i]) def add_job(self, func, *args):
self.work_queue.put((func, list(args))) def wait_allcomplete(self):
for item in self.threads:
if item.isAlive():
item.join() class ScanWork(threading.Thread):
def __init__(self, work_queue):
threading.Thread.__init__(self)
self.work_queue = work_queue
self.start() def run(self):
while True:
try:
do, args = self.work_queue.get(block=False)
do(args)
self.work_queue.task_done()
except:
break #将Url推进去开始扫描
def do_job(args):
for i in args:
call_wvsscan_result(i) def main():
if len(sys.argv) != 2:
print "Usage: %s D:\\Url.txt" % sys.argv[0]
print "WvsScanner Auxiliary Tool"
return
filestr = sys.argv[1]
Result = read_url(filestr)
thread_count = 6 #这里不能超过10,WIN下最多打开10个wvs_consoe进行扫描
start_time = time.time()
do_count = len(Result)
work_manager = ScanManager(do_count, thread_count, Result)
work_manager.wait_allcomplete()
end_time = time.time()
print "Complete Time:%s" % (end_time-start_time) if __name__ == '__main__':
main()
Acunetix Web Vulnerability Scanner Python辅助脚本的更多相关文章
- Acunetix Web Vulnerability Scanner abbr. AWVS
awvs 中文手册详细版 - 木讷 - 博客园https://www.cnblogs.com/iamver/p/7124718.html Download Acunetix Trialhttps:// ...
- Acunetix Web Vulnerability Scanner(WVS)(Acunetix网络漏洞扫描器)
Acunetix网络漏洞扫描软件检测您网络的安全性安全测试工具Acunetix Web Vulnerability Scanner(WVS) (Acunetix网络漏洞扫描器)技术 网络应用安全扫描技 ...
- AWVS11使用教程——Acunetix Web Vulnerability Scanner 11.x
AWVS11使用教程 一:普通扫描. 二:报告生成. 三:登陆扫描. Acunetix Web Vulnerability Scanner(简称AWVS)是一款知名的网络漏洞扫描工具,它通过网络爬虫测 ...
- Acunetix Web Vulnerability Scanner使用和生成报告的方法
Acunetix WVS,该扫描软件的全称Acunetix Web Vulnerability Scanner,是一个网站及服务器漏洞扫描软件.它可以检查Web应用程序中的漏洞,如SQL注入.跨站脚本 ...
- 【汉化】Acunetix Web Vulnerability Scanner 11.x汉化包
破解补丁::http://www.52pojie.cn/thread-609275-1-1.html 汉化界面截图: 登陆界面 仪表盘 目标 漏洞 扫描 用户配置 汉化详情: 1.对UI界面大部分 ...
- AWVS (Acunetix Web Vulnerability Scanner )
1.AWVS 是国外一款不错的安全测试工具 ,界面清楚,使用方便.可以爬取网页加载payload测试存在的安全问题 破解版的下载地址: https://www.arvinhk.c ...
- Acunetix Web Vulnarability Scanner V10.5 详细中文手册
目录: 0×00.什么是Acunetix Web Vulnarability Scanner ( What is AWVS?) 0×01.AWVS安装过程.主要文件介绍.界面简介.主要操作区域简介(I ...
- Python Ethical Hacking - VULNERABILITY SCANNER(7)
VULNERABILITY_SCANNER How to discover a vulnerability in a web application? 1. Go into every possibl ...
- Python Ethical Hacking - VULNERABILITY SCANNER(2)
VULNERABILITY_SCANNER How to discover a vulnerability in a web application? 1. Go into every possibl ...
随机推荐
- sql server2008 搭建链接服务器成功后查询时报Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI10" for linked server "XXXXX". 的解决方法
这是由于链接的数据库服务器的版本与本地数据库服务器不一致,有人说要升到sp3,sp4,然后在执行什么语句之类的 我觉得太繁琐了,通过网上查询之后看到可以这么做: USE master GRANT EX ...
- QQ群成员提取
var ids = document.querySelectorAll(".member_id"); var names = document.querySelectorAll(& ...
- HDU 4287 Intelligent IME
Intelligent IME Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 动画Rig设置为Legacy
The animation state AimUp could not be played because it couldn't be found!Please attach an animatio ...
- jni那点事
今天说一下在jni开发中常另新手迷惑的JNIEnv这个东西 比如一个c语言的函数 JNIEXPORT jstring JNICALL Java_com_mmmmar_nativethread_Main ...
- 洛谷 1503 鬼子进村 (set)
/*set加速维护*/ #include<iostream> #include<cstdio> #include<cstring> #include<set& ...
- My.Ioc 代码示例——避免循环依赖
本文的目的在于通过一些示例,向大家说明 My.Ioc 支持哪些类型的依赖关系.也就是说,如何设计对象不会导致循环依赖. 在 Ioc 世界中,循环依赖是一个顽敌.这不仅因为它会导致 Ioc 容器抛出异常 ...
- java中对象的转型
1.对象的向上转型——将子类的对象赋值给父类的引用 Student s=new Student(); Person p=s; 一个引用能够调哪些成员(变量和函数),取决于这个引用的类型 也就是Pe ...
- ASP.NET 中的定时执行任务
在一个网站中,设定一些任务能够在后台定时执行. public static void AddTask(int seconds, Action todo) { HttpRuntime.Cache.Ins ...
- JNI测试-java调用c算法并返回java调用处-1到20阶乘的和
一,java端: 定义native方法, 'public native long factorial(int n);', 该方法用c/c++实现,计算'1到20阶乘的和',参数中'int n'是前n项 ...