diff --git a/proxyChecker.py b/proxyChecker.py index 12e2393..a9056b9 100644 --- a/proxyChecker.py +++ b/proxyChecker.py @@ -1,12 +1,13 @@ import argparse import random import re +import socket import threading import urllib.request -import socks -import socket from time import time +import socks + user_agents = [] with open("user_agents.txt", "r") as f: for line in f: @@ -25,7 +26,8 @@ def is_valid(self): def check(self, site, timeout, user_agent, verbose): if self.method in ["socks4", "socks5"]: - socks.set_default_proxy(socks.SOCKS4 if self.method == "socks4" else socks.SOCKS5, self.proxy.split(':')[0], int(self.proxy.split(':')[1])) + socks.set_default_proxy(socks.SOCKS4 if self.method == "socks4" else socks.SOCKS5, + self.proxy.split(':')[0], int(self.proxy.split(':')[1])) socket.socket = socks.socksocket try: start_time = time() @@ -131,4 +133,4 @@ def check_proxy(proxy, user_agent): ) args = parser.parse_args() check(file=args.list, timeout=args.timeout, method=args.proxy, site=args.site, verbose=args.verbose, - random_user_agent=args.random_agent) \ No newline at end of file + random_user_agent=args.random_agent)