RE: Proxy Checker (Python script) - m0dem - 03-24-2016
(03-24-2016, 02:26 PM)Inori Wrote: Bah, damn you, I was about to submit a pull request, but then you added the library 
Beat you to it.
RE: Proxy Checker (Python script) - fsociety - 05-05-2019
(03-18-2016, 01:01 AM)m0dem Wrote: I was bored, so I made this Python script that reads a list of proxies from a file and then writes all the still-working proxies to an out file.
Code: from Queue import Queue
from threading import Thread
import argparse
import requests
import sys
import time
def process_proxy():
try:
while True:
proxy = queue.get()
if proxy == "STOP":
return
save_valid_proxy(check_proxy(proxy))
queue.task_done()
except:
pass
def check_proxy(proxy, timeout = 5, url = "https://google.com"):
proxies = {
"http": "http://" + proxy,
"https": "https://" + proxy
}
try:
r = requests.get(url, proxies = proxies, timeout = timeout)
except IOError:
return False
return proxy
def save_valid_proxy(proxy):
if proxy:
OUT_F.write(proxy + "\n")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description = "Check a proxy list for working proxies.")
parser.add_argument("infile", help = "The proxy list file.")
parser.add_argument("outfile", help = "The output file.")
parser.add_argument("-t", "--threads", type = int, help = "Set the number of threads running concurrently.")
parser.add_argument("-v", "--verbose", action = "store_true", help = "Be verbose?")
args = parser.parse_args()
IN_F = open(args.infile, "r")
OUT_F = open(args.outfile, "w")
# number of threads running at once
if args.threads:
concurrent_threads = args.threads
else:
concurrent_threads = 250
if args.verbose:
print("Loading proxy list from: {}".format(args.infile))
print("Saving valid proxies list to: {}".format(args.outfile))
print("Running: {} threads...".format(concurrent_threads))
queue = Queue(concurrent_threads * 2)
for i in range(0, concurrent_threads):
thread = Thread(target = process_proxy)
thread.setDaemon(True)
thread.start()
start = time.time()
try:
for proxy in IN_F:
queue.put(proxy.strip())
# queue.join()
except KeyboardInterrupt:
pass
print("Closing down, please wait. ({} seconds run time)".format(time.time() - start))
queue.put("STOP")
IN_F.close()
OUT_F.close()
sys.exit()
Example usage:
Code: proxy_checker.py proxylist.txt validproxies.txt --threads 500
If you liked or found this useful, please comment. 
i request to bring the source of account checker python i will be very happy from you.
RE: Proxy Checker (Python script) - Drako - 05-05-2019
(05-05-2019, 02:49 PM)fsociety Wrote: (03-18-2016, 01:01 AM)m0dem Wrote: I was bored, so I made this Python script that reads a list of proxies from a file and then writes all the still-working proxies to an out file.
Code: from Queue import Queue
from threading import Thread
import argparse
import requests
import sys
import time
def process_proxy():
try:
while True:
proxy = queue.get()
if proxy == "STOP":
return
save_valid_proxy(check_proxy(proxy))
queue.task_done()
except:
pass
def check_proxy(proxy, timeout = 5, url = "https://google.com"):
proxies = {
"http": "http://" + proxy,
"https": "https://" + proxy
}
try:
r = requests.get(url, proxies = proxies, timeout = timeout)
except IOError:
return False
return proxy
def save_valid_proxy(proxy):
if proxy:
OUT_F.write(proxy + "\n")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description = "Check a proxy list for working proxies.")
parser.add_argument("infile", help = "The proxy list file.")
parser.add_argument("outfile", help = "The output file.")
parser.add_argument("-t", "--threads", type = int, help = "Set the number of threads running concurrently.")
parser.add_argument("-v", "--verbose", action = "store_true", help = "Be verbose?")
args = parser.parse_args()
IN_F = open(args.infile, "r")
OUT_F = open(args.outfile, "w")
# number of threads running at once
if args.threads:
concurrent_threads = args.threads
else:
concurrent_threads = 250
if args.verbose:
print("Loading proxy list from: {}".format(args.infile))
print("Saving valid proxies list to: {}".format(args.outfile))
print("Running: {} threads...".format(concurrent_threads))
queue = Queue(concurrent_threads * 2)
for i in range(0, concurrent_threads):
thread = Thread(target = process_proxy)
thread.setDaemon(True)
thread.start()
start = time.time()
try:
for proxy in IN_F:
queue.put(proxy.strip())
# queue.join()
except KeyboardInterrupt:
pass
print("Closing down, please wait. ({} seconds run time)".format(time.time() - start))
queue.put("STOP")
IN_F.close()
OUT_F.close()
sys.exit()
Example usage:
Code: proxy_checker.py proxylist.txt validproxies.txt --threads 500
If you liked or found this useful, please comment. 
i request to bring the source of account checker python i will be very happy from you.
There's a bit of a problem here, the last post on this thread was 3 years ago. Just try not to gravedig threads that are old, unless you have some groundbreaking information. About the tool, it wont be any use to me because I already have a bunch of good proxy checkers. I'm sure someone will test it though.
|