Skip to content

Commit 6bf06d3

Browse files
Fixed xlsx report filling issue (#49)
1 parent e4b506f commit 6bf06d3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

datagather_modules/networking_processor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@
1212
print(Fore.RED + "Import error appeared. Reason: {}".format(e) + Style.RESET_ALL)
1313
sys.exit()
1414

15-
def get_dns_info(short_domain):
15+
def get_dns_info(short_domain, report_file_extension):
1616
try:
1717
mx_list = []
1818
mx_records = dns.resolver.resolve(short_domain, 'MX')
1919
for record in mx_records:
2020
mx_list.append(record.exchange)
2121
if not mx_list:
2222
mx_list.append('MX records were not gathered')
23-
return mx_list
23+
if report_file_extension == 'xlsx':
24+
return ', '.join(map(str, mx_list))
25+
elif report_file_extension == 'pdf':
26+
return mx_list
2427
except dns.resolver.NoAnswer as error_noans:
2528
print(Fore.RED + "No answer from domain about MX records. Reason: {}".format(error_noans))
2629
return 'No information about MX records was gathered'

0 commit comments

Comments
 (0)