Commit 67a26d71 authored by kyodev's avatar kyodev

maj

parent f9fe173f
Pipeline #57584 passed with stages
in 21 seconds
ce git est en cours de transfert
la nouvelle plateforme officielle est celle du groupe sdeb, [sur framagit](https://framagit.org/sdeb)
la nouvelle plateforme officielle est donc celle du groupe sdeb, [sur framagit](https://framagit.org/sdeb)
## getFirefox
script bash: chargeur / installeur des versions officielles Mozilla Firefox latest, ESR, beta, nightly. installation et fonctionnement en parallèle possible. Mise à jour automatique par Firefox autorisée (selon la périodicité du canal Firefox).
## getFlashPlayer
script bash: télécharge et installe la version officielle du plugin FlashPlayer pour Firefox (NPAPI)
## getInfo
script bash collectant des informations sur la configuration d'un PC. Un rapport au format markdown est formé. Ce rapport peut être exporté sur un pastebin avec rendu markdown pour partager les informations dans le but de se faire dépanner
## getIp
script bash: affiche les Ips publiques ou locales d'un PC
## getThunderbird
script bash: chargeur / installeur des versions officielles Thunderbird latest, beta. installation et fonctionnement en parallèle possible. Mise à jour automatique par Thunderbird autorisée (selon la prériodicité du canal).
## getXfox
script bash: chargeur / installeur des versions officielles de Waterfox et Tor Browser, Mise à jour automatique par les applications autorisée.
## ipupdate
mise à jour IP sur service de DNS dynamique ( duckdns / dynu / freemyip / nh / noip )
## nsOpenNic
manage OpenNic DNS in resolv.conf
## nstest
speed test of open dns
## pasthis
export to a pastebin wtih command line
lrwxrwxrwx 1 root root 9 25 oct. 19:30 ata-Crucial_CT750MX300SSD1_16141256D05D -> ../../sdb
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-Crucial_CT750MX300SSD1_16141256D05D-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-Crucial_CT750MX300SSD1_16141256D05D-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-Crucial_CT750MX300SSD1_16141256D05D-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-Crucial_CT750MX300SSD1_16141256D05D-part4 -> ../../sdb4
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-Crucial_CT750MX300SSD1_16141256D05D-part5 -> ../../sdb5
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-Crucial_CT750MX300SSD1_16141256D05D-part6 -> ../../sdb6
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-Crucial_CT750MX300SSD1_16141256D05D-part7 -> ../../sdb7
lrwxrwxrwx 1 root root 9 25 oct. 19:30 ata-CT500BX100SSD1_1536F00C06F0 -> ../../sda
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-CT500BX100SSD1_1536F00C06F0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-CT500BX100SSD1_1536F00C06F0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 25 oct. 19:30 ata-CT500BX100SSD1_1536F00C06F0-part5 -> ../../sda5
lrwxrwxrwx 1 root root 9 28 oct. 16:25 ata-HL-DT-ST_DVDRAM_GT90N_M52D5NL0816 -> ../../sr0
lrwxrwxrwx 1 root root 9 28 oct. 16:25 wwn-0x5001480000000000 -> ../../sr0
lrwxrwxrwx 1 root root 9 25 oct. 19:30 wwn-0x500a07511256d05d -> ../../sdb
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a07511256d05d-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a07511256d05d-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a07511256d05d-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a07511256d05d-part4 -> ../../sdb4
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a07511256d05d-part5 -> ../../sdb5
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a07511256d05d-part6 -> ../../sdb6
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a07511256d05d-part7 -> ../../sdb7
lrwxrwxrwx 1 root root 9 25 oct. 19:30 wwn-0x500a0751f00c06f0 -> ../../sda
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a0751f00c06f0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a0751f00c06f0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 25 oct. 19:30 wwn-0x500a0751f00c06f0-part5 -> ../../sda5
lrwxrwxrwx. 1 root root 9 28 oct. 21:52 ata-TSSTcorp_DVD+_-RW_TS-U633J_R86X6GRZB00420 -> ../../sr1
#!/bin/bash
version=5/12/2017
# si $1=all affichage complet
f__affichage(){ # v07/09/2017
# définition couleurs
YELLOW="$(printf "\033[0;33m")" # ?
GREEN="$(printf "\033[0;32m")" # ok
BLUE="$(printf "\033[0;34m")" # info
RED="$(printf "\033[0;31m")" # alerte
COLOR="$(printf "\033[0m")" # standard
STD="$(printf "\033[0m")" # standard
[ "$1" == all ] || return
clear
printf "$YELLOW"
[ "$(which figlet)" ] && figlet -w120 "$(basename $0)" || echo -e "\t\t\t$(basename $0)"
echo -e "$GREEN\t\t\tversion $version$COLOR\n"
}
# test wget, $1=url à tester, sortie du script (même si url testée ok) avec affichage erreur ou ok
# si $2=print affiche url testée & entêtes http & location, return 0
# si $2=loc affiche seulement location, return 0
# si $2=test return 0 si ok, return 1 si KO
f__wget_test(){ # 11/12/2017
local file_test_wget retourWget retourHttp location
file_test_wget="/tmp/testWget-$$-$RANDOM"
wget -Sq --timeout=5 --tries=2 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget"
retourWget="$?"
[ "$retourWget" == 1 ] && retourWget="1: code erreur générique"
[ "$retourWget" == 2 ] && retourWget="2: parse erreur (ligne de commande?)"
[ "$retourWget" == 3 ] && retourWget="3: erreur Entrée/sortie fichier"
[ "$retourWget" == 4 ] && retourWget="4: défaut réseau"
[ "$retourWget" == 5 ] && retourWget="5: défaut vérification SSL"
[ "$retourWget" == 6 ] && retourWget="6: défaut authentification"
[ "$retourWget" == 7 ] && retourWget="7: erreur de protocole"
[ "$retourWget" == 8 ] && retourWget="8: réponse serveur en erreur"
retourHttp=$( grep -i 'HTTP/' "$file_test_wget" | tr -d '\n' | xargs )
location=$( grep -i 'location' $file_test_wget | xargs )
if [ "$2" == "test" ]; then
rm "$file_test_wget" 2>/dev/null
# spécial maintenance frama.link, pas de redirection sur page status framalink
[ "$( grep -c '303' <<< $retourHttp )" -ne 0 ] && return 1 # 303 See Other
[ "$retourWget" == "0" ] && return 0 || return 1
fi
if [ "$2" == "print" ]; then
if [ "$retourWget" != "0" ]; then
echo "erreur wget: $RED$retourWget"
echo -e "$BLUE $1$STD\t$RED $retourHttp"
else
echo -e "$BLUE $1$STD\t$GREEN $retourHttp"
fi
echo "$STD"
fi
if [ "$2" == "print" ] || [ "$2" == "loc" ]; then
[ "$location" ] && echo -n "$YELLOW $location" || echo -n "$YELLOW no location"
echo "$STD"
rm "$file_test_wget" 2>/dev/null
return 0
fi
if [ "$retourWget" != "0" ]; then
rm "$file_test_wget" 2>/dev/null
# f__error "wget, $retourWget" "$1" "$YELLOW$retourHttp" "$location"
echo -e "$RED erreur wget, $retourWget \n $1 \n $YELLOW$retourHttp \n $location$STD" # pour les diags
return 1
fi
if [ "$(grep -c '200' <<< $retourHttp)" -ne 0 ]; then
echo -e "$GREEN\ntout est ok, réessayer$STD\n"
fi
rm "$file_test_wget" 2>/dev/null
exit 0
}
version_online(){ # 07/09/2017
echo " détection version flash en ligne"
echo " ================================"
verFlash="$(wget -q --tries=1 --timeout=15 --user-agent="$user_agent" -O - "$urlOnline" | \
sed -nr 's/^.*AUTO_ID.*Version[[:blank:]]+([0-9].*[0-9]).*$/\1/p')" || verFlash="na"
echo " \$urlOnline: $BLUE$urlOnline$COLOR"
echo " détecté: \$verFlash: $GREEN$verFlash"
echo "$COLOR"
}
detect_v1(){ # 5/12/2017
echo " url chargement flashplayer v1"
echo " ============================="
local archi
if [ "$(uname -m)" == "i686" ] || [ "$(uname -m)" == "i386" ]; then archi='i386';
elif [ "$(uname -m)" == "x86_64" ] || [ "$(uname -m)" == "amd64" ]; then archi='x86_64';
else echo "architecture non reconnue" ; fi
local recup1="https://fpdownload.adobe.com/get/flashplayer/pdc/"
local recup_url="$recup1$verFlash/flash_player_npapi_linux.$archi.tar.gz"
f__wget_test "$recup_url" print
}
# html page adobe
# <p class="NoBottomMargin" id="AUTO_ID_columnleft_p_version"><strong>Version 26.0.0.137</strong></p>
# start
user_agent="Mozilla/5.0 Firefox"
urlOnline="https://get.adobe.com/fr/flashplayer/"
f__affichage all
# détection version flash en ligne"
version_online
# url chargement flashplayer v1
detect_v1
echo
exit
## v2 essai non transformé
#lien site:
https://get.adobe.com/fr/flashplayer/download/?installer=FP_26.0_for_Linux_32-bit_(.tar.gz)_-_NPAPI&sType=6630&standalone=1
https://get.adobe.com/fr/flashplayer/download/?installer=FP_26.0_for_Linux_32-bit_(.tar.gz)_-_NPAPI&sType=6630&standalone=1
#lien calculé
#base standard: entetes ok, download KO, taille environ 11 Ko
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --referer="$urlOnline" \
--debug -o log -O "$file" "$recup_url"
#essais
wget --keep-session-cookies --ignore-length --tries=1 --timeout=15 --user-agent="$user_agent" -O "$file_test_wget" "$urlOnline"
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" \
--debug -o log -O "$file" "$recup_url"
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --keep-session-cookies \
--debug -o log -O "$file" "$recup_url"
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --keep-session-cookies \
--no-hsts --debug -o log -O "$file" "$recup_url"
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --keep-session-cookies \
--no-hsts --ignore-length --debug -o log -O "$file" "$recup_url"
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --referer="$urlOnline" \
--debug -o log -O "$file" "$recup_url"
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --referer="$urlOnline" --keep-session-cookies \
--debug -o log -O "$file" "$recup_url"
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --referer="$urlOnline" --keep-session-cookies \
--no-hsts --debug -o log -O "$file" "$recup_url"
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --referer="$urlOnline" --keep-session-cookies \
--no-hsts --ignore-length --debug -o log -O "$file" "$recup_url"
curl -L -O -v --header "User-Agent: $user_agent" -o "$file" "$recup_url"
L suivre les redirections
C - reprendre
O sauve fichier avec même nom que distant
o file sauve fichier sous file
v verbose
curl -I "$recup_url"
HTTP/1.1 200 OK
Date: Fri, 14 Jul 2017 10:18:32 GMT
Server: JRun Web Server
Content-Type: text/html; charset=UTF-8
Cache-Control: private, no-store, no-cache
Content-Language: fr-FR
Content-Language: fr-FR
Set-Cookie: SETTINGS.LOCALE=fr%5Ffr; HttpOnly;domain=.adobe.com;expires=Sun, 07-Jul-2047 17:18:32 GMT;path=/cfusion/
#!/bin/bash
version=5/12/2017
# si $1=all affichage complet
f__affichage(){ # 5/12/2017
# définition couleurs
YELLOW="$(printf "\033[0;33m")" # ?
GREEN="$(printf "\033[0;32m")" # ok
BLUE="$(printf "\033[0;34m")" # info
RED="$(printf "\033[0;31m")" # alerte
COLOR="$(printf "\033[0m")" # standard
STD="$(printf "\033[0m")" # standard
[ "$1" == all ] || return
clear
printf "$YELLOW"
[ "$(which figlet)" ] && figlet -w120 "$(basename $0)" || echo -e "\t\t\t$(basename $0)"
echo -e "$GREEN\t\t\tversion $version$COLOR\n"
}
f_help(){ # 25/12/2017
f__affichage all
printf $BLUE
cat << 'EOF'
----------------------------------------------------------------------
=== versions Thunderbird ===
latest: x.y.z beta: x.y.z
pour chaque architecture linux ou linux64 (32 ou 64 bits):
==========================================================
canal: url récup canal HTTP/1.1 302 Found HTTP/1.1 200 OK
Location: url réelle de l'archive du canal si redirection
----------------------------------------------------------------------
liens de téléchargement manuels:
latest : https://www.mozilla.org/fr/thunderbird/
latest : https://www.mozilla.org/en-US/thunderbird/all/
beta : https://www.mozilla.org/fr/thunderbird/channel/
beta : https://www.mozilla.org/en-US/thunderbird/beta/all/
EOF
printf $COLOR
exit
}
# test wget, $1=url à tester, sortie du script (même si url testée ok) avec affichage erreur ou ok
# si $2=print affiche url testée & entêtes http & location, return 0
# si $2=loc affiche seulement location, return 0
# si $2=test return 0 si ok, return 1 si KO
f__wget_test(){ # 11/12/2017
local file_test_wget retourWget retourHttp location
file_test_wget="/tmp/testWget-$$-$RANDOM"
wget -Sq --timeout=5 --tries=2 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget"
retourWget="$?"
[ "$retourWget" == 1 ] && retourWget="1: code erreur générique"
[ "$retourWget" == 2 ] && retourWget="2: parse erreur (ligne de commande?)"
[ "$retourWget" == 3 ] && retourWget="3: erreur Entrée/sortie fichier"
[ "$retourWget" == 4 ] && retourWget="4: défaut réseau"
[ "$retourWget" == 5 ] && retourWget="5: défaut vérification SSL"
[ "$retourWget" == 6 ] && retourWget="6: défaut authentification"
[ "$retourWget" == 7 ] && retourWget="7: erreur de protocole"
[ "$retourWget" == 8 ] && retourWget="8: réponse serveur en erreur"
retourHttp=$( grep -i 'HTTP/' "$file_test_wget" | tr -d '\n' | xargs )
location=$( grep -i 'location' $file_test_wget | xargs )
if [ "$2" == "test" ]; then
rm "$file_test_wget" 2>/dev/null
# spécial maintenance frama.link, pas de redirection sur page status framalink
[ "$( grep -c '303' <<< $retourHttp )" -ne 0 ] && return 1 # 303 See Other
[ "$retourWget" == "0" ] && return 0 || return 1
fi
if [ "$2" == "print" ]; then
if [ "$retourWget" != "0" ]; then
echo "erreur wget: $RED$retourWget"
echo -e "$BLUE $1$STD\t$RED $retourHttp"
else
echo -e "$BLUE $1$STD\t$GREEN $retourHttp"
fi
echo "$STD"
fi
if [ "$2" == "print" ] || [ "$2" == "loc" ]; then
[ "$location" ] && echo -n "$YELLOW $location" || echo -n "$YELLOW no location"
echo "$STD"
rm "$file_test_wget" 2>/dev/null
return 0
fi
if [ "$retourWget" != "0" ]; then
rm "$file_test_wget" 2>/dev/null
# f__error "wget, $retourWget" "$1" "$YELLOW$retourHttp" "$location"
echo -e "$RED erreur wget, $retourWget \n $1 \n $YELLOW$retourHttp \n $location$STD" # pour les diags
return 1
fi
if [ "$(grep -c '200' <<< $retourHttp)" -ne 0 ]; then
echo -e "$GREEN\ntout est ok, réessayer$STD\n"
fi
rm "$file_test_wget" 2>/dev/null
exit 0
}
test_url_dl_thunderbird(){ # 5/12/2017
local recup_url fu_archi
for fu_archi in linux linux64; do
echo " Architecture: $fu_archi"
echo " ====================="
for canal in latest beta; do
[ "$canal" == "beta" ] && prefixe="$canal-"
recup_url="https://download.mozilla.org/?product=thunderbird-$prefixe""latest&os=$fu_archi&lang=fr"
printf " $canal":
f__wget_test "$recup_url" print
done
done
}
# assigne $verLatest, $verBeta
test_version_thunderbird(){ # 5/12/2017
local recup_url prefixe verOnline verTbOnline
echo -e "\n === versions Thunderbird ==="
for canal in latest beta; do
# version online
[ "$canal" == "beta" ] && prefixe="$canal-"
recup_url="https://download.mozilla.org/?product=thunderbird-$prefixe""latest&os=$fu_archi&lang=fr"
verOnline="$( sed -E 's#.*thunderbird/releases/(.*)/linux-.*$#\1#' <<< $( f__wget_test $recup_url loc ) )"
verTbOnline+="$( printf "%-7s: %-12s" $canal $verOnline )"
done
[ "$verTbOnline" ] || verTbOnline="$RED""aucune(s)"
echo -e " $GREEN$verTbOnline$COLOR"
}
# start
user_agent="Mozilla/5.0 Firefox"
f__affichage
[ "$1" == "-h" ] && f_help
fu_archi="linux64"
test_version_thunderbird
echo
test_url_dl_thunderbird
echo
#nouveaux formats?:
#https://download.mozilla.org/?product=thunderbird-52.5.2-SSL&os=linux64&lang=fr
#https://download.mozilla.org/?product=thunderbird-58.0b2-SSL&os=linux64&lang=fr
exit
autres liens
https://releases.mozilla.org/pub/thunderbird/releases/latest/
https://releases.mozilla.org/pub/thunderbird/releases/latest-beta/
https://releases.mozilla.org/pub/thunderbird/nightly/latest-comm-central-l10n/
#!/bin/bash
# test connexion, return 0|1, 0 si ip valide, si $1=log : log si perte cnx, requiert $histo_cnx (fichier historique)
f__cnx(){ # 19/04/2018
#~ if ! ping -c1 -w1 8.8.8.8 &>/dev/null; then
if ! nc -z -w1 8.8.8.8 53 2>/dev/null ; then
#~ [ "$1" == 'log' ] && f__log "cnx down" "$histo_cnx"
return 1
else
return 0
fi
}
# $1=bas-haut (ex: 0-5), nombre aléatoire entre bas & haut inclus, si [$2=seq] liste avec départ aléatoire
f__random(){ # 25/04/2018 2
local bas haut max rand start xyz
[ "${1//*-*}" ] && return 1 # bad format, no -
bas=${1%-*}
haut=${1#*-}
max=$(( 32768 / ( haut + 1 ) * ( haut + 1 ) ))
while (( (rand=RANDOM) >= max )); do : ; done
if [ "$2" == "seq" ]; then
#~ while (( (start=RANDOM) >= max )); do
#~ :
#~ done
start=$(( bas + ( rand % (haut+1-bas) ) ))
for (( xyz=start; xyz <= haut; xyz++ )); do echo "$xyz"; done
(( (start-bas) > 0 )) && for (( xyz=bas; xyz < start; xyz++ )); do echo "$xyz"; done
return
fi
echo $(( bas + ( rand % (haut+1 -bas) ) ))
}
# [-4]|[-6], par défaut -4, return 0|1, 0 si ip valide
f__validate_ip(){ # 21/04/2018
local regex #ip6: https://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses ()https://stackoverflow.com/a/17871737/9580455)
if [[ "$1" == "-6" ]]; then
regex="^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$"
else
regex="(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])"
regex="^$regex\\.$regex\\.$regex\\.$regex$"
fi
[[ "$1" =~ ^- ]] && shift
#~ [[ "$1" =~ $regex ]] && echo -n ok || echo -n " KO" ; echo "-$1-"
[[ "$1" =~ $regex ]] && return 0 || return 1
}
# $1 [-4]|-6, par défaut -4, affiche public ip, requiert f__validate_ip
f_ip_pub_diag(){ # 02/05/2018
local proto larg ip_pub cmd server user_agent="Mozilla/5.0 Firefox"
declare -a base cmds
if [ "$1" == '-6' ] ; then
proto="-6"
larg=40
else
proto="-4"
larg=18
fi
f__cnx 'log' || return 1 # no connnection, return with error
type -p host &>/dev/null && cmds+=( "host -R0 -W1 -t " ) # deprecated
type -p dig &>/dev/null && cmds+=( "dig +short +timeout=1 +retry=1 " )
type -p wget &>/dev/null && cmds+=( "wget --user-agent=$user_agent --quiet --timeout=1 --tries=1 -o /dev/null -O - " )
type -p curl &>/dev/null && cmds+=( "curl --silent --location --retry 0 --max-time 1 " )
for cmd in "${cmds[@]}"; do
if [[ "$proto" == '-4' && "$cmd" =~ ^(host|dig) ]] ; then
base=( "${dns4[@]}" )
elif [[ "$proto" == '-6' && "$cmd" =~ ^(host|dig) ]] ; then
base=( "${dns6[@]}" )
elif [[ "$proto" == '-4' && "$cmd" =~ ^(wget|curl) ]] ; then
base=( "${raw4[@]}" )
elif [[ "$proto" == '-6' && "$cmd" =~ ^(wget|curl) ]] ; then
base=( "${raw6[@]}" )
fi
for server in "${base[@]}"; do
printf "%-28s: " "${server#*@}"
getTime start
[[ "$cmd" =~ ^host ]] && server="${server//@}" # host
# shellcheck disable=SC2086
ip_pub=$( $cmd $server )
ip_pub=${ip_pub##*has address } # extraction command host
ip_pub=${ip_pub##*has IPv6 address } # extraction command host
ip_pub=${ip_pub#*\"} # extraction o-o.myaddr.l.google.com
ip_pub=${ip_pub%\"*} # extraction o-o.myaddr.l.google.com
printf "%-${larg}s " "$( cat -A <<< "${ip_pub:0:$larg}" )" #~ printf "%-${larg}s" "$ip_pub"
f__validate_ip "$1" "$ip_pub" || printf "%s " invalid
getTime end
done
echo "(${cmd%% *})"
sleep 10
done
}
# getTime start : comptage départ
# getTime end : comptage fin, calcul fin - départ, affichage différence en ms
# getTime end:sec : idem sauf affichage différence en s
# getTime affichage date en ms, sans unité, pour traitement externe à la fonction
# declare -g time
getTime(){ # 21/04/2018
local date sec ms time2
declare -g time
date=$( date +%s.%N ) # s.ns
sec=${date%\.*} # s
ms=${date#*\.} # ns
ms=${ms::-6} # ms
if [[ "$*" =~ "start" ]]; then
time="$sec$ms"
elif [[ "$*" =~ "end" ]]; then
if [[ "$*" =~ "sec" ]]; then
time2=$(( $sec$ms-time ))
echo "${time2::-3}.${time2: -3} s"
else
echo "$(( $sec$ms-time )) ms"
fi
else
echo "$sec$ms" # ms sans unité
fi
}
{ # serveur ip
raw4=(
v4.ident.me # raw ip4 only
ipv4.whatismyip.akamai.com # raw ip4 only
alma.ch/myip.cgi # raw ip4 only
api.infoip.io/ip # raw ip4 only
api.ipify.org # raw ip4 only
myip.dnsdynamic.org # raw ip4 only
ipecho.net/plain # raw ip4 only
ipinfo.io/ip # raw ip4 only
eth0.me # raw ip4 only
#~ checkip.amazonaws.com # raw ip4 only lent & aléatoire O4/2018
#~ ifconfig.me/ip # raw ip4 only pas fiable? http://ifconfig.me/ infoS
)
raw6=(
v6.ident.me # raw, ip6 defaut
ipv6.whatismyip.akamai.com # raw, ip6 defaut
canhazip.com # raw, ip6 defaut
ip.tyk.nu # raw, ip6 defaut
myexternalip.com/raw # raw, ip6 defaut parfois ip4
smart-ip.net/myip # raw, ip6 defaut ! requiert user-agent
diagnostic.opendns.com/myip # raw, ip6 defaut
icanhazip.com # raw, ip6 defaut
wgetip.com # raw, ip6 defaut
wtfismyip.com/text # raw, ip6 defaut
l2.io/ip # raw, ip6 defaut
tnx.nl/ip # raw, ip6 defaut
bot.whatismyipaddress.com # raw, ip6 defaut pb parfois sort ip4
#~ ipof.in/txt # raw, ip6 defaut NRP
#~ ident.me # raw, ip6 defaut
)
dns4=(
"A myip.opendns.com @resolver1.opendns.com"
"A myip.opendns.com @resolver2.opendns.com"
"A myip.opendns.com @resolver3.opendns.com"
"A myip.opendns.com @resolver4.opendns.com"
"A whoami.akamai.net @ns1-1.akamaitech.net"
)
dns6=(
"AAAA myip.opendns.com @resolver1.ipv6-sandbox.opendns.com"
"AAAA myip.opendns.com @resolver2.ipv6-sandbox.opendns.com"
"TXT o-o.myaddr.l.google.com @ns1.google.com"
)
}
f_ip_pub_diag -4
f_ip_pub_diag -6
{ # inutilisé
servers_list=(
#~ https://major.io/icanhazip-com-faq/
check.torproject.org # tor
checkip.dyndns.com # 1/2 raw ip4 only Current IP Address: 88.191.35.123
checkip.dyndns.org/plain # 1/2 raw ip4 only Current IP Address: 88.191.35.123
bobborst.com/tools/whatsmyip #
canyouseeme.org #
checkmyip.com #
checkip.dns.he.net # 1/2 raw: Your IP address is : 2a01:e35:8bf2:37b0::d7c5:972f
checkip.dynu.com # 1/2 raw: Current IP Address: 88.191.35.123
ipcheckv6.dynu.com
displaymyip.com #
dslreports.com/whatismyip #
findmyip.co #
formyip.com #
geoiptool.com #
getmyipaddress.org #
httpbin.org/ip # 1/2 raw ip4 only, json
infosniper.net #
ip-adress.com #
ip-adress.eu #
ip.changeip.com # 1/2 raw ip4 only ip_pub=${ip_pub##*IPADDR=} ip_pub=${ip_pub%%-->*} # extraction ip.changeip.com
ipchicken.com #
ipgoat.com #
iplocation.net #
ip-lookup.net # ip6 defaut,
lawrencegoetz.com/programs/ipinfo #
mon-ip.com # locale
monippublique.com #
myexternalip.com # ip6 curl -I "http://myexternalip.com"
my-ip-address.co #
myipnumber.com #
myipv3.hn.org #
portchecktool.com #
privateinternetaccess.com/pages/whats-my-ip #
sshmyip.com # 1/2 raw ip6 only, json
telnetmyip.com # 1/2 raw ip6 only, json
tracemyip.org #
trackip.net #
websiteipaddress.com #
whatismyip.akamai.com #
whatsmydns.net/whats-my-ip-address.html #
whatsmyip.net # ip6 defaut
)
divers=(
'ssh sshmyip.com' #
'telnet telnetmyip.com' #
'telnet|nc 6.ifcfg.me 23' # NRP
'telnet|nc 4.ifcfg.me 23' # NRP
)
}
00:00.0 Host bridge: Intel Corporation System Controller Hub (SCH Poulsbo) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation System Controller Hub (SCH Poulsbo) Graphics Controller (rev 07)
00:1b.0 Audio device: Intel Corporation System Controller Hub (SCH Poulsbo) HD Audio Controller (rev 07)
00:1c.0 PCI bridge: Intel Corporation System Controller Hub (SCH Poulsbo) PCI Express Port 1 (rev 07)
00:1c.1 PCI bridge: Intel Corporation System Controller Hub (SCH Poulsbo) PCI Express Port 2 (rev 07)
00:1d.0 USB controller: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #1 (rev 07)
00:1d.1 USB controller: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #2 (rev 07)
00:1d.2 USB controller: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #3 (rev 07)
00:1d.7 USB controller: Intel Corporation System Controller Hub (SCH Poulsbo) USB EHCI #1 (rev 07)
00:1f.0 ISA bridge: Intel Corporation System Controller Hub (SCH Poulsbo) LPC Bridge (rev 07)
00:1f.1 IDE interface: Intel Corporation System Controller Hub (SCH Poulsbo) IDE Controller (rev 07)
01:00.0 Network controller: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
03:00.0 Ethernet controller: Qualcomm Atheros AR8132 Fast Ethernet (rev c0)
04:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Opal XT [Radeon R7 M265] (rev ff)
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
00:00.0 "Host bridge" "Intel Corporation" "Broadwell-U Host Bridge -OPI" -r09 "Dell" "Device 0695"
00:03.0 "Audio device" "Intel Corporation" "Broadwell-U Audio Controller" -r09 "Dell" "Device 0695"
00:14.0 "USB controller" "Intel Corporation" "Wildcat Point-LP USB xHCI Controller" -r03 -p30 "Dell" "Device 0695"
00:16.0 "Communication controller" "Intel Corporation" "Wildcat Point-LP MEI Controller #1" -r03 "Dell" "Device 0695"
00:1b.0 "Audio device" "Intel Corporation" "Wildcat Point-LP High Definition Audio Controller" -r03 "Dell" "Device 0695"
00:1c.0 "PCI bridge" "Intel Corporation" "Wildcat Point-LP PCI Express Root Port #1" -re3 "" ""
00:1c.2 "PCI bridge" "Intel Corporation" "Wildcat Point-LP PCI Express Root Port #3" -re3 "" ""
00:1c.3 "PCI bridge" "Intel Corporation" "Wildcat Point-LP PCI Express Root Port #4" -re3 "" ""
00:1c.4 "PCI bridge" "Intel Corporation" "Wildcat Point-LP PCI Express Root Port #5" -re3 "" ""
00:1d.0 "USB controller" "Intel Corporation" "Wildcat Point-LP USB EHCI Controller" -r03 -p20 "Dell" "Device 0695"
00:1f.0 "ISA bridge" "Intel Corporation" "Wildcat Point-LP LPC Controller" -r03 "Dell" "Device 0695"
00:1f.2 "SATA controller" "Intel Corporation" "Wildcat Point-LP SATA Controller [AHCI Mode]" -r03 -p01 "Dell" "Device 0695"
00:1f.3 "SMBus" "Intel Corporation" "Wildcat Point-LP SMBus Controller" -r03 "Dell" "Device 0695"
02:00.0 "Ethernet controller" "Realtek Semiconductor Co., Ltd." "RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller" -r07 "Dell" "Device 0695"
03:00.0 "Network controller" "Intel Corporation" "Wireless 3160" -r83 "Intel Corporation" "Dual Band Wireless AC 3160"
00:02.0 "VGA compatible controller" "Intel Corporation" "System Controller Hub (SCH Poulsbo) Graphics Controller" -r07 "ASUSTeK Computer Inc." "System Controller Hub (SCH Poulsbo) Graphics Controller"
00:02.0 "VGA compatible controller" "Intel Corporation" "HD Graphics 5500" -r09 "Dell" "Device 0695"
04:00.0 "Display controller" "Advanced Micro Devices, Inc. [AMD/ATI]" "Opal XT [Radeon R7 M265]" -rff -pff "" ""
00:02.0 "VGA compatible controller" "Intel Corporation" "3rd Gen Core processor Graphics Controller" -r09 "ASUSTeK Computer Inc." "3rd Gen Core processor Graphics Controller"
01:00.0 "3D controller" "NVIDIA Corporation" "GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M]" -rff -pff "" ""
00:00.0 Host bridge [0600]: Intel Corporation System Controller Hub (SCH Poulsbo) [8086:8100] (rev 07)
Subsystem: ASUSTeK Computer Inc. System Controller Hub (SCH Poulsbo) [1043:83ce]
Flags: bus master, fast devsel, latency 0
00:1b.0 Audio device [0403]: Intel Corporation System Controller Hub (SCH Poulsbo) HD Audio Controller [8086:811b] (rev 07)
Subsystem: ASUSTeK Computer Inc. System Controller Hub (SCH Poulsbo) HD Audio Controller [1043:83ce]
Flags: bus master, fast devsel, latency 0, IRQ 23
Memory at f3f38000 (64-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
00:1c.0 PCI bridge [0604]: Intel Corporation System Controller Hub (SCH Poulsbo) PCI Express Port 1 [8086:8110] (rev 07) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 16
Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
I/O behind bridge: 0000e000-0000efff
Memory behind bridge: fbf00000-fbffffff
Prefetchable memory behind bridge: 80000000-801fffff
Capabilities: <access denied>
Kernel driver in use: pcieport
Kernel modules: shpchp
00:1c.1 PCI bridge [0604]: Intel Corporation System Controller Hub (SCH Poulsbo) PCI Express Port 2 [8086:8112] (rev 07) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 17
Bus: primary=00, secondary=01, subordinate=02, sec-latency=0
I/O behind bridge: 0000d000-0000dfff
Memory behind bridge: f4000000-fbefffff
Prefetchable memory behind bridge: cc000000-cfffffff
Capabilities: <access denied>
Kernel driver in use: pcieport
Kernel modules: shpchp
00:1d.0 USB controller [0c03]: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #1 [8086:8114] (rev 07) (prog-if 00 [UHCI])
Subsystem: ASUSTeK Computer Inc. System Controller Hub (SCH Poulsbo) USB UHCI [1043:83ce]
Flags: bus master, fast devsel, latency 0, IRQ 20
I/O ports at b880 [size=32]
Kernel driver in use: uhci_hcd
Kernel modules: uhci_hcd
00:1d.1 USB controller [0c03]: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #2 [8086:8115] (rev 07) (prog-if 00 [UHCI])
Subsystem: ASUSTeK Computer Inc. System Controller Hub (SCH Poulsbo) USB UHCI [1043:83ce]
Flags: bus master, fast devsel, latency 0, IRQ 21
I/O ports at c080 [size=32]
Kernel driver in use: uhci_hcd
Kernel modules: uhci_hcd
00:1d.2 USB controller [0c03]: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #3 [8086:8116] (rev 07) (prog-if 00 [UHCI])
Subsystem: ASUSTeK Computer Inc. System Controller Hub (SCH Poulsbo) USB UHCI [1043:83ce]
Flags: bus master, fast devsel, latency 0, IRQ 18
I/O ports at c480 [size=32]
Kernel driver in use: uhci_hcd
Kernel modules: uhci_hcd
00:1d.7 USB controller [0c03]: Intel Corporation System Controller Hub (SCH Poulsbo) USB EHCI #1 [8086:8117] (rev 07) (prog-if 20 [EHCI])
Subsystem: ASUSTeK Computer Inc. System Controller Hub (SCH Poulsbo) USB EHCI [1043:83ce]
Flags: bus master, fast devsel, latency 0, IRQ 19
Memory at f3f37c00 (32-bit, non-prefetchable) [size=1K]
Capabilities: <access denied>
Kernel driver in use: ehci-pci
Kernel modules: ehci_pci
00:1f.0 ISA bridge [0601]: Intel Corporation System Controller Hub (SCH Poulsbo) LPC Bridge [8086:8119] (rev 07)
Subsystem: ASUSTeK Computer Inc. System Controller Hub (SCH Poulsbo) LPC Bridge [1043:83ce]
Flags: fast devsel
Kernel driver in use: lpc_sch
Kernel modules: lpc_sch
00:1f.1 IDE interface [0101]: Intel Corporation System Controller Hub (SCH Poulsbo) IDE Controller [8086:811a] (rev 07) (prog-if 80 [Master])