-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
75 lines (66 loc) · 1.88 KB
/
app.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import email.mime.text
import getpass
import smtplib
import random
from time import time
USERNAME = "[email protected]"
print("Enter password for " + USERNAME)
PASSWORD = getpass.getpass()
VERBOSE = True
EMAIL = False #safety switch
WEAPON = open("config/weapon.txt").read()
IMMUNITY = open("config/immunity.txt").read()
tic = time()
fin = open("config/names.txt").read().splitlines()
for i in range(len(fin)):
fin[i] = fin[i].split("|")
random.shuffle(fin)
fout = open("out.txt","w")
for i in fin:
i[0] = i[0].strip()
i[1] = i[1].strip()
fout.write(i[0] + "\n")
fout.close()
s = smtplib.SMTP_SSL('smtp.gmail.com')
s.login(USERNAME, PASSWORD)
for i in range(len(fin)):
target = i+1
if i == len(fin)-1:
target = 0
addr = USERNAME + '@tjhsst.edu'
message = ("Hello {},\n\nYour target for assassins is {}.\n{}\n{}\nGood luck!\n\n-AutoModerator\n\nThis is an automated message.").format(fin[i][0],fin[target][0],WEAPON,IMMUNITY)
msg = email.mime.text.MIMEText(message)
msg['Subject'] = "Assassins Target"
msg['From'] = addr
msg['To'] = fin[i][1]
if EMAIL:
try:
s.send_message(msg)
if VERBOSE:
print("Message sent to", fin[i][0])
except:
print("Error sending message to", fin[i][0])
mods = open("config/mod.txt").read().splitlines()
for i in mods:
addr = USERNAME + '@tjhsst.edu'
message = "Hello Moderator,\n\nHere is the assassins targeting list:\n\n"
message += ("Total Participants: " + str(len(fin)) + "\n")
for j in fin:
message += (j[0] + "\n")
message += "\n-AutoModerator\n\nThis is an automated message."
msg = email.mime.text.MIMEText(message)
msg['Subject'] = "Assassins List"
msg['From'] = addr
msg['To'] = i
if EMAIL:
try:
s.send_message(msg)
except:
print("Error sending moderator message to", i)
if VERBOSE:
print("Moderator Message sent to", i)
s.quit()
toc = time()
if VERBOSE:
print(str(toc-tic) + " seconds elapsed")
print("Done!")