kyopages/scripts/tests/diag_getFlashPlayer

138 lines
5.4 KiB
Plaintext
Raw Normal View History

2017-07-17 19:18:36 +02:00
#!/bin/bash
2017-09-07 09:46:49 +02:00
version=07/09/2017
2017-08-27 12:02:20 +02:00
2017-09-07 09:46:49 +02:00
# si $1=all affichage complet
f__affichage(){ # v07/09/2017
2017-08-27 12:02:20 +02:00
# 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
[ "$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"
}
2017-07-17 19:18:36 +02:00
2017-09-07 09:46:49 +02:00
# $1 url à tester, si $2=loc affiche seulement location, affiche url testée, entêtes http, location si présente
f__wget_test_diag(){ #v07/09/2017
local file_test_wget retourHttp location
file_test_wget="/tmp/testWget-$RANDOM"
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget" || retourWget="$?"
2017-08-27 12:02:20 +02:00
[ "$retourWget" == 1 ] && retourWget="code erreur générique"
[ "$retourWget" == 2 ] && retourWget="parse erreur (ligne de commande?)"
[ "$retourWget" == 3 ] && retourWget="erreur Entrée/sortie fichier"
[ "$retourWget" == 4 ] && retourWget="défaut réseau"
[ "$retourWget" == 5 ] && retourWget="défaut vérification SSL"
[ "$retourWget" == 6 ] && retourWget="défaut authentification"
[ "$retourWget" == 7 ] && retourWget="erreur de protocole"
[ "$retourWget" == 8 ] && retourWget="réponse serveur en erreur"
2017-09-07 09:46:49 +02:00
retourHttp="$(grep -i 'HTTP/' "$file_test_wget" | tr -d '\n' | xargs)"
location="$(grep -i 'location' $file_test_wget | xargs)"
if [ "$2" == "loc" ]; then
[ "$location" ] && echo "$YELLOW $location$COLOR" || echo "$YELLOW no location$COLOR"
return
fi
2017-08-27 12:02:20 +02:00
if [ "$retourWget" ]; then
2017-08-30 09:38:25 +02:00
echo "erreur wget: $RED$retourWget$COLOR"
echo -e "$BLUE $1$COLOR\t$RED $retourHttp$COLOR"
[ "$location" ] && echo "$YELLOW $location" || echo "$YELLOWno location"
2017-08-27 12:02:20 +02:00
else
2017-08-30 09:38:25 +02:00
echo -e "$BLUE $1$COLOR\t$GREEN $retourHttp$YELLOW"
[ "$location" ] && echo " $location" || echo " no location"
2017-08-27 12:02:20 +02:00
fi
2017-08-30 22:43:58 +02:00
printf "$COLOR"
2017-08-27 12:02:20 +02:00
rm "$file_test_wget"
2017-07-17 19:18:36 +02:00
}
2017-09-07 09:46:49 +02:00
version_online(){ #v07/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"
2017-08-30 09:38:25 +02:00
}
2017-07-17 19:18:36 +02:00
2017-09-07 09:46:49 +02:00
detect_v1(){ #v07/09/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_diag "$recup_url"
2017-07-17 19:18:36 +02:00
}
2017-08-30 09:38:25 +02:00
# html page adobe
# <p class="NoBottomMargin" id="AUTO_ID_columnleft_p_version"><strong>Version 26.0.0.137</strong></p>
2017-09-07 09:46:49 +02:00
# start
2017-08-30 09:38:25 +02:00
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
2017-08-28 10:07:43 +02:00
detect_v1
2017-09-07 09:46:49 +02:00
echo
2017-07-17 19:18:36 +02:00
exit
2017-08-28 10:07:43 +02:00
## v2 essai non transformé
2017-07-17 19:18:36 +02:00
#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
2017-08-27 12:02:20 +02:00
wget --keep-session-cookies --ignore-length --tries=1 --timeout=15 --user-agent="$user_agent" -O "$file_test_wget" "$urlOnline"
2017-07-17 19:18:36 +02:00
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/