From ffd768c81476702811b608a72bdb10e5b159d0ce Mon Sep 17 00:00:00 2001 From: Raynald Date: Thu, 19 Oct 2023 18:01:22 +0200 Subject: [PATCH 1/5] Add all the missing slug in scanEngine view --- web/scanEngine/views.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/web/scanEngine/views.py b/web/scanEngine/views.py index 477a43441..322c68d1d 100644 --- a/web/scanEngine/views.py +++ b/web/scanEngine/views.py @@ -211,7 +211,7 @@ def tool_specific_settings(request, slug): file.write(gf_file.read().decode("utf-8")) file.close() messages.add_message(request, messages.INFO, 'Pattern {} successfully uploaded'.format(gf_file.name[:4])) - return http.HttpResponseRedirect(reverse('tool_settings')) + return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) elif 'nucleiFileUpload' in request.FILES: nuclei_file = request.FILES['nucleiFileUpload'] @@ -225,37 +225,37 @@ def tool_specific_settings(request, slug): file.write(nuclei_file.read().decode("utf-8")) file.close() messages.add_message(request, messages.INFO, 'Nuclei Pattern {} successfully uploaded'.format(nuclei_file.name[:-5])) - return http.HttpResponseRedirect(reverse('tool_settings')) + return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) elif 'nuclei_config_text_area' in request.POST: with open('/root/.config/nuclei/config.yaml', "w") as fhandle: fhandle.write(request.POST.get('nuclei_config_text_area')) messages.add_message(request, messages.INFO, 'Nuclei config updated!') - return http.HttpResponseRedirect(reverse('tool_settings')) + return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) elif 'subfinder_config_text_area' in request.POST: with open('/root/.config/subfinder/config.yaml', "w") as fhandle: fhandle.write(request.POST.get('subfinder_config_text_area')) messages.add_message(request, messages.INFO, 'Subfinder config updated!') - return http.HttpResponseRedirect(reverse('tool_settings')) + return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) elif 'naabu_config_text_area' in request.POST: with open('/root/.config/naabu/config.yaml', "w") as fhandle: fhandle.write(request.POST.get('naabu_config_text_area')) messages.add_message(request, messages.INFO, 'Naabu config updated!') - return http.HttpResponseRedirect(reverse('tool_settings')) + return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) elif 'amass_config_text_area' in request.POST: with open('/root/.config/amass.ini', "w") as fhandle: fhandle.write(request.POST.get('amass_config_text_area')) messages.add_message(request, messages.INFO, 'Amass config updated!') - return http.HttpResponseRedirect(reverse('tool_settings')) + return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) elif 'theharvester_config_text_area' in request.POST: with open('/usr/src/github/theHarvester/api-keys.yaml', "w") as fhandle: fhandle.write(request.POST.get('theharvester_config_text_area')) messages.add_message(request, messages.INFO, 'theHarvester config updated!') - return http.HttpResponseRedirect(reverse('tool_settings')) + return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) context['settings_nav_active'] = 'active' context['tool_settings_li'] = 'active' @@ -312,7 +312,7 @@ def notification_settings(request, slug): request, messages.INFO, 'Notification Settings updated successfully and test message was sent.') - return http.HttpResponseRedirect(reverse('notification_settings')) + return http.HttpResponseRedirect(reverse('notification_settings'), kwargs={'slug': slug}) context['settings_nav_active'] = 'active' context['notification_settings_li'] = 'active' @@ -347,7 +347,7 @@ def proxy_settings(request, slug): request, messages.INFO, 'Proxies updated.') - return http.HttpResponseRedirect(reverse('proxy_settings')) + return http.HttpResponseRedirect(reverse('proxy_settings'), kwargs={'slug': slug}) context['settings_nav_active'] = 'active' context['proxy_settings_li'] = 'active' context['settings_ul_show'] = 'show' @@ -399,7 +399,7 @@ def hackerone_settings(request, slug): request, messages.INFO, 'Hackerone Settings updated.') - return http.HttpResponseRedirect(reverse('hackerone_settings')) + return http.HttpResponseRedirect(reverse('hackerone_settings'), kwargs={'slug': slug}) context['settings_nav_active'] = 'active' context['hackerone_settings_li'] = 'active' context['settings_ul_show'] = 'show' From 2b10db2906a8ac59be07a7898a9c3580252a11a5 Mon Sep 17 00:00:00 2001 From: Raynald Date: Thu, 19 Oct 2023 18:12:23 +0200 Subject: [PATCH 2/5] Move slug param inside redirect function --- web/scanEngine/views.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/web/scanEngine/views.py b/web/scanEngine/views.py index 322c68d1d..0a06cb790 100644 --- a/web/scanEngine/views.py +++ b/web/scanEngine/views.py @@ -211,7 +211,7 @@ def tool_specific_settings(request, slug): file.write(gf_file.read().decode("utf-8")) file.close() messages.add_message(request, messages.INFO, 'Pattern {} successfully uploaded'.format(gf_file.name[:4])) - return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('tool_settings', kwargs={'slug': slug})) elif 'nucleiFileUpload' in request.FILES: nuclei_file = request.FILES['nucleiFileUpload'] @@ -225,37 +225,37 @@ def tool_specific_settings(request, slug): file.write(nuclei_file.read().decode("utf-8")) file.close() messages.add_message(request, messages.INFO, 'Nuclei Pattern {} successfully uploaded'.format(nuclei_file.name[:-5])) - return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('tool_settings', kwargs={'slug': slug})) elif 'nuclei_config_text_area' in request.POST: with open('/root/.config/nuclei/config.yaml', "w") as fhandle: fhandle.write(request.POST.get('nuclei_config_text_area')) messages.add_message(request, messages.INFO, 'Nuclei config updated!') - return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('tool_settings', kwargs={'slug': slug})) elif 'subfinder_config_text_area' in request.POST: with open('/root/.config/subfinder/config.yaml', "w") as fhandle: fhandle.write(request.POST.get('subfinder_config_text_area')) messages.add_message(request, messages.INFO, 'Subfinder config updated!') - return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('tool_settings', kwargs={'slug': slug})) elif 'naabu_config_text_area' in request.POST: with open('/root/.config/naabu/config.yaml', "w") as fhandle: fhandle.write(request.POST.get('naabu_config_text_area')) messages.add_message(request, messages.INFO, 'Naabu config updated!') - return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('tool_settings', kwargs={'slug': slug})) elif 'amass_config_text_area' in request.POST: with open('/root/.config/amass.ini', "w") as fhandle: fhandle.write(request.POST.get('amass_config_text_area')) messages.add_message(request, messages.INFO, 'Amass config updated!') - return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('tool_settings', kwargs={'slug': slug})) elif 'theharvester_config_text_area' in request.POST: with open('/usr/src/github/theHarvester/api-keys.yaml', "w") as fhandle: fhandle.write(request.POST.get('theharvester_config_text_area')) messages.add_message(request, messages.INFO, 'theHarvester config updated!') - return http.HttpResponseRedirect(reverse('tool_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('tool_settings', kwargs={'slug': slug})) context['settings_nav_active'] = 'active' context['tool_settings_li'] = 'active' @@ -312,7 +312,7 @@ def notification_settings(request, slug): request, messages.INFO, 'Notification Settings updated successfully and test message was sent.') - return http.HttpResponseRedirect(reverse('notification_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('notification_settings', kwargs={'slug': slug})) context['settings_nav_active'] = 'active' context['notification_settings_li'] = 'active' @@ -347,7 +347,7 @@ def proxy_settings(request, slug): request, messages.INFO, 'Proxies updated.') - return http.HttpResponseRedirect(reverse('proxy_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('proxy_settings', kwargs={'slug': slug})) context['settings_nav_active'] = 'active' context['proxy_settings_li'] = 'active' context['settings_ul_show'] = 'show' @@ -399,7 +399,7 @@ def hackerone_settings(request, slug): request, messages.INFO, 'Hackerone Settings updated.') - return http.HttpResponseRedirect(reverse('hackerone_settings'), kwargs={'slug': slug}) + return http.HttpResponseRedirect(reverse('hackerone_settings', kwargs={'slug': slug})) context['settings_nav_active'] = 'active' context['hackerone_settings_li'] = 'active' context['settings_ul_show'] = 'show' @@ -437,7 +437,7 @@ def report_settings(request, slug): request, messages.INFO, 'Report Settings updated.') - return http.HttpResponseRedirect(reverse('report_settings')) + return http.HttpResponseRedirect(reverse('report_settings', kwargs={'slug': slug})) context['settings_nav_active'] = 'active' From 21abf2c951fd7b428a7d6d0d0ab5a5e2eb4aeec1 Mon Sep 17 00:00:00 2001 From: Raynald Date: Sat, 21 Oct 2023 17:41:24 +0200 Subject: [PATCH 3/5] Fix missing slug & id in tool_arsenal --- web/scanEngine/templates/scanEngine/settings/tool_arsenal.html | 2 +- web/scanEngine/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/scanEngine/templates/scanEngine/settings/tool_arsenal.html b/web/scanEngine/templates/scanEngine/settings/tool_arsenal.html index 1dc32ed14..84b164627 100644 --- a/web/scanEngine/templates/scanEngine/settings/tool_arsenal.html +++ b/web/scanEngine/templates/scanEngine/settings/tool_arsenal.html @@ -56,7 +56,7 @@ {% endif %} diff --git a/web/scanEngine/views.py b/web/scanEngine/views.py index 0a06cb790..d8c69bb62 100644 --- a/web/scanEngine/views.py +++ b/web/scanEngine/views.py @@ -536,7 +536,7 @@ def modify_tool_in_arsenal(request, slug, id): request, messages.INFO, 'Tool modified successfully') - return http.HttpResponseRedirect(reverse('tool_arsenal', kwargs={'slug': slug})) + return http.HttpResponseRedirect(reverse('tool_arsenal', kwargs={'slug': slug, 'id': id})) else: form.set_value(external_tool) context = { From b429214ff2e180e03b56200428ef0baf47820ff7 Mon Sep 17 00:00:00 2001 From: Raynald Date: Sat, 21 Oct 2023 18:31:33 +0200 Subject: [PATCH 4/5] Change default slug on logo to current slug --- web/templates/base/_items/top_bar.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/templates/base/_items/top_bar.html b/web/templates/base/_items/top_bar.html index 5118271ab..c6a4dfbfa 100644 --- a/web/templates/base/_items/top_bar.html +++ b/web/templates/base/_items/top_bar.html @@ -168,7 +168,7 @@
Welcome {{user.get_username}}!