-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstart.py
225 lines (189 loc) · 7.98 KB
/
start.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
"""
╔═════════════════════════════════════════════════════════════════════════════════╗
║ ║
║ Free proxies and user agents ║
║ Author: ║
║ https://github.com/ebankoff ║
║ ║
║ The author of this program are not responsible for its use! ║
║ When placing this code on third-party resources, please indicate the author! ║
║ ║
║ All rights reserved. ║
║ Copyright (C) 2022 ebankoff ║
║ ║
╚═════════════════════════════════════════════════════════════════════════════════╝
"""
import os
import re
import bs4
import sys
import time
import json
import urllib
import socket
import ctypes
import requests
import colorama
import numpy as np
import pandas as pd
from sys import platform
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt
from unicodedata import normalize
from urllib.request import urlopen as uReq
from colorama import Fore, Back, Style, init
colorama.init()
if platform == 'win32':
os.system("cls")
else:
os.system("clear")
def ex():
param=input(Fore.WHITE + '\nExit? yes/no: ')
if param == 'yes':
if platform == 'win32':
os.system("cls")
else:
os.system("clear")
print(
' I would be grateful if you star on this repository on GitHub:',
'\n https://github.com/ebankoff/free-proxies-and-useragents',
'\n',
'\n You can support me by sending any amount to my Qiwi:',
'\n qiwi.com/n/HERAMANT',
'\n',
'\n Copyright (C) 2022 ebankoff')
print("\nPress Enter to exit")
input()
os.abort()
elif param == 'no':
if platform == 'win32':
os.system("cls")
else:
os.system("clear")
main()
else:
print(Fore.RED + '\n━━━━━━━━━━ERROR━━━━━━━━━━\n')
ex()
def validate_ip(ip):
a = ip.split('.')
if len(a) != 4:
return False
for x in a:
if not x.isdigit():
return False
i = int(x)
if i < 0 or i > 255:
return False
return True
def validate_port(port):
try:
if int(port)>=1 and int(port)<=65535:
return True
else:
return False
except:
return False
def main():
res = requests.get('https://free-proxy-list.net/', headers={'User-Agent':'Mozilla/5.0'})
soup = BeautifulSoup(res.text,"lxml")
cnt=0
ip=16
port=6
ct=20
print(Fore.RED + '█▀▀ █▀█ █▀▀ █▀▀ █▀█ █▀█ █▀█ ▀▄▀ █ █▀▀ █▀ ▄▀█ █▄ █ █▀▄ █ █ █▀ █▀▀ █▀█ ▄▀█ █▀▀ █▀▀ █▄ █ ▀█▀ █▀',
Fore.WHITE + '\n█▀ █▀▄ ██▄ ██▄ █▀▀ █▀▄ █▄█ █ █ █ ██▄ ▄█ █▀█ █ ▀█ █▄▀ █▄█ ▄█ ██▄ █▀▄ █▀█ █▄█ ██▄ █ ▀█ █ ▄█\n')
print(Fore.RED + "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
print(Fore.WHITE + " Created by ebankoff - https://github.com/ebankoff")
print(Fore.WHITE + " There could have been your ad here")
print(Fore.RED + "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
print(
Fore.RED + '\n[' + Fore.WHITE + '0' + Fore.RED + ']' + Fore.WHITE + ' Exit',
Fore.RED + '\n[' + Fore.WHITE + '1' + Fore.RED + ']' + Fore.WHITE + ' Search proxies',
Fore.RED + '\n[' + Fore.WHITE + '2' + Fore.RED + ']' + Fore.WHITE + ' Search user agents',
Fore.RED + '\n[' + Fore.WHITE + '3' + Fore.RED + ']' + Fore.WHITE + ' Print saved proxies',
Fore.RED + '\n[' + Fore.WHITE + '4' + Fore.RED + ']' + Fore.WHITE + ' Print saved user agents',
Fore.RED + '\n[' + Fore.WHITE + '5' + Fore.RED + ']' + Fore.WHITE + ' Delete saved proxies',
Fore.RED + '\n[' + Fore.WHITE + '6' + Fore.RED + ']' + Fore.WHITE + ' Delete saved user agents'
)
try:
ans = int(input('\n → '))
if ans == 0:
ex()
elif ans== 1:
res = requests.get('https://hidemy.name/ru/proxy-list', headers={'User-Agent':'Mozilla/5.0 (Linux; Android 11; SM-A326B Build/RP1A.200720.012) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/95.0.4638.74 Mobile Safari/537.36'})
soup = BeautifulSoup(res.text,"lxml")
with open(r"proxies.txt", "a", encoding="utf-8") as file:
for child in soup.recursiveChildGenerator():
if child.name=='td':
if validate_ip(child.text):
file.write(child.text)
file.write(':')
if validate_port(child.text):
file.write(child.text)
file.write('\n')
res2 = requests.get('https://free-proxy-list.net', headers={'User-Agent':'Mozilla/5.0 (Linux; Android 11; SM-A326B Build/RP1A.200720.012) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/95.0.4638.74 Mobile Safari/537.36'})
soup2 = BeautifulSoup(res2.text,"lxml")
cnt2=0
with open(r"proxies.txt", "a", encoding="utf-8") as file:
for child in soup2.recursiveChildGenerator():
if child.name=='td':
if cnt2 == 0:
if not validate_ip(child.text):
break
file.write(child.text)
file.write(':')
if cnt2 == 1:
file.write(child.text)
file.write('\n')
cnt2 = (cnt2 + 1) % 8
print(Fore.WHITE + "\nSuccess! File: proxies.txt")
ex()
elif ans == 2:
res = requests.get('https://useragents.ru/stable.html', headers={'User-Agent':'Mozilla/5.0'})
soup = BeautifulSoup(res.text,"lxml")
ans = soup.find("span", {"style": "color:#000000;font-family:Arial;font-size:13px;"})
ans2=str(ans)
ans3=""
ans4=""
for i in range(61, len(ans2)-1):
if(ans2[i]!='<' and ans2[i]!='>' and ans2[i]+ans2[i+1]!='br' and ans2[i]!='r' and ans2[i]!='/'):
ans3+=ans2[i]
if(ans2[i]=='"' or ans2[i]+ans2[i+1]=='br'):
ans3+='\n'
with open(r"useragents.txt", "a") as file:
file.write(ans3[:-4])
file.write('\n')
print(Fore.WHITE + "\nSuccess! File: useragents.txt")
ex()
elif ans == 3:
print("")
cnt = 1
with open(r"proxies.txt", "r") as file:
for line in file:
line = line.replace('\n', '')
print(Fore.RED + '[' + Fore.WHITE + str(cnt) + Fore.RED + '] ' + Fore.WHITE + line)
cnt += 1
ex()
elif ans == 4:
print("")
cnt = 1
with open(r"useragents.txt", "r") as file:
for line in file:
line = line.replace('\n', '')
print(Fore.RED + '[' + Fore.WHITE + str(cnt) + Fore.RED + '] ' + Fore.WHITE + line)
cnt += 1
ex()
elif ans == 5:
os.remove('proxies.txt')
elif ans == 6:
os.remove('useragents.txt')
else:
print(Fore.RED + '\n━━━━━━━━━━ERROR━━━━━━━━━━\n')
ex()
except:
print(Fore.RED + '\n━━━━━━━━━━ERROR━━━━━━━━━━\n')
ex()
if __name__=='__main__':
if platform == 'win32':
ctypes.windll.kernel32.SetConsoleTitleW("free proxies and useragents")
main()