local ip checking helper
This commit is contained in:
1 parent
2715dbaaa5
commit
3e28cd5c95
1 file changed
+5
@@ -106,6 +106,11 @@ def md5(text):
|
|||||||
def sha1(text):
|
def sha1(text):
|
||||||
return hashlib.sha1(text).hexdigest()
|
return hashlib.sha1(text).hexdigest()
|
||||||
|
|
||||||
|
def isLocalIP(ip):
|
||||||
|
ip = ip.lstrip('htps:/')
|
||||||
|
regex = '/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1)$/'
|
||||||
|
return re.search(regex, ip) is not None or 'localhost' in ip or ip[:4] == '127.'
|
||||||
|
|
||||||
def getExt(filename):
|
def getExt(filename):
|
||||||
return os.path.splitext(filename)[1][1:]
|
return os.path.splitext(filename)[1][1:]
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user