-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain - Chinease.py
204 lines (177 loc) · 6.67 KB
/
main - Chinease.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
from email import message
import smtplib
import sys
from time import time
import time
import sys
import itertools
import threading
done = False
def animate():
for c in itertools.cycle(['|', '/', '-', '\\']):
if done:
break
sys.stdout.write('\r[' + c + '] 攻击中')
sys.stdout.flush()
time.sleep(0.1)
def command():
while True:
command = input('\n>>>')
if command == 'exit' or 'q' or 'quit' or 'ex' or 'stop':
done = True
sys.exit()
exit()
elif command == 'timeout_20':
done = True
print('[*] 等待二十秒')
print('[*] 等待中')
time.sleep(20)
print('[*] 成功')
elif command == 'restart':
print('[*] 正在重启')
done = True
time.sleep(5)
done = False
print('[*] 重启成功')
elif command == 'timeout':
done = True
print('[*] 等待五秒')
print('[*] 等待中')
time.sleep(5)
print('[*] 成功')
elif command == 'timeout_10':
print('[*] 等待十秒')
print('[*] 等待中')
time.sleep(10)
print('[*] 成功')
elif command == 'timeout_5':
done = True
print('[*] 等待五秒')
print('[*] 等待中')
time.sleep(5)
print('[*] 成功')
else:
print('[*] 无效指令')
cmd = threading.Thread(target=command)
me = sys.argv
fromaddrs = input(str('[*] 请输入自己的邮箱: '))
while len(fromaddrs) == 0:
fromaddrs = input(str('[*] 请输入自己的邮箱: '))
toaddrs = input(str('[*] 请输入要"发给"的人: '))
while len(toaddrs) == 0:
toaddrs = input(str('[*] 请输入要"发给"的人: '))
message = input(str('[*] 请输入信息: '))
while len(message) == 0:
message = input(str('[*] 请输入信息: '))
apppass = input(str('[*] 请输入应用专用密码: '))
while len(apppass) == 0:
apppass = input(str('[*] 请输入应用专用密码: '))
times = input('[*] 发送多少次(-1 = 永久): ')
while len(times) == 0:
times = input('[*] 发送多少次(-1 = 永久): ')
times = int(times)
loop = 0
cmd.start()
while loop == 0:
try:
with smtplib.SMTP('smtp.gmail.com', '587') as smtpserver:
done = False
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo()
smtpserver.login(fromaddrs, apppass)
if times >= 0:
for i in range(times):
th = threading.Thread(target=animate)
th.start()
smtpserver.sendmail(fromaddrs, toaddrs, message)
print(f'\r[*] 发送了 {i}')
elif times == -1:
i = -1
while True:
i += 1
th = threading.Thread(target=animate)
th.start()
smtpserver.sendmail(fromaddrs, toaddrs, message)
print('\r[*] 发送了', i)
except smtplib.SMTPSenderRefused:
print('\n[警告] 服务器 拒绝了发送请求(SMTPSenderRefused), 20秒后重试')
done = True
print('[*] 等待中')
time.sleep(20)
loop = 1
except smtplib.SMTPServerDisconnected:
print('\n[警告] 服务器 断开了发送请求的连接(SMTPServerDisconnected), 正在重试')
print('[*] 等待中')
time.sleep(1)
loop = 1
except KeyboardInterrupt:
print('\n[*] KeyboardInterrupt')
done = True
sys.exit()
exit()
except smtplib.SMTPDataError:
print('\n[错误] 数据异常(SMTPDataError) 或 服务商 拒绝了发送请求, 即将重试')
print('[*] 等待中')
time.sleep(1)
loop = 1
while loop == 1:
while True:
try:
with smtplib.SMTP('smtp.gmail.com', '587') as smtpserver:
loop = 0
done = False
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo()
smtpserver.login(fromaddrs, apppass)
if times >= 0:
for i in range(times):
th = threading.Thread(target=animate)
th.start()
smtpserver.sendmail(fromaddrs, toaddrs, message)
print(f'\r[*] 发送了 {i}')
elif times == -1:
i = -1
while True:
i += 1
th = threading.Thread(target=animate)
th.start()
smtpserver.sendmail(fromaddrs, toaddrs, message)
print(f'\r[*] 发送了 {i}')
if might_limit >= 150:
print('[警告] 你可能已经到达每天发送限制的极限了')
print('[警告] 你可能已经到达每天发送限制的极限了')
print('[警告] 你可能已经到达每天发送限制的极限了')
except smtplib.SMTPSenderRefused:
print('\n[警告] 服务器 拒绝了发送请求(SMTPSenderRefused), 20秒后重试')
done = True
print('[*] 等待中')
time.sleep(20)
done = False
loop = 1
except smtplib.SMTPServerDisconnected:
print('\n[警告] 服务器 断开了发送请求的连接(SMTPServerDisconnected), 正在重试')
print('[*] 等待中')
done = True
cmd.start()
time.sleep(1)
done = False
loop = 1
except KeyboardInterrupt:
print('\n[*] KeyboardInterrupt')
done = True
sys.exit()
except smtplib.SMTPDataError:
print('\n[错误] 数据异常(SMTPDataError) 或 服务器 拒绝了发送请求, 即将重试')
done = True
might_limit = 0
might_limit += 1
print('[*] 等待中')
time.sleep(1)
done = False
loop = 1
done = True
sys.exit()
exit()
# Gmail Spammer script ends