From eae313436c568e6bcab8c219dc38a8fa825269c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sat, 21 Aug 2021 21:02:04 -0500 Subject: Refactory network --- hyperterm/hyperterm.sha512 | 4 ++-- hyperterm/tools/network.sh | 5 +---- hyperterm/tools/sysinfo.sh | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/hyperterm/hyperterm.sha512 b/hyperterm/hyperterm.sha512 index 60faa5b..3a74beb 100644 --- a/hyperterm/hyperterm.sha512 +++ b/hyperterm/hyperterm.sha512 @@ -6,11 +6,11 @@ d02b066e31cd063596fa18e47fd1d5c1f1a19b96c08285b96c1991eb95ff52e9e5096e529540222b 73becd983f15d68b3c459adb4fe847bbbd6343519640aa5e03bb530e61a59ed0545dd3b3621ad82da378bbf15c4d9ee63984004d3bfed26d9d9df643f1524de5 ./tools/proxy.sh 24ee7d176c3ee9e7080e1cc87d02f709d95bfcaad098843ff2d7de5168f8c7559a5ac79fd0da2ce81233ecbcf0b4b776aa60b6603020698482f45b080289fc4c ./tools/aliases.sh ee1d6d1f9b010318985f7154c2a9173c8f2ab6b637cd3c8d2a9b403e83470e15a273dcff326a84f035660807d7cfcf04efe5abc0495e25ae7339b8807899cf0d ./tools/listuser.sh -dfbacc133d951ec7fe314b58273b6e1d67568435546af56de5c14651d3f198e5b3f387a4a81cd9ef53d47dd52fd7b32ef88c53eeeab3cda0ecfd382265b1c672 ./tools/sysinfo.sh +f70697086f001f690f9dc687d97a9a000f0a96ee6cd0b6ac33c407ffb467064d2ce2780852c5d980f2503d9e375487f34ab1b9e81c1d536f367e1914a0c5d399 ./tools/sysinfo.sh 1d26185a78a0a779af61cdf816f0644bbd328588800ead4dcf5475b0750704fd01755edcf12048791d23cb94afae8512ef587135ff049b84c5a5c0eb0d2209a6 ./tools/compress.sh fab9d339a99c7d2e1809d1c44f533523c6bfcdcc8d63c62b335ce7d4c666c8bdd7ac319316bf71f043163a3a0184e25ecfe1ee32724627424d042a05fa80ce77 ./tools/vconverter.sh 579852abd8378d754fcaccb903c1fefcd4020a578ba63fb3687a08027a937fbbd18e8a1ac22b448edc14445e088134e1e909ae2f3bfea8702df8abf56000daa0 ./tools/ruby.sh -feff7e1dc5d3a84761495979eaf091dc2132fa081c3b4501756973a25e0514e9a00cc9a201767bac7d391eaee631777bbbd9bc032110e99da099c33f710a4c9f ./tools/network.sh +6f3aaa2ab53b33e3505d46d78040bab66c583986583d67e0712fdad06d78ad0608cc2606f639d128e8013177ea9cf07b7cf4c65758a750529d724bc3bdeb5be0 ./tools/network.sh 7447d3e167ab207d3ef4218e201a06bf5a3fc23281639f16f7f405f1d66b73923845d450fdb0a94672757866a9da0324f728564a1b61b2ed1678fe576eb565cf ./core/autocomplete.sh 065cfa39f1b4312ed275ad1039827a24f703176c653a8d27303d145f9d389a60ec5b3a9eb167e060cc6fd093b9c03cfb1a8b70254d444fbc6e62e2297d88b310 ./core/status.sh 3cdfedebc1b15c342c0dabde7501fac4a7c2ac13f31cd84792d8d7f407659535e3baf6472c039ea542dc573d7a88811df58f34f2cd1bbd1de3f35434122314cf ./core/git.sh diff --git a/hyperterm/tools/network.sh b/hyperterm/tools/network.sh index 0bab431..1a21a57 100644 --- a/hyperterm/tools/network.sh +++ b/hyperterm/tools/network.sh @@ -1,11 +1,8 @@ #!/bin/bash -# Network -function my_ip() { +function __network() { unset MY_IP : "${MY_IP:=$(ip route show table local | awk -F "local" '{print $2}' | uniq)}" -} -function my_isp() { unset MY_ISP : "${MY_ISP:=$(host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}')}" } diff --git a/hyperterm/tools/sysinfo.sh b/hyperterm/tools/sysinfo.sh index 0654e7a..e2db9ec 100644 --- a/hyperterm/tools/sysinfo.sh +++ b/hyperterm/tools/sysinfo.sh @@ -2,6 +2,7 @@ # System information function ii() { + __network "$1" > /dev/null 2>&1 # import network case ${LANG/_*/} in es) printf '%s\e[1;36m%s\e[m\n' "Has iniciado sesión en " "$(hostname -f)" @@ -12,7 +13,6 @@ function ii() { printf '\n\e[1;32m%s\e[m\n%s\n' "Estadísticas de la memoria:" "$(free)" printf '\n\e[1;32m%s\e[m\n' "Dirección IP Local:" printf '%s\n' "${MY_IP:-"No conectado"}" - my_isp "$1" &> /dev/null printf '\n\e[1;32m%s\e[m\n' "Dirección ISP:" printf '%s\n' "${MY_ISP:-"No conectado"}" ;; @@ -25,7 +25,6 @@ function ii() { printf '\n\e[1;32m%s\e[m\n%s\n' "Memory stats:" "$(free)" printf '\n\e[1;32m%s\e[m\n' "Local IP Address:" printf '%s\n' "${MY_IP:-"Not connected"}" - my_isp "$1" &> /dev/null printf '\n\e[1;32m%s\e[m\n' "ISP Address:" printf '%s\n' "${MY_ISP:-"Not connected"}" ;; -- cgit v1.2.3