vardomskiy (vardomskiy) wrote,
vardomskiy
vardomskiy

  • Music:

wget script to download from SDLC

Quick shell script to download files that require authorization from Sunsolve/SDLC/Sun.com. Not mine, and I don't know where I found it in the first place.

Маленький скрипт для того чтобь списывать файлы с вебсайтов Sun'а (sunsolve.sun.com/SDLC/sun.com) для которых нужна авторизация. Требуется действительное имя пользователя и пароль, скрипт автоматизирует списывание с командной строки. Не мой, я уже не помню где я его откопал, но очень полезный.

#! /bin/sh

# wget user download-url filename

if [ $# -ne 3 ]; then 
    echo "Usage: $0 user_name download_url file_name"
    echo "  user_name     Use your Sun Online Account Username"
    echo "  download_url  The download link from the SDLC Download Page.  Must be enclosed in single quotes ('http://cds.sun.com/...')"
    echo "  file_name     Save the download using this file name"
    exit 1
fi

user=$1
dlurl=`echo $2 | sed -e 's/\?/%3f/g' -e 's/&/%26/g'`
filename=$3

stty -echo

echo "Password for ${user}: \c"; read password;

stty echo

#echo $dlurl

touch /tmp/wget-url-$$.txt
chmod 600 /tmp/wget-url-$$.txt

echo "https://identity.sun.com/amserver/UI/Login?program=cds&org=self_registered_users&IDToken1=${user}&IDToken2=${password}&goto=${dlurl}" >> /tmp/wget-url-$$.txt

wget  --no-check-certificate --keep-session-cookies  -O "${filename}" -i /tmp/wget-url-$$.txt

rm /tmp/wget-url-$$.txt

Tags: solaris
Subscribe

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments