diff --git a/web/reNgine/common_func.py b/web/reNgine/common_func.py index d48cac4c..3bac4f48 100644 --- a/web/reNgine/common_func.py +++ b/web/reNgine/common_func.py @@ -9,7 +9,7 @@ from discord_webhook import DiscordWebhook from django.db.models import Q from functools import reduce from scanEngine.models import * -from startScan.models import Subdomain, EndPoint +from startScan.models import * def get_lookup_keywords(): @@ -206,3 +206,59 @@ def get_random_proxy(): print('Using proxy: ' + proxy_name) return proxy_name return False + +def send_hackerone_report(vulnerability_id): + headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + } + # get hackerone creds + if Hackerone.objects.all().exists(): + hackerone = Hackerone.objects.all()[0] + vulnerability = Vulnerability.objects.get(id=vulnerability_id) + if vulnerability.severity == 0: + severity_value = 'info' + elif vulnerability.severity == 1: + severity_value = 'low' + elif vulnerability.severity == 2: + severity_value = 'medium' + elif vulnerability.severity == 3: + severity_value = 'high' + elif vulnerability.severity == 4: + severity_value = 'critical' + report_template = hackerone.report_template + # Replace syntax of report template with actual content + if '{vulnerability_name}' in report_template: + report_template = report_template.replace('{vulnerability_name}', vulnerability.name) + if '{vulnerable_url}' in report_template: + report_template = report_template.replace('{vulnerable_url}', vulnerability.http_url) + if '{vulnerability_severity}' in report_template: + report_template = report_template.replace('{vulnerability_severity}', severity_value) + if '{vulnerability_description}' in report_template: + report_template = report_template.replace('{vulnerability_description}', vulnerability.description if vulnerability.description else '') + if '{vulnerability_extracted_results}' in report_template: + report_template = report_template.replace('{vulnerability_extracted_results}', vulnerability.extracted_results if vulnerability.extracted_results else '') + if '{vulnerability_reference}' in report_template: + report_template = report_template.replace('{vulnerability_reference}', vulnerability.reference if vulnerability.reference else '') + + data = { + "data": { + "type": "report", + "attributes": { + "team_handle": vulnerability.target_domain.h1_team_handle, + "title": '{} found in {}'.format(vulnerability.name, vulnerability.http_url), + "vulnerability_information": report_template, + "severity_rating": severity_value, + "impact": " " + vulnerability.reference if vulnerability.reference else "N/A", + } + } + } + + r = requests.post( + 'https://api.hackerone.com/v1/hackers/reports', + auth=(hackerone.username, hackerone.api_key), + json = data, + headers = headers + ) + + print(r.json()) diff --git a/web/scanEngine/forms.py b/web/scanEngine/forms.py index 9c954893..ab4d6582 100644 --- a/web/scanEngine/forms.py +++ b/web/scanEngine/forms.py @@ -470,8 +470,9 @@ class HackeroneForm(forms.ModelForm): self.initial['send_medium'] = False self.initial['report_template'] = '''Hi Team, while testing, a {vulnerability_severity} severity vulnerability has been discovered in {vulnerable_url} and below is the findings. + # Vulnerability -{vulnerability_title} +{vulnerability_name} ## Issue Description {vulnerability_description} diff --git a/web/scanEngine/views.py b/web/scanEngine/views.py index 9319f76b..d65b529a 100644 --- a/web/scanEngine/views.py +++ b/web/scanEngine/views.py @@ -84,13 +84,14 @@ def update_engine(request, id): def wordlist_list(request): wordlists = Wordlist.objects.all().order_by('id') context = { - 'scan_engine_nav_active': - 'active', 'wordlists': wordlists} + 'scan_engine_nav_active': 'active', + 'wordlist_li': 'active', + 'wordlists': wordlists} return render(request, 'scanEngine/wordlist/index.html', context) def add_wordlist(request): - context = {'scan_engine_nav_active': 'active'} + context = {'scan_engine_nav_active': 'active', 'wordlist_li': 'active'} form = AddWordlistForm(request.POST or None, request.FILES or None) if request.method == "POST": if form.is_valid() and 'upload_file' in request.FILES: diff --git a/web/targetApp/forms.py b/web/targetApp/forms.py index 4242c921..4383170c 100644 --- a/web/targetApp/forms.py +++ b/web/targetApp/forms.py @@ -84,7 +84,7 @@ class AddOrganizationForm(forms.Form): class UpdateTargetForm(forms.ModelForm): class Meta: model = Domain - fields = ['name', 'description'] + fields = ['name', 'description', 'h1_team_handle'] name = forms.CharField( validators=[validate_domain], required=True, @@ -113,7 +113,7 @@ class UpdateTargetForm(forms.ModelForm): } )) - def set_value(self, domain_value, description_value): + def set_value(self, domain_value, description_value, h1_team_handle): self.initial['name'] = domain_value self.initial['description'] = description_value self.initial['h1_team_handle'] = h1_team_handle diff --git a/web/targetApp/templates/target/_items/domain_form.html b/web/targetApp/templates/target/_items/domain_form.html index 699eed9d..5dda2136 100644 --- a/web/targetApp/templates/target/_items/domain_form.html +++ b/web/targetApp/templates/target/_items/domain_form.html @@ -24,6 +24,31 @@ {{ form.description }} +