mirror of
https://github.com/HorlogeSkynet/archey4
synced 2025-05-03 04:00:15 +02:00
add LAN and WAN IP addresses info
This commit is contained in:
parent
280fdf8665
commit
f9ae36bdf6
12
archey
12
archey
@ -24,7 +24,7 @@ import re
|
||||
from enum import Enum
|
||||
from math import floor
|
||||
from os import getenv, getuid
|
||||
from subprocess import Popen, PIPE
|
||||
from subprocess import Popen, PIPE, check_output
|
||||
|
||||
|
||||
# -------------- Enumerations -------------- #
|
||||
@ -541,6 +541,14 @@ class Disk:
|
||||
|
||||
self.value = '{0}{1}{2} / {3}'.format(colorDict['sensors'][1 if usedpercent <= 33 else (0 if usedpercent >= 67 else 2)], re.sub('GB', ' GB', total[3]), colorDict['clear'], re.sub('GB', ' GB', total[2]))
|
||||
|
||||
class LANIP:
|
||||
def __init__(self):
|
||||
self.value = re.sub('[^\d\.]', '', str(check_output(['hostname', '-I'])).split(' ', 1)[0])
|
||||
|
||||
class WANIP:
|
||||
def __init__(self):
|
||||
self.value = re.sub('[^\d\.]', '', str(check_output(['dig', '+short', 'myip.opendns.com', '@resolver1.opendns.com'])))
|
||||
|
||||
|
||||
# -------------- Classes' Enumeration -------------- #
|
||||
|
||||
@ -560,6 +568,8 @@ class Classes(Enum):
|
||||
GPU = GPU
|
||||
RAM = RAM
|
||||
Disk = Disk
|
||||
LANIP = LANIP
|
||||
WANIP = WANIP
|
||||
|
||||
|
||||
# -------------- Main -------------- #
|
||||
|
Loading…
x
Reference in New Issue
Block a user