Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2016
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. #!/bin/bash
  2. # author: dustin breese
  3. # desc: this will log into BT systems and will obtain a subversion token
  4.  
  5. # Uncomment the following two lines and fill out your details if you don't want to constantly enter your EIN and PWD
  6. # Alternatively, you can create a ".gettok_rc" file in your home directory and add USERNAME= and PASSWORD= to it.
  7. unset https_proxy
  8. unset http_proxy
  9. USERNAME=609687800
  10. PASSWORD=Support2016
  11. echo $USERNAME
  12. echo ""
  13. read -p "One time token: " TOKEN
  14. KEEPALIVEURL=https://collaborate.bt.com/svn/fv/BTMagentaAndroid/trunk/
  15. curl \
  16. --cookie-jar /tmp/cookies.$$ \
  17. --dump-header /tmp/headers.$$ \
  18. -dtz_offset=0 \
  19. -dusername=${USERNAME} \
  20. -dtoken=${TOKEN} \
  21. -dpassword=\#${PASSWORD}\|${TOKEN} \
  22. -dtypedpassword=${PASSWORD} \
  23. -drealm=Siteminder \
  24. -d'btnSubmit=Sign In' \
  25. https://idesk.bt.com/dana-na/auth/url_default/login.cgi
  26.  
  27. #https://www.mybt.bt.com/dana-na/auth/url_44/login.cgi
  28.  
  29. grep ^location: /tmp/headers.$$ | grep failed
  30. if [ $? == 0 ]; then
  31. echo FAILED: Bad Token
  32. exit 1
  33. fi
  34. USERNAME_B64=$( echo -n $USERNAME | openssl enc -base64 )
  35. PASSWORD_B64=$( echo -n $PASSWORD | openssl enc -base64 )
  36. curl \
  37. --silent \
  38. --cookie /tmp/cookies.$$ \
  39. --cookie-jar /tmp/cookies.$$ \
  40. --dump-header /tmp/headers.$$ \
  41. -d"
  42. <soapenv:Envelope xmlns:ns=\"http://collaborate.bt.com/svn/rsa/2010/02\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">
  43. <soapenv:Body>
  44. <username>${USERNAME_B64}</username>
  45. <password>${PASSWORD_B64}</password>
  46. </soapenv:Body>
  47. </soapenv:Envelope>
  48. " \
  49. https://idesk.bt.com/svnauthenticator/service/SvnAuthenticator/,DanaInfo=collaborate.bt.com,SSL,dom=1,CT=sxml+ > /tmp/token.$$
  50.  
  51. AUTH_TOKEN=$( sed 's/^.*authtoken:/authtoken:/' /tmp/token.$$ | sed 's/<.*$//' )
  52. echo "Subversion Token: ${AUTH_TOKEN}"
  53.  
  54. rm /tmp/cookies.$$
  55. rm /tmp/headers.$$
  56. rm /tmp/token.$$
  57. /usr/bin/svn up --username $USERNAME --password ${AUTH_TOKEN}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement