Advertisement
Guest User

Untitled

a guest
Mar 28th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #
  4. # Generated onMon Mar 28 18:31:24 PDT 2016# Start of user configurable variables
  5. #
  6. LANG=C
  7. export LANG
  8.  
  9. # SSO username and password
  10. read -p 'SSO User Name:' SSO_USERNAME
  11. read -sp 'SSO Password:' SSO_PASSWORD
  12.  
  13.  
  14. # Path to wget command
  15. WGET=/usr/bin/wget
  16. # Location of cookie file
  17. COOKIE_FILE=/tmp/$$.cookies
  18.  
  19. # Log directory and file
  20. LOGDIR=.
  21. LOGFILE=$LOGDIR/wgetlog-`date +%m-%d-%y-%H:%M`.log
  22. # Output directory and file
  23. OUTPUT_DIR=.
  24. #
  25. # End of user configurable variable
  26. #
  27.  
  28. if [ "$SSO_PASSWORD " = " " ]
  29. then
  30. echo "Please edit script and set SSO_PASSWORD"
  31. exit
  32. fi
  33.  
  34. # Contact osdc site so that we can get SSO Params for logging in
  35. SSO_RESPONSE=`$WGET --user-agent="Mozilla/5.0" --no-check-certificate https://edelivery.oracle.com/osdc/faces/SearchSoftware 2>&1|grep Location`
  36.  
  37. # Extract request parameters for SSO
  38. SSO_TOKEN=`echo $SSO_RESPONSE| cut -d '=' -f 2|cut -d ' ' -f 1`
  39. SSO_SERVER=`echo $SSO_RESPONSE| cut -d ' ' -f 2|cut -d '/' -f 1,2,3`
  40. SSO_AUTH_URL=/sso/auth
  41. AUTH_DATA="ssousername=$SSO_USERNAME&password=$SSO_PASSWORD&site2pstoretoken=$SSO_TOKEN"
  42.  
  43. # The following command to authenticate uses HTTPS. This will work only if the wget in the environment
  44. # where this script will be executed was compiled with OpenSSL. Remove the --secure-protocol option
  45. # if wget was not compiled with OpenSSL
  46. # Depending on the preference, the other options are --secure-protocol= auto|SSLv2|SSLv3|TLSv1
  47. $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
  48.  
  49. rm -f sso.out
  50.  
  51.  
  52.  
  53.  
  54. $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=V46095-01_1of2.zip&token=SGg3bFViYmx6ZnNSM0YzUWU1RDhFUSE6OiF1c2VybmFtZT1FUEQtT1JBQ0xFMkBTUEFNR1VBUkQuV0FWRUxMLk5FVCZ1c2VySWQ9NzU5MTQ4MSZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVVTJmVtYWlsQWRkcmVzcz1vcmFjbGUyQHNwYW1ndWFyZC53YXZlbGwubmV0JmZpbGVJZD03MjE2Mjg4MSZhcnU9MTc4NDE3NTEmYWdyZWVtZW50SWQ9MTI1ODEyOCZzb2Z0d2FyZUNpZHM9MTc0MjExJnBsYXRmb3JtQ2lkcz0zNSZwcm9maWxlSW5zdGFuY2VDaWQ9NTUxOTU1Jm1lZGlhQ2lkPTIyOTM2MyZyZWxlYXNlQ2lkPQ" -O $OUTPUT_DIR/V46095-01_1of2.zip >> $LOGFILE 2>&1
  55.  
  56.  
  57.  
  58. $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=V46095-01_2of2.zip&token=aktwdlpaQTF3RlVxTC9NbTM5OWdFUSE6OiF1c2VybmFtZT1FUEQtT1JBQ0xFMkBTUEFNR1VBUkQuV0FWRUxMLk5FVCZ1c2VySWQ9NzU5MTQ4MSZjYWxsZXI9U2VhcmNoU29mdHdhcmUmY291bnRyeUlkPVVTJmVtYWlsQWRkcmVzcz1vcmFjbGUyQHNwYW1ndWFyZC53YXZlbGwubmV0JmZpbGVJZD03MjE2Mjg5MSZhcnU9MTc4NDE3NTEmYWdyZWVtZW50SWQ9MTI1ODEyOCZzb2Z0d2FyZUNpZHM9MTc0MjExJnBsYXRmb3JtQ2lkcz0zNSZwcm9maWxlSW5zdGFuY2VDaWQ9NTUxOTU1Jm1lZGlhQ2lkPTIyOTM2MyZyZWxlYXNlQ2lkPQ" -O $OUTPUT_DIR/V46095-01_2of2.zip >> $LOGFILE 2>&1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement