kyopages/scripts/diag_getFlashPlayer

134 lines
4.4 KiB
Bash
Executable File

#!/bin/bash
clear
user_agent="Mozilla/5.0 (X11; Linux $(uname -m); rv:54.0) Gecko/20100101 Firefox/54.0"
f__testWget(){
echo " $1"
wget -Sq --tries=1 --timeout=15 --user-agent="$user_agent" -O /dev/null "$1"
}
####
echo "détection version flash en ligne"
echo "================================"
# <p class="NoBottomMargin" id="AUTO_ID_columnleft_p_version"><strong>Version 26.0.0.137</strong></p>
urlOnline="https://get.adobe.com/fr/flashplayer/"
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 "\$user_agent: $user_agent"
echo "\$urlOnline: $urlOnline"
echo "\$verFlash: $verFlash"
#echo ""; f__testWget "$urlOnline"
####
detect_1(){
echo ""
echo "url chargement flashplayer v1"
echo "============================="
# https://fpdownload.adobe.com/get/flashplayer/pdc/26.0.0.137/flash_player_npapi_linux.i386.tar.gz
recup1="https://fpdownload.adobe.com/get/flashplayer/pdc/"
if [ "$(uname -m)" == "i686" ] || [ "$(uname -m)" == "i386" ]; then recup2='i386';
elif [ "$(uname -m)" == "x86_64" ] || [ "$(uname -m)" == "amd64" ]; then recup2='x86_64';
else echo "architecture non reconnue" ; fi
recup_url="$recup1$verFlash/flash_player_npapi_linux.$recup2.tar.gz"
echo "\$recup1 $recup1"
echo "\$recup_url $recup_url"
echo ""; f__testWget "$recup_url"
echo ""
}
####
detect_2(){
echo ""
echo "url chargement flashplayer v2"
echo "============================="
#buttonDownload").attr("href","/fr/flashplayer/download/?installer=FP_26.0_for_Linux_32-bit_(.tar.gz)_-_NPAPI&sType=6627&standalone=1");
recup="$(wget -q --tries=1 --timeout=15 --user-agent="$user_agent" -O - "$urlOnline" | grep -o '#buttonDownload.*(\.tar\.gz).*$')"
recup1="$(echo $recup | sed 's/.*\(download.*Linux_\).*/\1/')"
recup2="$(echo $recup | sed 's/.*\(-bit.*standalone=1\).*/\1/')"
recup_url="$urlOnline$recup1$(getconf LONG_BIT)$recup2"
echo "\$recup $recup"
echo "\$recup1 $recup1"
echo "\$recup2 $recup2"
echo "\$recup_url $recup_url"
file="flashplayer_npapi_linux.$(getconf LONG_BIT).tar.gz"
# echo ""; f__testWget "$recup_url"
echo ""
wget -c --tries=1 --timeout=15 --user-agent="$user_agent" --referer="$urlOnline" \
--debug -o log -O "$file" "$recup_url"
echo ""; ls -l "$file"
echo ""; cat -n log
}
detect_1
exit
## v2
#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 -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/