mirror of
https://github.com/rscmbbng/Border-Check.git
synced 2024-12-28 23:01:34 +01:00
added a regex for filtering local ip address ranges
This commit is contained in:
parent
37cfd8dcaf
commit
59a6d8ab2a
6
main.py
6
main.py
@ -352,7 +352,8 @@ class bc(object):
|
|||||||
except:
|
except:
|
||||||
print "Error: Browser is not responding correctly.\n"
|
print "Error: Browser is not responding correctly.\n"
|
||||||
# run traceroutes
|
# run traceroutes
|
||||||
if self.url[0] == 'http://127.0.0.1:8080/':
|
match_ip = self.url[0].strip('http://').strip(':8080')
|
||||||
|
if re.match(r'^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^192.168\.\d{1,3}$', match_ip) or re.match(r'^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}$', match_ip):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
traces = self.try_running(self.traces, "\nInternal error tracerouting.")
|
traces = self.try_running(self.traces, "\nInternal error tracerouting.")
|
||||||
@ -362,8 +363,9 @@ class bc(object):
|
|||||||
while True:
|
while True:
|
||||||
url = urlparse(self.getURL()).netloc
|
url = urlparse(self.getURL()).netloc
|
||||||
url = url.replace('www.','')
|
url = url.replace('www.','')
|
||||||
|
match_ip = url.strip('http://').strip(':8080')
|
||||||
if url != self.old_url:
|
if url != self.old_url:
|
||||||
if self.url[0] == 'http://127.0.0.1:8080/':
|
if re.match(r'^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^192.168\.\d{1,3}$', match_ip) or re.match(r'^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}$', match_ip):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
traces = self.try_running(self.traces, "\nInternal error tracerouting.")
|
traces = self.try_running(self.traces, "\nInternal error tracerouting.")
|
||||||
|
Loading…
Reference in New Issue
Block a user