Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # author: dustin breese
- # desc: this will log into BT systems and will obtain a subversion token
- # Uncomment the following two lines and fill out your details if you don't want to constantly enter your EIN and PWD
- # Alternatively, you can create a ".gettok_rc" file in your home directory and add USERNAME= and PASSWORD= to it.
- unset https_proxy
- unset http_proxy
- USERNAME=609687800
- PASSWORD=Support2016
- echo $USERNAME
- echo ""
- read -p "One time token: " TOKEN
- KEEPALIVEURL=https://collaborate.bt.com/svn/fv/BTMagentaAndroid/trunk/
- curl \
- --cookie-jar /tmp/cookies.$$ \
- --dump-header /tmp/headers.$$ \
- -dtz_offset=0 \
- -dusername=${USERNAME} \
- -dtoken=${TOKEN} \
- -dpassword=\#${PASSWORD}\|${TOKEN} \
- -dtypedpassword=${PASSWORD} \
- -drealm=Siteminder \
- -d'btnSubmit=Sign In' \
- https://idesk.bt.com/dana-na/auth/url_default/login.cgi
- #https://www.mybt.bt.com/dana-na/auth/url_44/login.cgi
- grep ^location: /tmp/headers.$$ | grep failed
- if [ $? == 0 ]; then
- echo FAILED: Bad Token
- exit 1
- fi
- USERNAME_B64=$( echo -n $USERNAME | openssl enc -base64 )
- PASSWORD_B64=$( echo -n $PASSWORD | openssl enc -base64 )
- curl \
- --silent \
- --cookie /tmp/cookies.$$ \
- --cookie-jar /tmp/cookies.$$ \
- --dump-header /tmp/headers.$$ \
- -d"
- <soapenv:Envelope xmlns:ns=\"http://collaborate.bt.com/svn/rsa/2010/02\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">
- <soapenv:Body>
- <username>${USERNAME_B64}</username>
- <password>${PASSWORD_B64}</password>
- </soapenv:Body>
- </soapenv:Envelope>
- " \
- https://idesk.bt.com/svnauthenticator/service/SvnAuthenticator/,DanaInfo=collaborate.bt.com,SSL,dom=1,CT=sxml+ > /tmp/token.$$
- AUTH_TOKEN=$( sed 's/^.*authtoken:/authtoken:/' /tmp/token.$$ | sed 's/<.*$//' )
- echo "Subversion Token: ${AUTH_TOKEN}"
- rm /tmp/cookies.$$
- rm /tmp/headers.$$
- rm /tmp/token.$$
- /usr/bin/svn up --username $USERNAME --password ${AUTH_TOKEN}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement