ip address format control was added

This commit is contained in:
Volkan Şahin 2016-06-10 10:51:08 +03:00
parent 2eea107ccc
commit e430cfadb7
2 changed files with 2 additions and 3 deletions

View file

@ -342,7 +342,7 @@ class System:
for iface in psutil.net_io_counters(pernic=True):
f = os.popen('ifconfig {} | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1'.format(iface))
ip = str(f.read()).replace('\n', '')
if ip != '127.0.0.1':
if re.match(r'^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$', ip) and str(ip) != 'localhost' and str(ip) != '127.0.0.1':
arr.append(ip)
return arr
@ -456,4 +456,4 @@ class System:
def model():
return cpuinfo.get_cpu_info()['model']
"""
"""

View file

@ -218,4 +218,3 @@ class Util:
return False
except Exception as e:
return False