Skip to content

Commit

Permalink
allow choosing report template
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshojha committed Aug 28, 2024
1 parent ff28990 commit 3b9b00d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions web/startScan/templates/startScan/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ <h6 class="text-primary mb-3">Additional Options</h6>
//select full report type by default
$('input[name="reportType"][value="full"]').prop('checked', true);
$('input[name="excludeInfoFindings"]').prop('checked', true);
$('#templateSelect').val('modern');
$('#generateReportModal').modal('show');
if (has_subdomain_scan) {
$('input[name="reportType"][value="recon"]').prop('disabled', false);
Expand All @@ -662,7 +663,9 @@ <h6 class="text-primary mb-3">Additional Options</h6>
function preview_report(id, domain_name){
var report_type = $('input[name="reportType"]:checked').val();
var is_ignore_info_vuln = $('#excludeInfoFindings').is(":checked");
var report_template = $('#templateSelect').val();
var url = `/scan/create_report/${id}?report_type=${report_type}`;
url += `&report_template=${report_template}`;
if (is_ignore_info_vuln) {
url += `&ignore_info_vuln`
}
Expand All @@ -673,7 +676,9 @@ <h6 class="text-primary mb-3">Additional Options</h6>
function generate_report(id, domain_name) {
var report_type = $('input[name="reportType"]:checked').val();
var is_ignore_info_vuln = $('#excludeInfoFindings').is(":checked");
var report_template = $('#templateSelect').val();
var url = `/scan/create_report/${id}?report_type=${report_type}&download`;
url += `&report_template=${report_template}`;
if (is_ignore_info_vuln) {
url += `&ignore_info_vuln`
}
Expand Down
8 changes: 7 additions & 1 deletion web/startScan/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,8 @@ def create_report(request, id):
secondary_color = '#212121'
# get report type
report_type = request.GET['report_type'] if 'report_type' in request.GET else 'full'
report_template = request.GET['report_template'] if 'report_template' in request.GET else 'default'

is_ignore_info_vuln = True if 'ignore_info_vuln' in request.GET else False
if report_type == 'recon':
show_recon = True
Expand Down Expand Up @@ -1102,7 +1104,11 @@ def create_report(request, id):
data['subdomain_http_status_chart'] = generate_subdomain_chart_by_http_status(subdomains)
data['vulns_severity_chart'] = generate_vulnerability_chart_by_severity(vulns) if vulns else ''

template = get_template('report/modern.html')
if report_template == 'modern':
template = get_template('report/modern.html')
else:
template = get_template('report/default.html')

html = template.render(data)
pdf = HTML(string=html).write_pdf()
# pdf = HTML(string=html).write_pdf(stylesheets=[CSS(string='@page { size: A4; margin: 0; }')])
Expand Down

0 comments on commit 3b9b00d

Please sign in to comment.