# Скачиваем промежуточный сертификат и сохраняем во временной директории
TMP=$(mktemp -d); curl http://svr-ov-aia.thawte.com/ThawteOV.cer | openssl x509 -inform DER -out $TMP/ThawteOV.pem; c_rehash $TMP; export SSL_CERT_DIR=$TMP
# Используем наш скрипт
onlime-turbo.sh check
# Удаляем временную директорию
rm -r $TMP; unset SSL_CERT_DIR
* 2013-10-12: SSL работает, временное решение сейчас не требуется
* 2014-10-25: onlime-turbo.sh обновлён в связи с изменениями на сайте
Услуга Турбокнопка<\/u>.+<\/p>"
status_pending="услуга.+обработки.+турбокнопка.+невозможны\."
status_activated="Услуга уже подключена.[^<]+"
status_period="awk '/^]*>$/ {record=1;line=0;start=\"\";end=\"\";status=\"\"} {if (record==1) line++; if (line==2) start=\$0; if (line==3) end=\$0; if (line==4) status=\$0 } /<\/tr>/ {record=0; if (status==\" Подключено \") print \"Период действия турбо-кнопки: \" start \" - \" end }' | sed -r 's/|<\/td>//g'"
# Core variables
CURL_OPTIONS="--silent"
if [[ -z $proxy_url ]]; then CURL="curl $CURL_OPTIONS"
else CURL="curl $CURL_OPTIONS --proxy $proxy_url --proxy-user $proxy_username:$proxy_password"; fi
CURL_LOGIN="eval $CURL --data \"login_credentials[login]=$site_username&login_credentials[password]=$site_password\" $site/$url_login -c -"
# Login, get session id, define CURL_SESSION
PHPSESSID=$($CURL_LOGIN | grep PHPSESSID | cut -f7)
CURL_SESSION="eval $CURL --cookie \"PHPSESSID=$PHPSESSID\""
# Get WTF and generate header for status page
WTF="X-Wtf: $($CURL_SESSION $site | egrep -o "var wtf = '[0-9a-f]+'" | awk '{print $4}' | tr -d \')"
CURL_SESSION="$CURL_SESSION --header \"$WTF\""
# Check if logged in
$CURL_SESSION $site | grep "$logged_in_successfuly" > /dev/null && echo "Logged in successfuly" || { echo "Please check login or password"; exit 1; }
# Activate turbo mode or check
if [[ $turbo_mode == check ]]; then
$CURL_SESSION $site/$url_turbo | egrep -io "($status_off|$status_pending|$status_activated)" | sed -r "s/<[^>]+>?//g"
$CURL_SESSION $site/$url_turbo_history | eval $status_period
echo "Account information:"; $CURL_SESSION $site/$url_status | eval $status
else
# Dirty work around to make bonus turbo-button work (we need to request /bonus page before we request /bonus/activate)
[[ ${turbo_mode#b} == ${turbo_mode} ]] || $CURL_SESSION $site/bonus > /dev/null
# Request for turbo mode
echo "Requesting for turbo mode $turbomode..."
$CURL_SESSION $site/$url_turbo_request --data "$request_data" > /dev/null && echo "Well done!" || echo "Something wrong has happened"
fi
# Logout
$CURL_SESSION $site/$url_logout
$CURL_SESSION $site | grep "$logged_in_successfuly" > /dev/null || echo "Logged out successfuly"