From f9ae36bdf67e787bdfcd39463cd62de0918fdec2 Mon Sep 17 00:00:00 2001 From: Normand Cyr <normand.cyr@gmail.com> Date: Wed, 26 Jul 2017 16:32:55 -0400 Subject: [PATCH] add LAN and WAN IP addresses info --- archey | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/archey b/archey index c6d8231..9023a1b 100644 --- a/archey +++ b/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 -------------- #