mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 14:42:22 +03:00
ip address format control was added
This commit is contained in:
parent
2eea107ccc
commit
e430cfadb7
2 changed files with 2 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -218,4 +218,3 @@ class Util:
|
|||
return False
|
||||
except Exception as e:
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in a new issue