Skip to content

Commit

Permalink
统计逻辑修改
Browse files Browse the repository at this point in the history
ip、端口、漏洞信息作为唯一标示 只会统计一次
  • Loading branch information
wolf committed Feb 10, 2017
1 parent a4dbb9f commit 4e2f1ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vulscan/VulScan.py
Expand Up @@ -128,13 +128,15 @@ def save_request(self):
try:
time_ = datetime.datetime.now()
self.log(str(self.task_netloc) + " " + self.result_info)
v_count = na_result.find(
{"ip": self.task_netloc[0], "port": self.task_netloc[1], "info": self.result_info}).count()
if not v_count: na_plugin.update({"name": self.task_plugin}, {"$inc": {'count': 1}})
vulinfo = {"vul_name": self.plugin_info['name'], "vul_level": self.plugin_info['level'],
"vul_type": self.plugin_info['type']}
w_vul = {"task_id": self.task_id, "ip": self.task_netloc[0], "port": self.task_netloc[1],
"vul_info": vulinfo, "info": self.result_info, "time": time_,
"task_date": TASK_DATE_DIC[str(self.task_id)]}
na_result.insert(w_vul)
na_plugin.update({"name": self.task_plugin}, {"$inc": {'count': 1}})
# self.wx_send(w_vul) # 自行定义漏洞提醒
except Exception, e:
pass
Expand Down

0 comments on commit 4e2f1ed

Please sign in to comment.