mirror of https://github.com/CIRCL/lookyloo
Made send_email available from the API
parent
bf47dc79dc
commit
4d5beef79e
|
@ -380,7 +380,19 @@ class CaptureCookies(Resource): # type: ignore[misc]
|
|||
def get(self, capture_uuid: str) -> dict[str, Any]:
|
||||
return json.loads(lookyloo.get_cookies(capture_uuid).read())
|
||||
|
||||
|
||||
@api.route('/json/<string:capture_uuid>/report')
|
||||
@api.doc(description='Reports the url by sending an email to the investigation team',
|
||||
params={'capture_uuid': 'The UUID of the capture'})
|
||||
class CaptureReport(Resource): # type: ignore[misc]
|
||||
@api.param('email', 'Email of the reporter, used by the analyst to get in touch.') # type: ignore[misc]
|
||||
@api.param('comment', 'Description of the URL, will be given to the analyst.') # type: ignore[misc]
|
||||
def post(self, capture_uuid) -> str:
|
||||
parameters: dict[str, Any] = request.get_json(force=True)
|
||||
answer = lookyloo.send_mail(capture_uuid, parameters.get('email'), parameters.get('comment'))
|
||||
if answer is None:
|
||||
return "Successfully sent an email to the investigation"
|
||||
else:
|
||||
return "Error: " + str(answer)
|
||||
# Just text
|
||||
|
||||
auto_report_model = api.model('AutoReportModel', {
|
||||
|
|
Loading…
Reference in New Issue