mirror of https://framagit.org/kyodev/kyopages.git
1.11.0
This commit is contained in:
parent
ea59907df6
commit
23c86a1b52
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=1.10.0
|
||||
date="02/09/2017"
|
||||
version=1.12.0
|
||||
date="03/09/2017"
|
||||
projet="simpledeb"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||
script="getInfo"
|
||||
|
@ -790,18 +790,20 @@ figet_gpu() { # thanks neofetch, assigne $gpu
|
|||
[[ "$gpu" =~ "intel" ]] && gpu="Intel Integrated Graphics"
|
||||
}
|
||||
|
||||
figet_ip() { # $ip_local, $gateway, $gateway_type, $gateway_one, $ip_local, $ip_local_type, $ifname, $ifname_type
|
||||
# $ip_local, $gateway, $gateway_type, $gateway_one, $ip_local, $ip_local_type, $ifname, $ifname_type
|
||||
figet_ip() { # v03/09/2017
|
||||
[ -z "$(which ip)" ] && return 1
|
||||
ip_local="$(sed '/lo.*inet/d; /inet6.*scope global/d' <<< "$(ip -o a)" | awk '{print $4,"(",$2,")"}')"
|
||||
ip_local="$(sed '/lo.*inet/d; /inet6.*scope global/d' <<< "$(ip -o a)" | awk '{print " ",$4,"(",$2,")"}')"
|
||||
ip_local_type="$(sed -E 's/(^.*wl.*)/\1 (wifi)/;s/(^.*en.*|^.*eth.*)/\1 (ethernet)/' <<< $ip_local)"
|
||||
gateway="$(LC_ALL=C ip -4 route | awk '/default via/ {print $3,"(",$5,")"}'; LC_ALL=C ip -6 route | awk '/default via/ {print $3,"(",$5,")"}')"
|
||||
gateway_type="$(sed -E 's/(^.*wl.*)/\1 (wifi)/;s/(^.*en.*|^.*eth.µ)/\1 (ethernet)/' <<< $gateway)"
|
||||
gateway_one="$(head -n 1 <<< $gateway | awk '{print $1}')"
|
||||
ifname="$(ip -4 route | awk '/proto kernel/ {print $3}')"
|
||||
gateway="$(LC_ALL=C ip -4 route | awk '/default via/ {print " ",$3,"(",$5,")"}'; LC_ALL=C ip -6 route | awk '/default via/ {print " ",$3,"(",$5,")"}')"
|
||||
gateway_type="$(sed -E 's/(^.*wl.*)/\1 (wifi)/;s/(^.*en.*|^.*eth.*)/\1 (ethernet)/' <<< $gateway)"
|
||||
gateway_one="$(head -n 1 <<< $gateway | awk '{print " ",$1}')"
|
||||
ifname="$(ip -4 route | awk '/proto kernel/ {print " ",$3}')"
|
||||
ifname_type="$(sed -E 's/(^wl.*)/\1 (wifi)/;s/(^en.*|^eth.*)/\1 (ethernet)/' <<< $ifname)"
|
||||
}
|
||||
|
||||
figet_ip_public(){ # $1=IPv4|IPv6, assigne $ip_public # 30/08/2017
|
||||
# $1=4|6, assigne $ip_public
|
||||
figet_ip_public(){ # v03/09/2017
|
||||
|
||||
list_ip4(){
|
||||
ip_test+=" http://whatismyip.akamai.com"
|
||||
|
@ -841,15 +843,17 @@ figet_ip_public(){ # $1=IPv4|IPv6, assigne $ip_public # 30/08/2017
|
|||
|
||||
unset ip_public
|
||||
local dig_test ip_test
|
||||
if [ "$1" == "IPv4" ]; then
|
||||
if [ "$1" == "4" ]; then
|
||||
ping -4 -c1 google.com &>/dev/null || ping -4 -c1 free.fr &>/dev/null || return 1 # test connectivité
|
||||
list_ip4_dig
|
||||
list_ip4
|
||||
ip_telnet=4.ifcfg.me
|
||||
elif [ "$1" == "IPv6" ]; then
|
||||
elif [ "$1" == "6" ]; then
|
||||
ping -6 -c1 google.com &>/dev/null || ping -6 -c1 free.fr &>/dev/null || return 1 # test connectivité
|
||||
list_ip6_dig
|
||||
list_ip6
|
||||
ip_telnet=6.ifcfg.me
|
||||
else return 1; fi
|
||||
fi
|
||||
|
||||
if [ "$(which dig)" ] && [ -z "$ip_public" ]; then
|
||||
for ii in $dig_test ; do
|
||||
|
@ -1196,10 +1200,16 @@ for i in $options; do
|
|||
prg_3
|
||||
exit ;; # rapport dmesg only, root requis
|
||||
--ip )
|
||||
figet_ip_public "IPv4"
|
||||
[ "$ip_public" ] && f__info "raw" "$GREEN ip4: $ip_public"
|
||||
figet_ip_public "IPv6"
|
||||
[ "$ip_public" ] && f__info "raw" "$BLUE ip6: $ip_public\n"
|
||||
if figet_ip_public "4" ; then
|
||||
f__info "raw" " ipv4 publique: $GREEN$ip_public"
|
||||
else
|
||||
f__info "$BLUE pas de connectivité ipv4"
|
||||
fi
|
||||
if figet_ip_public "6" ; then
|
||||
f__info "raw" " ipv6 publique: $GREEN$ip_public"
|
||||
else
|
||||
f__info "$BLUE pas de connectivité ipv6"
|
||||
fi
|
||||
exit ;; # affiche ip public
|
||||
-l | --list )
|
||||
[ -e $fileOutput ] && cat $fileOutput || f__info "pas de rapport à afficher"
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
* adresses MAC?
|
||||
|
||||
## 1.11.0 03/09/2017
|
||||
|
||||
* mieux: test connectivité avant recherche ip public pour éviter timeout, figet_ip_public
|
||||
* révision figet_ip: 2 espaces préliminaires pour meilleure présentation
|
||||
|
||||
## 1.10.0 02/09/2017
|
||||
|
||||
* fix bug commande parasite sur détection ip
|
||||
|
|
Loading…
Reference in New Issue