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",
"smtp_host": "localhost",
"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": {
"sources": {

View File

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