forked from JMousqueton/ransomware.live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwithout_country.py
41 lines (34 loc) · 1.34 KB
/
without_country.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import json
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
# Read the posts from posts.json
with open('posts.json', 'r') as file:
posts = json.load(file)
# Filter posts discovered in 2024
posts_2024 = [post['post_title'] for post in posts if (post['discovered'].startswith('2024') and not post['country'])]
# Remove entries containing "**" from posts_2024
posts_2024 = [post for post in posts_2024 if "**" not in post]
if posts_2024:
# Email configurations
sender_email = '[email protected]' # Replace with your email
receiver_email = '[email protected]' # Replace with recipient's email
subject = '[Action required] New post(s) without country'
# Compose email
message = MIMEMultipart()
message['From'] = sender_email
message['To'] = receiver_email
message['Subject'] = subject
body = "List of new post(s) which required action :\n\n"
body += "\n".join(posts_2024)
message.attach(MIMEText(body, 'plain'))
# Connect to local SMTP server and send email
try:
server = smtplib.SMTP('localhost', 25)
server.sendmail(sender_email, receiver_email, message.as_string())
except Exception as e:
print("Email could not be sent:", str(e))
finally:
server.quit()
else:
print("No new posts wihtou country")