Skip to content

Instantly share code, notes, and snippets.

@8dcc
Created July 27, 2021 21:21
Show Gist options
  • Save 8dcc/9a80ff8f55f840230ee6322c749da0ba to your computer and use it in GitHub Desktop.
Save 8dcc/9a80ff8f55f840230ee6322c749da0ba to your computer and use it in GitHub Desktop.
Function for checking proxies
# import time, sys
# from colorama import Fore, Style
def check_proxies():
try:
old_ip = ""
requests.get("https://api.ipify.org/", proxies=proxies)
sys.stdout.write(f"\r {Fore.WHITE}Checking the proxies {Style.BRIGHT}[")
for n in range(number_of_proxy_checks):
ip_request = requests.get("https://api.ipify.org/", proxies=proxies)
new_ip = ip_request.text
print(ip_request.text)
if new_ip == old_ip:
sys.stdout.write(f"{Fore.RED}•")
else:
sys.stdout.write(f"{Fore.GREEN}•")
checking_failed = True
old_ip = new_ip
time.sleep(0.1)
sys.stdout.write(f"{Fore.WHITE}]{Style.RESET_ALL}")
if checking_failed:
exit(f" {Style.RESET_ALL}{Fore.RED}[!] We could not verify the proxies. Make sure tor is running.{Style.RESET_ALL}")
except Exception:
exit(f" {Style.RESET_ALL}{Fore.RED}[!] We could not verify the proxies. Make sure tor is running.{Style.RESET_ALL}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment