summaryrefslogtreecommitdiff
path: root/main.py
blob: 30871611169c80a8ad63e70daab998cc5cb3e465 (plain)
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
205
206
207
208
209
210
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 + '] Attacking')
        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('[*] waiting for 20 seconds')
            print('[*] waiting')
            time.sleep(20)
            print('[*] succeed')
        elif command == 'restart':
            print('[*] restarting')
            done = True
            time.sleep(5)
            done = False
            print('[*] restart succeed')
        elif command == 'timeout':
            done = True
            print('[*] waiting for 5 seconds')
            print('[*] waiting')
            time.sleep(5)
            print('[*] succeed')
        elif command == 'timeout_10':
            print('[*] waiting for 10 seconds')
            print('[*] waiting')
            time.sleep(10)
            print('[*] succeed')
        elif command == 'timeout_5':
            done = True
            print('[*] waiting for 5 seconds')
            print('[*] waiting')
            time.sleep(5)
            print('[*] succeed')
        elif command == 'help':
            print('[*] Commands:\ntimeout\ntimeout_5\ntimeout_10\ntimeout_20\nexit\nquit\nrestart')
        elif command == 'h':
            print('[*] Commands:\ntimeout\ntimeout_5\ntimeout_10\ntimeout_20\nexit\nquit\nrestart')
        else:
            print('[*] Unknown Command type help to get a list of commands')
cmd = threading.Thread(target=command)
        
me = sys.argv

fromaddrs = input(str('[*] Enter you gmail address: '))
while len(fromaddrs) == 0:
    fromaddrs = input(str('[*] Enter you gmail address: '))

    
toaddrs = input(str('[*] Enter the gmail address that you want to spam: '))
while len(toaddrs) == 0:
    toaddrs = input(str('[*] Enter the gmail address that you want to spam: '))

    
message = input(str('[*] Enter the message that you are going to spam: '))
while len(message) == 0:
    message = input(str('[*] Enter the message that you are going to spam: '))

apppass = input(str('[*] Enter your application password(https://support.google.com/accounts/answer/185833?hl=en): '))
while len(apppass) == 0:
    apppass = input(str('[*] Enter your application password(https://support.google.com/accounts/answer/185833?hl=en): '))


times = input('[*] How many time you want to spam(-1 = forever): ')
while len(times) == 0:
    times = input('[*] How many time you want to spam(-1 = forever): ') 
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[*] Spamed {i} times')


            elif times == -1:
                i = -1
                while True:
                    i += 1
                    th = threading.Thread(target=animate)
                    th.start()
                    smtpserver.sendmail(fromaddrs, toaddrs, message)
                    print(f'\r[*] Spamed {i}')


    except smtplib.SMTPSenderRefused:
        print('\n[Warning] Server Rejected to sent gmail(attempt to block spam)(SMTPSenderRefused), Retrying in next 20 seconds')
        done = True
        print('[*] Waiting')
        time.sleep(20)
        loop = 1
    except smtplib.SMTPServerDisconnected:
        print('\n[Warning] Server Disconnected our reqest(SMTPServerDisconnected), Retrying')
        print('[*] Waiting')
        time.sleep(1)
        loop = 1
    except KeyboardInterrupt:
        print('\n[*] KeyboardInterrupt')
        done = True
        sys.exit()
        exit()
    except smtplib.SMTPDataError:
        print('\n[ERROR] Sending Error Data(SMTPDataError) or Server is attempting to block spam, Retrying')
        print('[*] Waiting')
        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[*] Spamed {i}')
                        break


                    elif times == -1:
                        i = -1
                        while True:
                            i += 1
                            th = threading.Thread(target=animate)
                            th.start()
                            smtpserver.sendmail(fromaddrs, toaddrs, message)
                            print('\r[*] Spamed', i)
                    if might_limit >= 150:
                        print('[Warning] You might rate the daily limit of SMTP gmail sender')
                        print('[Warning] You might rate the daily limit of SMTP gmail sender')
                        print('[Warning] You might rate the daily limit of SMTP gmail sender')


            except smtplib.SMTPSenderRefused:
                print('\n[Warning] Server Rejected to sent gmail(attempt to block spam)(SMTPSenderRefused), Retrying in next 20 seconds')
                done = True
                print('[*] Waiting')
                time.sleep(20)
                done = False
                loop = 1
            except smtplib.SMTPServerDisconnected:
                print('\n[Warning] Server Disconnected our reqest(SMTPServerDisconnected), Retrying')
                print('[*] Waiting')
                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[ERROR] Sending Error Data(SMTPDataError) or Server is attempting to block spam, Retrying')
                done = True
                might_limit = 0
                might_limit += 1
                print('[*] Waiting')
                time.sleep(1)
                done = False
                loop = 1

                
                    
done = True
sys.exit()
exit()

# Gmail Spammer script ends