get rid of ipcalc
This commit is contained in:
8
ppf.py
8
ppf.py
@@ -6,7 +6,6 @@ import random, time
|
|||||||
import re
|
import re
|
||||||
import urllib
|
import urllib
|
||||||
import hashlib
|
import hashlib
|
||||||
import ipcalc
|
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import SafeConfigParser
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
@@ -108,6 +107,11 @@ def proxyfind(sqlite = None):
|
|||||||
|
|
||||||
sqlite.commit()
|
sqlite.commit()
|
||||||
|
|
||||||
|
def is_usable_ipv4(ip):
|
||||||
|
if ( ip.startswith("10.") or ip.startswith("192.168.") or ip.startswith("127.") or ip.startswith("0.")) or \
|
||||||
|
(ip.startswith("172.") and (int(ip.split(".")[1]) >= 16 and int(ip.split(".")[1]) <= 31)): return True
|
||||||
|
return False
|
||||||
|
|
||||||
def proxyleech(sqlite, rows):
|
def proxyleech(sqlite, rows):
|
||||||
#print('entering proxyleech...')
|
#print('entering proxyleech...')
|
||||||
|
|
||||||
@@ -119,7 +123,7 @@ def proxyleech(sqlite, rows):
|
|||||||
for p in sorted(re.findall(r'[0-9]+(?:\.[0-9]+){3}:[0-9]+', cleanhtml(content))):
|
for p in sorted(re.findall(r'[0-9]+(?:\.[0-9]+){3}:[0-9]+', cleanhtml(content))):
|
||||||
if p in uniques: continue
|
if p in uniques: continue
|
||||||
try:
|
try:
|
||||||
if str(ipcalc.Network(p.split(':')[0]).subnet) != 'PRIVATE': uniques.append(p)
|
if not is_usable_ipv4(p.split(':')[0]): uniques.append(p)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user