-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathchecker.py
101 lines (86 loc) · 4.39 KB
/
checker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import logging
import requests
from concurrent.futures import ThreadPoolExecutor, as_completed
import time
import random
banner = """
==================================================================
█████╗ ██╗██████╗ ██████╗ ██████╗ ██████╗ ██████╗
██╔══██╗██║██╔══██╗██╔══██╗██╔══██╗██╔═══██╗██╔══██╗
███████║██║██████╔╝██║ ██║██████╔╝██║ ██║██████╔╝
██╔══██║██║██╔══██╗██║ ██║██╔══██╗██║ ██║██╔═══╝
██║ ██║██║██║ ██║██████╔╝██║ ██║╚██████╔╝██║
╚═╝ ╚═╝╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
██╗███╗ ██╗███████╗██╗██████╗ ███████╗██████╗
██║████╗ ██║██╔════╝██║██╔══██╗██╔════╝██╔══██╗
██║██╔██╗ ██║███████╗██║██║ ██║█████╗ ██████╔╝
██║██║╚██╗██║╚════██║██║██║ ██║██╔══╝ ██╔══██╗
██║██║ ╚████║███████║██║██████╔╝███████╗██║ ██║
╚═╝╚═╝ ╚═══╝╚══════╝╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝
Join our Telegram channel for the latest updates: t.me/airdropinsiderid
GRADIENT ACTIVE PROXY CHECKER - Airdrop Insider
==================================================================
"""
print(banner)
time.sleep(1)
# Logger configuration
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(message)s")
logger = logging.getLogger()
# Load proxies from file
PROXY_FILE = "proxies.txt"
ACTIVE_PROXY_FILE = "checked_proxies.txt"
def load_proxies(file_path):
"""Load proxies from a file."""
with open(file_path, "r") as f:
proxies = [line.strip() for line in f if line.strip()]
return proxies
def save_active_proxies(proxies):
"""Save active proxies to a file."""
with open(ACTIVE_PROXY_FILE, "w") as f:
f.writelines(f"{proxy}\n" for proxy in proxies)
def check_proxy(proxy):
"""Check if a proxy can connect to a target URL."""
target_url = "https://app.gradient.network/"
try:
response = requests.get(
target_url,
proxies={"http": proxy, "https": proxy},
timeout=10
)
if response.status_code == 200:
logger.info(f"Proxy {proxy} is active")
return proxy
except Exception as e:
logger.warning(f"Proxy {proxy} failed: {e}")
return None
def run_proxy_checker(proxies):
"""Run proxy checker for a list of proxies."""
logger.info("Starting proxy checker...")
active_proxies = []
with ThreadPoolExecutor(max_workers=10) as executor: # Atur jumlah thread sesuai kebutuhan
futures = {executor.submit(check_proxy, proxy): proxy for proxy in proxies}
for future in as_completed(futures):
result = future.result()
if result:
active_proxies.append(result)
logger.info(f"Active proxies found: {len(active_proxies)}")
return active_proxies
def main():
"""Main function to run proxy checker and execute bot tasks."""
# Load proxies
proxies = load_proxies(PROXY_FILE)
if not proxies:
logger.error(f"No proxies found in {PROXY_FILE}")
return
# Check proxies
active_proxies = run_proxy_checker(proxies)
if not active_proxies:
logger.error("No active proxies found. Exiting...")
return
# Save active proxies
save_active_proxies(active_proxies)
logger.info(f"Active proxies saved to {ACTIVE_PROXY_FILE}")
# Run main bot with active proxies
logger.info("Starting bot execution with active proxies...")
if __name__ == "__main__":
main()