vulnerability scan yaml conf

This commit is contained in:
Yogesh Ojha
2020-10-11 18:07:42 +05:30
parent 199f1562c6
commit 7a44df15e7
2 changed files with 49 additions and 26 deletions
+32 -26
View File
@@ -484,36 +484,42 @@ def doScan(domain_id, scan_history_id, scan_type, engine_type):
vulnerability_result_path = results_dir + \
current_scan_dir + '/vulnerability.json'
alive_url_path = results_dir + current_scan_dir + '/alive.txt'
nuclei_command = 'nuclei -t /root/nuclei-templates -json -pbar -o ' + \
nuclei_command = 'nuclei -t /root/nuclei-templates -json -o ' + \
vulnerability_result_path + ' -l ' + alive_url_path
os.system(nuclei_command)
urls_json_result = open(vulnerability_result_path, 'r')
lines = urls_json_result.readlines()
for line in lines:
json_st = json.loads(line.strip())
vulnerability = VulnerabilityScan()
vulnerability.vulnerability_of = task
vulnerability.name = json_st['name']
vulnerability.url = json_st['matched']
if json_st['severity'] == 'info':
severity = 0
elif json_st['severity'] == 'low':
severity = 1
elif json_st['severity'] == 'medium':
severity = 2
elif json_st['severity'] == 'high':
severity = 3
else:
severity = 4
vulnerability.severity = severity
vulnerability.template_used = json_st['template']
if 'description' in json_st:
vulnerability.description = json_st['description']
if 'matcher_name' in json_st:
vulnerability.matcher_name = json_st['matcher_name']
vulnerability.save()
try:
urls_json_result = open(vulnerability_result_path, 'r')
lines = urls_json_result.readlines()
for line in lines:
json_st = json.loads(line.strip())
vulnerability = VulnerabilityScan()
vulnerability.vulnerability_of = task
vulnerability.name = json_st['name']
vulnerability.url = json_st['matched']
if json_st['severity'] == 'info':
severity = 0
elif json_st['severity'] == 'low':
severity = 1
elif json_st['severity'] == 'medium':
severity = 2
elif json_st['severity'] == 'high':
severity = 3
else:
severity = 4
vulnerability.severity = severity
vulnerability.template_used = json_st['template']
if 'description' in json_st:
vulnerability.description = json_st['description']
if 'matcher_name' in json_st:
vulnerability.matcher_name = json_st['matcher_name']
vulnerability.save()
except Exception as e:
print('-' * 30)
print(exception)
print('-' * 30)
update_last_activity(activity_id, 0)
'''
Once the scan is completed, save the status to successful
'''
@@ -102,6 +102,23 @@ fetch_url:
# supported tools are gau and hakrawler
# usage -> uses_tool: [ gau, hakrawler]
uses_tool: [ gau, hakrawler ]
vulnerability_scan:
# reNgine uses nuclei as a vulnerability scanner.
# concurrent: Number of concurrent requests (default 10)
concurrent: 10
# Template are input file/files to check across hosts
# Please refer nuclei documentation for templates
# currently supported options are one or more combination of nuclei-templates
# Usage: template: cves, default-credentials, dns, files, fuzzing
# Refer to nuclei-templates repo for available options
# or you can also use all templates using: template: all
# Find more about nuclei templates here: https://github.com/projectdiscovery/nuclei-templates
template: all
# If you wish to use templates based on severity, you can specify them
# Usage: severity: critical, low
# Available options are all, critical, high, low, info
severity: all
`);
editor.clearSelection();
});