Skip to content

Commit c6868ea

Browse files
Unified output of SecurityTrails API in one variable
1 parent 0c64940 commit c6868ea

File tree

1 file changed

+14
-48
lines changed

1 file changed

+14
-48
lines changed

reporting_modules/html_report_creation.py

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import files_processing as fp
1010
from api_hudsonrock import hudsonrock_html_prep
1111
from api_virustotal import virustotal_html_prep
12+
from api_securitytrails import securitytrails_html_prep
1213

1314
try:
1415
from datetime import datetime
@@ -79,16 +80,16 @@ def report_assembling(short_domain, url, case_comment, data_array, report_info_a
7980
#vt_deturls = data_array[46]
8081
#vt_detsamples = data_array[47]
8182
#vt_undetsamples = data_array[48]
82-
st_alexa = data_array[46]
83-
st_apex = data_array[47]
84-
st_hostname = data_array[48]
85-
st_alivesds = data_array[49]
86-
st_txt = data_array[50]
87-
a_records_list = data_array[51]
88-
mx_records_list = data_array[52]
89-
ns_records_list = data_array[53]
90-
soa_records_list = data_array[54]
91-
hudsonrock_output = data_array[55]
83+
securitytrails_output = data_array[46]
84+
#st_apex = data_array[47]
85+
#st_hostname = data_array[48]
86+
#st_alivesds = data_array[49]
87+
#st_txt = data_array[50]
88+
#a_records_list = data_array[51]
89+
#mx_records_list = data_array[52]
90+
#ns_records_list = data_array[53]
91+
#soa_records_list = data_array[54]
92+
hudsonrock_output = data_array[47]
9293
casename = report_info_array[0]
9394
db_casename = report_info_array[1]
9495
db_creation_date = report_info_array[2]
@@ -99,41 +100,7 @@ def report_assembling(short_domain, url, case_comment, data_array, report_info_a
99100

100101
hudsonrock_output = hudsonrock_html_prep(hudsonrock_output)
101102
virustotal_output = virustotal_html_prep(virustotal_output)
102-
103-
if '2' in used_api_flag:
104-
st_a_combined = []
105-
if len(a_records_list) > 0:
106-
if len(a_records_list) == 1:
107-
record = a_records_list[0]
108-
st_a_combined = [f"IPv4 address: {record.get('ip', '')}, owned by {record.get('organization', '')}"]
109-
else:
110-
st_a_combined = [f"IPv4 address: {record.get('ip', '')}, owned by {record.get('organization', '')}" for record in a_records_list]
111-
112-
st_mx_combined = []
113-
if len(mx_records_list) > 0:
114-
if len(mx_records_list) == 1:
115-
record = mx_records_list[0]
116-
st_mx_combined = [f"Hostname {record.get('mx_hostname', '')} with priority={record.get('mx_priority', '')}, owned by {record.get('mx_organization', '')}"]
117-
else:
118-
st_mx_combined = [f"Hostname {record.get('mx_hostname', '')} with priority={record.get('mx_priority', '')}, owned by {record.get('mx_organization', '')}" for record in mx_records_list]
119-
120-
st_ns_combined = []
121-
if len(ns_records_list) > 0:
122-
if len(ns_records_list) == 1:
123-
record = ns_records_list[0]
124-
st_ns_combined = [f"Nameserver: {record.get('ns_nameserver', '')}, owned by {record.get('ns_organization', '')}"]
125-
else:
126-
st_ns_combined = [f"Nameserver: {record.get('ns_nameserver', '')}, owned by {record.get('ns_organization', '')}" for record in ns_records_list]
127-
128-
st_soa_combined = []
129-
if len(soa_records_list) > 0:
130-
if len(soa_records_list) == 1:
131-
record = soa_records_list[0]
132-
st_soa_combined = [f"Email: {record.get('soa_email', '')}, TTL={record.get('soa_ttl', '')}"]
133-
else:
134-
st_soa_combined = [f"Email: {record.get('soa_email', '')}, TTL={record.get('soa_ttl', '')}" for record in soa_records_list]
135-
else:
136-
st_soa_combined = st_ns_combined = st_mx_combined = st_a_combined = st_txt = st_alivesds = ['No results because user did not selected SecurityTrails API scan']
103+
securitytrails_output = securitytrails_html_prep(securitytrails_output)
137104

138105
pdf_templates_path = 'service//pdf_report_templates'
139106

@@ -190,9 +157,8 @@ def report_assembling(short_domain, url, case_comment, data_array, report_info_a
190157
'tags': tags, 'vulns': vulns, 'a_tsm': total_socials, 'pagesearch_ui_mark': pagesearch_ui_mark,
191158
'dorking_status': dorking_status,
192159
'add_dsi': add_dsi, 'ps_s': accessible_subdomains, 'ps_e': emails_amount, 'ps_f': files_counter, 'ps_c': cookies_counter, 'ps_a': api_keys_counter,
193-
'ps_w': website_elements_counter, 'ps_p': exposed_passwords_counter, 'ss_l': total_links_counter, 'ss_a': accessed_links_counter, 'st_alexa': st_alexa, 'st_apex': st_apex, 'st_hostname': st_hostname, 'st_ip_combined': st_a_combined, 'st_val': st_txt, 'st_subds': st_alivesds, 'st_mx_combined': st_mx_combined,
194-
'st_ns_combined': st_ns_combined, 'st_soa_combined': st_soa_combined, 'hudsonrock_output': hudsonrock_output, "snapshotting_ui_mark": snapshotting_ui_mark,
195-
'virustotal_output': virustotal_output}
160+
'ps_w': website_elements_counter, 'ps_p': exposed_passwords_counter, 'ss_l': total_links_counter, 'ss_a': accessed_links_counter, 'hudsonrock_output': hudsonrock_output, "snapshotting_ui_mark": snapshotting_ui_mark,
161+
'virustotal_output': virustotal_output, 'securitytrails_output': securitytrails_output}
196162

197163
html_report_name = report_folder + '//' + casename
198164
if generate_report(context, html_report_name, template_path):

0 commit comments

Comments
 (0)