modify and rename should_i_... function

> remove :port from D
> check if octets are within a correct range
This commit is contained in:
mickael
2019-01-09 19:01:55 +00:00
parent a74d6dfce8
commit 6f0d5c1ffa

17
ppf.py
View File

@@ -126,15 +126,16 @@ def proxyfind(sqlite = None):
sqlite.commit()
def should_i_append_this_item(ip):
octets = ip.split('.')
def is_usable_proxy(proxy):
octets = proxy.split(':')[0].split('.')
A = int(octets[0])
B = int(octets[1])
if (octets[0] < 1 or octets[0] > 254) or \
(octets[1] < 0 or octets[1] > 255) or \
(octets[2] < 0 or octets[2] > 255) or \
(octets[3] < 1 or octets[3] > 254): return False
if A == 10 or A == 127 or A == 0 or \
C = int(octets[2])
D = int(octets[3])
if (A < 1 or A > 254) or \
(B > 255 or C > 255 or D > 255) or \
(A == 10 or A == 127 or A == 0) or \
(A == 192 and B == 168) or \
(A == 172 and B >= 16 and B <= 31): return False
return True
@@ -153,7 +154,7 @@ def proxyleech(sqlite, rows):
uniques = []
for p in uniques_dict.keys():
if should_i_append_this_item(p): uniques.append(p)
if is_usable_proxy(p): uniques.append(p)
hash = hashlib.md5(''.join(uniques)).hexdigest()