proxytools

- collection of scripts for harvesting & testing proxies
git clone git://git.acid.vegas/proxytools.git
Log | Files | Refs | Archive | README | LICENSE

commit f157bc9e2d2256059758b82fc4cfea435a4a3f30
parent d6f1aa65d7052538aa38052c5cf4eabc1dd12c8a
Author: acidvegas <acid.vegas@acid.vegas>
Date: Sat, 10 Jun 2023 15:22:35 -0400

Updated previews & improved sockhub duplicate handling

Diffstat:
M.screens/sockhub.png | 0
Mproxytools/sockhub.py | 78++++++++++++++++++++++++++++++++++++++++++------------------------------------

2 files changed, 42 insertions(+), 36 deletions(-)

diff --git a/.screens/sockhub.png b/.screens/sockhub.png
Binary files differ.
diff --git a/proxytools/sockhub.py b/proxytools/sockhub.py
@@ -6,26 +6,40 @@ import re
 import time
 import urllib.request
 
-github_list = (
-	'https://raw.githubusercontent.com/officialputuid/KangProxy/KangProxy/socks5/socks5.txt',
+urls = set((
+	'https://raw.githubusercontent.com/ALIILAPRO/Proxy/main/socks5.txt',
+	'https://raw.githubusercontent.com/B4RC0DE-TM/proxy-list/main/SOCKS5.txt',
 	'https://raw.githubusercontent.com/hookzof/socks5_list/master/proxy.txt',
+	'https://raw.githubusercontent.com/HyperBeats/proxy-list/main/socks5.txt',
+	'https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks5.txt',
+	'https://raw.githubusercontent.com/manuGMG/proxy-365/main/SOCKS5.txt',
+	'https://raw.githubusercontent.com/mmpx12/proxy-list/master/socks5.txt',
 	'https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/socks5.txt',
-	'https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS5_RAW.txt',
+	'https://raw.githubusercontent.com/monosans/proxy-list/main/proxies_anonymous/socks5.txt',
 	'https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/socks5.txt',
-	'https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt',
-    'https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks5.txt',
-    'https://raw.githubusercontent.com/UptimerBot/proxy-list/main/proxies/socks5.txt',
-    'https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks5.txt',
-    'https://raw.githubusercontent.com/saschazesiger/Free-Proxies/master/proxies/socks5.txt',
+	'https://raw.githubusercontent.com/officialputuid/KangProxy/KangProxy/socks5/socks5.txt',
 	'https://raw.githubusercontent.com/prxchk/proxy-list/main/socks5.txt',
+	'https://raw.githubusercontent.com/rdavydov/proxy-list/main/proxies/socks5.txt',
+	'https://raw.githubusercontent.com/rdavydov/proxy-list/main/proxies_anonymous/socks5.txt',
+	'https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS5_RAW.txt',
+	'https://raw.githubusercontent.com/saschazesiger/Free-Proxies/master/proxies/socks5.txt',
+	'https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks5.txt',
+	'https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt',
+	'https://raw.githubusercontent.com/UptimerBot/proxy-list/main/proxies/socks5.txt',
 	'https://raw.githubusercontent.com/Zaeem20/FREE_PROXIES_LIST/master/socks5.txt',
+	'https://raw.githubusercontent.com/zevtyardt/proxy-list/main/socks5.txt',
+	'https://api.openproxylist.xyz/socks5.txt',
+	'https://api.proxyscrape.com/?request=displayproxies&proxytype=socks5',
+	'https://api.proxyscrape.com/v2/?request=displayproxies&protocol=socks5',
+	'https://proxyscan.io/download?type=socks5',
+	'https://proxyspace.pro/socks5.txt',
 	'https://spys.me/socks.txt'
-)
+))
 
 def get_source(url):
 	req = urllib.request.Request(url)
 	req.add_header('User-Agent', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)')
-	source  = urllib.request.urlopen(req, timeout=5)
+	source  = urllib.request.urlopen(req, timeout=10)
 	return source.read().decode()
 
 # Main
@@ -36,37 +50,29 @@ print('#{0}#'.format('Developed by acidvegas in Python'.center(54)))
 print('#{0}#'.format('https://git.acid.vegas/proxytools'.center(54)))
 print('#{0}#'.format(''.center(54)))
 print('#'*56)
-bad_urls   = list()
-dupes      = 0
+total = 0
+proxies = list()
 proxy_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'proxies.txt')
-proxy_list = list()
-set(github_list)
-print('scanning \033[35m{0:,}\033[0m urls from list...'.format(len(github_list)))
-for url in github_list:
+print('scanning \033[35m{0:,}\033[0m urls from list...'.format(len(urls)))
+for url in urls:
 	try:
 		source = get_source(url)
-		found = re.findall('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+', source, re.MULTILINE)
+	except:
+		print('found \033[31m0\033[0m new proxies on \033[34m{0}\033[0m \033[30m(failed to load)\033[0m'.format(url))
+	else:
+		total+= len(source.split())
+		found = set([proxy for proxy in re.findall('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+', source, re.MULTILINE) if proxy not in proxies])
 		if found:
-			print('found \033[93m{0:,}\033[0m proxies on \033[34m{1}\033[0m'.format(len(found), url))
-			for proxy in found:
-				if proxy not in proxy_list:
-					proxy_list.append(proxy)
-				else:
-					dupes += 1
+			proxies += found
+			print('found \033[32m{0:,}\033[0m new proxies on \033[34m{1}\033[0m'.format(len(found), url))
 		else:
-			print('no proxies found on ' + url)
-	except:
-		bad_urls.append(url)
-if bad_urls:
-	print('failed to load {0:,} urls'.format(len(bad_urls)))
-	for url in bad_urls:
-		print('failed to load ' + url)
-if proxy_list:
-	if dupes:
-		print('found \033[32m{0:,}\033[0m total proxies! \033[30m({1:,} duplicates removed)\033[0m'.format(len(proxy_list), dupes))
+			print('found \033[31m0\033[0m new proxies on \033[34m{0}\033[0m \033[30m(duplicates)\033[0m'.format(url))
+if proxies:
+	if len(proxies) < total:
+		print('found \033[32m{0:,}\033[0m total proxies! \033[30m({1:,} duplicates removed)\033[0m'.format(len(proxies), total-len(proxies)))
 	else:
-		print('found \033[32m{0:,}\033[0m total proxies!'.format(len(proxy_list)))
-	proxy_list.sort()
+		print('found \033[32m{0:,}\033[0m total proxies!'.format(len(proxies)))
+	proxies.sort()
 	with open (proxy_file, 'w') as proxy__file:
-		for proxy in proxy_list:
+		for proxy in proxies:
 			proxy__file.write(proxy + '\n')
 \ No newline at end of file