Wednesday, 5 July 2017

https://edelivery.oracle.com and wget

This is a cool enhancement / feature that I noticed the other day.

When downloading software from edelivery, I see:

image

the wget option at the end.

You can choose this and download a script:

image

You can cut and paste the script to your linux machine, and if the proxy is set up right, you can do the gets.

This has multiple advantages – but primarily if you do not have a graphical interface, you can do all of your downloading.


#!/bin/sh

set -x

#
# Generated onTue Jul 04 14:19:56 PDT 2017# Start of user configurable variables
#
LANG=C
export LANG

# SSO username and password
read -p 'SSO User Name:' SSO_USERNAME
read -sp 'SSO Password:' SSO_PASSWORD


# Path to wget command
WGET=/usr/bin/wget
# Location of cookie file
COOKIE_FILE=/tmp/$$.cookies

# Log directory and file
LOGDIR=.
LOGFILE=$LOGDIR/wgetlog-`date +%m-%d-%y-%H:%M`.log
# Output directory and file
OUTPUT_DIR=.
#
# End of user configurable variable
#

if [ "$SSO_PASSWORD " = " " ]
then
echo "Please edit script and set SSO_PASSWORD"
exit
fi

# Contact osdc site so that we can get SSO Params for logging in
SSO_RESPONSE=`$WGET --user-agent="Mozilla/5.0" --no-check-certificate https://edelivery.oracle.com/osdc/faces/SearchSoftware 2>&1|grep Location`

# Extract request parameters for SSO
SSO_TOKEN=`echo $SSO_RESPONSE| cut -d '=' -f 2|cut -d ' ' -f 1`
SSO_SERVER=`echo $SSO_RESPONSE| cut -d ' ' -f 2|cut -d '/' -f 1,2,3`
SSO_AUTH_URL=/sso/auth
AUTH_DATA="ssousername=$SSO_USERNAME&password=$SSO_PASSWORD&site2pstoretoken=$SSO_TOKEN"

# The following command to authenticate uses HTTPS. This will work only if the wget in the environment
# where this script will be executed was compiled with OpenSSL. Remove the --secure-protocol option
# if wget was not compiled with OpenSSL
# Depending on the preference, the other options are --secure-protocol= auto|SSLv2|SSLv3|TLSv1
$WGET --user-agent="Mozilla/5.0" --secure-protocol=auto --post-data $AUTH_DATA --save-cookies=$COOKIE_FILE --keep-session-cookies $SSO_SERVER$SSO_AUTH_URL -O sso.out >> $LOGFILE 2>&1

rm -f sso.out



  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V43852-01.zip&token=b0ZNSVUrOU45MFhWb1VZd1Z2NHcrQSE6OiF1c2VybmFtZT1FUEQtU0hBTk5PTi5NT0lSQE1ZUklBRC1JVC5DT00mdXNlcklkPTE4MTI0NTkmY2FsbGVyPVNlYXJjaFNvZnR3YXJlJmNvdW50cnlJZD1BVSZlbWFpbEFkZHJlc3M9c2hhbm5vbi5tb2lyQG15cmlhZC1pdC5jb20mZmlsZUlkPTcwNDE5ODEzJmFydT0xNzM1MjA4OSZhZ3JlZW1lbn10cnVl" -O $OUTPUT_DIR/V43852-01.zip >> $LOGFILE 2>&1


  $WGET  --user-agent="Mozilla/5.0" --no-check-certificate --load-cookies=$COOKIE_FILE --save-cookies=$COOKIE_FILE --keep-session-cookies "https://edelivery.oracle.com/osdc/download?fileName=V43853-01.zip&token=ejlqREVLRzV0R0pQeUZKNGlWYU56ZyE6OiF1c2VybmFtZT1FUEQtU0hBTk5PTi5NT0lSQE1ZUklBRC1JVC5DT00mdXNlcklkPTE4MTI0NTkmY2FsbGVyPVNlYXJjaFNvZnR3YXJlJmNvdW50cnlJZD1BVSZlbWFpbEFkZHJlc3M9c2hhbm5vbi5tb2lyQG15cmlhZC1pdC5jb20mZmlsZUlkPTcwNDE5ODEyJmFydT0xNzM1MjA5MCZhZ3JlZW1lbnRJZD0zMzkxNDg4JnNvZnR3YXJlQ2lkcz0mcGxhdGZvcm1DaWRzPTYwJnByb2ZpbGVJbnN0YW5jZUNpZD0tOTk5OSZkb3dubG9hZFNvdXJjZT13Z2V00cnVl" -O $OUTPUT_DIR/V43853-01.zip >> $LOGFILE 2>&1


In this instance I was trying to download a couple of files.

You can also see that I’ve added set –x to my script as I needed to debug some proxy settings, this is a good option, as the script does not have a lot of output if things are going wrong.

Thanks oracle, this is a nice feature!

No comments:

Extending JDE to generative AI