chg: Optionally not-defang the URLs in the email notification

pull/596/head
Raphaël Vinot 2023-02-01 12:35:38 +01:00
parent 9337a96e5a
commit 01a4b4d632
2 changed files with 11 additions and 4 deletions

View File

@ -35,7 +35,8 @@
"subject": "Capture from Lookyloo to review", "subject": "Capture from Lookyloo to review",
"smtp_host": "localhost", "smtp_host": "localhost",
"smtp_port": "25", "smtp_port": "25",
"confirm_message": "Message the users need to confirm before they submit a notification." "confirm_message": "Message the users need to confirm before they submit a notification.",
"defang_urls": true
}, },
"priority": { "priority": {
"sources": { "sources": {

View File

@ -590,18 +590,24 @@ class Lookyloo():
if not get_config('generic', 'enable_mail_notification'): if not get_config('generic', 'enable_mail_notification'):
return return
email_config = get_config('generic', 'email')
redirects = '' redirects = ''
initial_url = '' initial_url = ''
cache = self.capture_cache(capture_uuid) cache = self.capture_cache(capture_uuid)
if cache: if cache:
if email_config['defang_urls']:
initial_url = defang(cache.url, colon=True, all_dots=True) initial_url = defang(cache.url, colon=True, all_dots=True)
else:
initial_url = cache.url
if cache.redirects: if cache.redirects:
redirects = "Redirects:\n" redirects = "Redirects:\n"
if email_config['defang_urls']:
redirects += defang('\n'.join(cache.redirects), colon=True, all_dots=True) redirects += defang('\n'.join(cache.redirects), colon=True, all_dots=True)
else:
redirects += '\n'.join(cache.redirects)
else: else:
redirects = "No redirects." redirects = "No redirects."
email_config = get_config('generic', 'email')
msg = EmailMessage() msg = EmailMessage()
msg['From'] = email_config['from'] msg['From'] = email_config['from']
if email: if email: