Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Tokens/exfil_exchange_mail.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import json
import base64
import re

# This script requires a token from graph.microsoft.com

Expand Down Expand Up @@ -29,7 +30,8 @@
# Check if the email has an HTML body
if email['body']['contentType'] == 'html':
# Save the HTML body to a file
with open(subject + '.html', 'w') as f:
name = re.sub('[^a-zA-Z0-9 \n\.]', '', subject)
with open(name + '.html', 'w') as f:
f.write(body)
print('HTML email downloaded:', subject + '.html')
print('All emails downloaded.')
Expand Down