#!/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 #

Version 26.0.0.137

# 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/