mirror of https://github.com/CIRCL/lookyloo
chg: fixes
parent
e824fea97d
commit
427c6ed465
|
@ -116,7 +116,7 @@ class AsyncCapture(AbstractManager):
|
||||||
|
|
||||||
if send_report:
|
if send_report:
|
||||||
self.lookyloo.send_mail(uuid, email=settings.get('email', ''),
|
self.lookyloo.send_mail(uuid, email=settings.get('email', ''),
|
||||||
comment=settings.get('comment'), email_prio= settings["email"] if settings["email"] else None)
|
comment=settings.get('comment'), recipient_mail= settings.get("recipient_mail"))
|
||||||
|
|
||||||
lazy_cleanup = self.lookyloo.redis.pipeline()
|
lazy_cleanup = self.lookyloo.redis.pipeline()
|
||||||
if queue and self.lookyloo.redis.zscore('queues', queue):
|
if queue and self.lookyloo.redis.zscore('queues', queue):
|
||||||
|
|
|
@ -864,7 +864,7 @@ class Lookyloo():
|
||||||
|
|
||||||
return f"Malicious capture according to {len(modules)} module(s): {', '.join(modules)}"
|
return f"Malicious capture according to {len(modules)} module(s): {', '.join(modules)}"
|
||||||
|
|
||||||
def send_mail(self, capture_uuid: str, /, email: str='', comment: str | None=None, email_prio: str | None = None) -> bool | dict[str, Any]:
|
def send_mail(self, capture_uuid: str, /, email: str='', comment: str | None=None, recipient_mail: str | None = None) -> bool | dict[str, Any]:
|
||||||
'''Send an email notification regarding a specific capture'''
|
'''Send an email notification regarding a specific capture'''
|
||||||
if not get_config('generic', 'enable_mail_notification'):
|
if not get_config('generic', 'enable_mail_notification'):
|
||||||
return {"error": "Unable to send mail: mail notification disabled"}
|
return {"error": "Unable to send mail: mail notification disabled"}
|
||||||
|
@ -913,7 +913,7 @@ class Lookyloo():
|
||||||
msg['From'] = email_config['from']
|
msg['From'] = email_config['from']
|
||||||
if email:
|
if email:
|
||||||
msg['Reply-To'] = email
|
msg['Reply-To'] = email
|
||||||
msg['To'] = email_config['to'] if not email_prio else email_prio
|
msg['To'] = email_config['to'] if not recipient_mail else recipient_mail
|
||||||
msg['Subject'] = email_config['subject']
|
msg['Subject'] = email_config['subject']
|
||||||
body = get_email_template()
|
body = get_email_template()
|
||||||
body = body.format(
|
body = body.format(
|
||||||
|
|
|
@ -12,6 +12,7 @@ import json
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -1638,8 +1639,10 @@ def simple_capture() -> str | Response | WerkzeugResponse:
|
||||||
user = flask_login.current_user.get_id()
|
user = flask_login.current_user.get_id()
|
||||||
else:
|
else:
|
||||||
user = src_request_ip(request)
|
user = src_request_ip(request)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
if not re.match("^[A-Za-z]+$", user):
|
||||||
|
flash('User is not permitted.', 'error')
|
||||||
|
return redirect(url_for('simple_capture'))
|
||||||
if not (request.form.get('url') or request.form.get('urls')):
|
if not (request.form.get('url') or request.form.get('urls')):
|
||||||
flash('Invalid submission: please submit at least a URL.', 'error')
|
flash('Invalid submission: please submit at least a URL.', 'error')
|
||||||
return render_template('simple_capture.html')
|
return render_template('simple_capture.html')
|
||||||
|
@ -1649,7 +1652,7 @@ def simple_capture() -> str | Response | WerkzeugResponse:
|
||||||
path = get_homedir() /'config'/ 'users' / (user + ".json")
|
path = get_homedir() /'config'/ 'users' / (user + ".json")
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
email = get_config(user, 'email')
|
email = get_config(user, 'email')
|
||||||
capture_query['auto_report'] = {"email": email}
|
capture_query['auto_report'] = {"recipient_mail": email}
|
||||||
else:
|
else:
|
||||||
capture_query['auto_report'] = True
|
capture_query['auto_report'] = True
|
||||||
if request.form.get('url'):
|
if request.form.get('url'):
|
||||||
|
|
|
@ -63,20 +63,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<!-- End of Submission type -->
|
|
||||||
|
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<b>
|
|
||||||
{% if default_public %}
|
|
||||||
By default, the capture is private. If you do not want that, untick the box at the top of the form.
|
|
||||||
{% else %}
|
|
||||||
By default, the capture is private (not visible on the index page). If you want it to be public tick the box at the top of the form.
|
|
||||||
{% endif %}
|
|
||||||
</b>
|
|
||||||
</br>
|
</br>
|
||||||
</br>
|
<button type="submit" class="new-capture-button btn btn-primary" id="btn-looking">Submit!</button>
|
||||||
<button type="submit" class="new-capture-button btn btn-primary" id="btn-looking">Start looking!</button>
|
|
||||||
</center>
|
</center>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue