diff --git a/proxytools/cleansocks.py b/proxytools/cleansocks.py
index 78b18bd..592d626 100644
--- a/proxytools/cleansocks.py
+++ b/proxytools/cleansocks.py
@@ -2,39 +2,35 @@
# CleanSocks - Developed by acidvegas in Python (https://git.acid.vegas/proxytools)
'''
-Requirements:
- PySocks (https://pypi.python.org/pypi/pysocks)
-This script will clean a list of proxies by removing duplicates, checking for valid formats (IP:PORT), and testing if the proxies are working
+This script will clean a list of proxies by removing duplicates, checking for valid formats (IP:PORT), & testing if the proxies are working
+
'''
import argparse
import concurrent.futures
import os
import re
-import sys
-sys.dont_write_bytecode = True
+# Globals
+good = list()
+print_bad = True
-def is_proxy(proxy):
- return re.match('^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):(?:6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$', proxy)
-
-def test_proxy(proxy):
- global good
+def check(proxy):
ip, port = proxy.split(':')
try:
sock = socks.socksocket()
sock.set_proxy(socks.SOCKS5, ip, int(port))
sock.settimeout(args.timeout)
- sock.connect(('www.google.com', 80))
+ sock.connect('www.google.com', 80)) # NOTE: use your own host instead in-case connections are blocked
except:
- print('BAD | ' + proxy)
+ if print_bad:
+ print('\033[1;31mBAD\033[0m \033[30m|\033[0m ' + proxy)
else:
- print('GOOD | ' + proxy)
+ print('\033[1;32mGOOD\033[0m \033[30m|\033[0m ' + proxy)
good.append(proxy)
- finally:
- sock.close()
+# Main
parser = argparse.ArgumentParser(usage='%(prog)s