Skip to content

Commit c15b8c8

Browse files
committed
Update 1.2.1 By Lucky
1 parent 17280e6 commit c15b8c8

File tree

5 files changed

+276
-11
lines changed

5 files changed

+276
-11
lines changed

tools/proxy.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import requests, random, threading as th
22
from bs4 import BeautifulSoup as BS
3-
from fake_useragent import UserAgent as UA
43
from progress.bar import ChargingBar
4+
from tools.user_agents import r_ua
55

66
def SPC(ip, port, login=None, password=None):
7-
ua = UA().random
7+
ua = r_ua()
88
ipp = ip + ':' + port
99
proxy_http = {'http': 'http://' + ipp}
1010

@@ -146,7 +146,7 @@ def get(self):
146146
bar = ChargingBar('Парсинг', max = len(pr_b))
147147

148148
# User-Agent
149-
ua = UA()
149+
ua = r_ua()
150150

151151
# Summary sheet with proxy
152152
itog = {}
@@ -161,7 +161,7 @@ def get(self):
161161
for ct in url_list:
162162
can = False
163163
try:
164-
response = requests.get(url_list[ct], headers={"User-Agent": ua.random}, timeout=self.timeout)
164+
response = requests.get(url_list[ct], headers={"User-Agent": ua}, timeout=self.timeout)
165165
can = True
166166
except:
167167
pass
@@ -193,7 +193,7 @@ def get(self):
193193
# -----------------------------------------------
194194
can = False
195195
try:
196-
response = requests.get("https://www.sslproxies.org", headers={"User-Agent": ua.random}, timeout=self.timeout)
196+
response = requests.get("https://www.sslproxies.org", headers={"User-Agent": ua}, timeout=self.timeout)
197197
can = True
198198
except:
199199
pass
@@ -230,7 +230,7 @@ def get(self):
230230
if self.unknown == True:
231231
can = False
232232
try:
233-
response = requests.get("https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=5000&country=all&ssl=all&anonymity=all", headers={"User-Agent": ua.random}, timeout=self.timeout)
233+
response = requests.get("https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=5000&country=all&ssl=all&anonymity=all", headers={"User-Agent": ua}, timeout=self.timeout)
234234
can = True
235235
except:
236236
pass
@@ -254,7 +254,7 @@ def get(self):
254254
col_page = 1
255255
can = False
256256
try:
257-
result = requests.get("https://proxylist.geonode.com/api/proxy-list?limit=50&page=1&sort_by=lastChecked&sort_type=desc&speed=medium&protocols=http%2Chttps", headers={"User-Agent": ua.random}, timeout=self.timeout)
257+
result = requests.get("https://proxylist.geonode.com/api/proxy-list?limit=50&page=1&sort_by=lastChecked&sort_type=desc&speed=medium&protocols=http%2Chttps", headers={"User-Agent": ua}, timeout=self.timeout)
258258
can = True
259259
except:
260260
pass
@@ -269,7 +269,7 @@ def get(self):
269269
i = 1
270270
while i < col_page:
271271
try:
272-
response = requests.get(f"https://proxylist.geonode.com/api/proxy-list?limit=50&page={i}&sort_by=lastChecked&sort_type=desc&speed=medium&protocols=http%2Chttps", headers={"User-Agent": ua.random}, timeout=15)
272+
response = requests.get(f"https://proxylist.geonode.com/api/proxy-list?limit=50&page={i}&sort_by=lastChecked&sort_type=desc&speed=medium&protocols=http%2Chttps", headers={"User-Agent": ua}, timeout=15)
273273
if response.status_code == 200:
274274
for pr in response.json()["data"]:
275275
ip = pr["ip"]

tools/sender.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import time
33
import requests
44
from bs4 import BeautifulSoup
5-
from fake_useragent import UserAgent
5+
from tools.user_agents import r_ua
66

77
# services list
88
services_list = []
@@ -196,7 +196,7 @@ def spam(self, service, phone, proxy=None):
196196
url = service["url"]
197197

198198
# generate headers
199-
ua = UserAgent().random
199+
ua = r_ua()
200200
try:
201201
service["headers"]["User-Agent"] = ua
202202
headers = service["headers"]
@@ -254,5 +254,7 @@ def spam(self, service, phone, proxy=None):
254254
return 200, r.text
255255
else:
256256
return r.status_code, r.text
257+
except KeyboardInterrupt:
258+
return False, "keyboard"
257259
except Exception as e:
258260
return False, e # https://t.me/orion_bomber

tools/tools.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,9 @@ def start(number, country, proxy_=None):
638638
if sender_class.checktimeout(serv) == True:
639639
if proxy_ != None:
640640
result = sender_class.spam(serv, number, proxy=proxy_["format"])
641+
if result[1] == "keyboard":
642+
raise KeyboardInterrupt
643+
641644
if result[0] == False:
642645
logs.save_logs(serv, result[0], error=str(result[1]))
643646
else:
@@ -763,6 +766,9 @@ def start(number, country, proxy_=None):
763766
FormattingResponse(666, serv)
764767
else:
765768
result = sender_class.spam(serv, number)
769+
if result[1] == "keyboard":
770+
raise KeyboardInterrupt
771+
766772
if result[0] == False:
767773
logs.save_logs(serv, result[0], error=str(result[1]))
768774
else:

0 commit comments

Comments
 (0)