jeremivale14
Token Liquidity Expert
LEVEL 1
400 XP
Hello everyone, today im sharing with you all a piece of code i use on some of my programs to verify proxies to check if they are dead or not.
You can load a list here easily.
Code:
SOME LOVE IS APRECIATED!
I WILL ME RELEASING MORE TOOLS SOON
You can load a list here easily.
Code:
Code:
"""
Author: application
"""
import requests
import json
class ProxyChecker():
# Check if proxy is working
def checkProxy(self,ptype,proxyip):
if ptype == "https":
proxy = { "https": "https://"+proxyip }
elif ptype == "http":
proxy = { "https": "https://"+proxyip }
elif ptype == "socks5":
proxy = { "http": "socks5h://"+proxyip, "https": "socks5h://"+proxyip }
elif ptype == "socks4":
proxy = { "http": "socks4://"+proxyip, "https": "socks4://"+proxyip }
Session = requests.Session()
response = Session.get('https://google.com', proxies = proxy, timeout=5)
if response.status_code == 200:
return ptype
else:
return ""
# Validate proxy type
def verifyProxy(self,proxy):
proxy_type = "Invalid"
proxy = proxy.replace(" ","")
proxy = proxy.replace("\n","")
print("Verifying proxy: {}".format(proxy))
try:
proxy_type = self.checkProxy("socks5",proxy)
except:
try:
proxy_type = self.checkProxy("socks4",proxy)
except:
try:
proxy_type = self.checkProxy("https",proxy)
except:
try:
proxy_type = self.checkProxy("http",proxy)
except:
pass
if proxy_type != "Invalid":
print("Proxy {} is valid and it's type is {}".format(proxy,proxy_type))
else:
print("Proxy {} is dead or not responding.".format(proxy))
def checkList(self,file):
with open(file, 'r') as f:
for line in f:
self.verifyProxy(line)
checker = ProxyChecker()
checker.checkList("proxy.txt")
I WILL ME RELEASING MORE TOOLS SOON