From 7a44df15e762e4e7e255efeb917331995d500ff7 Mon Sep 17 00:00:00 2001 From: Yogesh Ojha Date: Sun, 11 Oct 2020 18:07:42 +0530 Subject: [PATCH] vulnerability scan yaml conf --- reNgine/tasks.py | 58 ++++++++++--------- .../templates/scanEngine/add_engine.html | 17 ++++++ 2 files changed, 49 insertions(+), 26 deletions(-) diff --git a/reNgine/tasks.py b/reNgine/tasks.py index 725f77fe..53245df9 100644 --- a/reNgine/tasks.py +++ b/reNgine/tasks.py @@ -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 ''' diff --git a/scanEngine/templates/scanEngine/add_engine.html b/scanEngine/templates/scanEngine/add_engine.html index f716b28f..d968bae7 100644 --- a/scanEngine/templates/scanEngine/add_engine.html +++ b/scanEngine/templates/scanEngine/add_engine.html @@ -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(); });