|
|
@ -15,7 +15,7 @@ def verify_whitelist(ip):
|
|
|
|
|
|
|
|
|
|
|
|
# Check blacklist
|
|
|
|
# Check blacklist
|
|
|
|
for network in config.blacklist_cidr:
|
|
|
|
for network in config.blacklist_cidr:
|
|
|
|
if address in ipaddress.IPv4Network(network):
|
|
|
|
if address in ipaddress.ip_network(network):
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
if not config.use_whitelist:
|
|
|
|
if not config.use_whitelist:
|
|
|
@ -23,7 +23,7 @@ def verify_whitelist(ip):
|
|
|
|
|
|
|
|
|
|
|
|
# Check whitelist
|
|
|
|
# Check whitelist
|
|
|
|
for network in config.whitelist_cidr:
|
|
|
|
for network in config.whitelist_cidr:
|
|
|
|
if address in ipaddress.IPv4Network(network):
|
|
|
|
if address in ipaddress.ip_network(network):
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
return False
|
|
|
|
return False
|
|
|
@ -106,4 +106,4 @@ def build_url(request, path="/"):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
protocol = request.url.split('//')[0] if not config.force_https_links else "https:"
|
|
|
|
protocol = request.url.split('//')[0] if not config.force_https_links else "https:"
|
|
|
|
|
|
|
|
|
|
|
|
return protocol + "//" + domain + path
|
|
|
|
return protocol + "//" + domain + path
|
|
|
|