Skip to content

Instantly share code, notes, and snippets.

@sobelk
Created November 25, 2011 17:18
Show Gist options
  • Save sobelk/1394006 to your computer and use it in GitHub Desktop.
Save sobelk/1394006 to your computer and use it in GitHub Desktop.
TD Bank check balance shell script
#!/usr/bin/sh
DOMAIN="onlinebanking.tdbank.com"
COOKIEJAR="cookiejar-tdbank"
USERAGENT='Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2'
USERNAME="username"
read -sp "Password: " PASSWORD; echo
curl \
--silent \
--user-agent "$USERAGENT" \
--cookie-jar $COOKIEJAR \
--cookie $COOKIEJAR \
--data-urlencode "user=$USERNAME" \
--data-urlencode "pin=$PASSWORD" \
"https://$DOMAIN/voyLogin.asp" > /dev/null
curl \
--silent \
--user-agent "$USERAGENT" \
--cookie-jar $COOKIEJAR \
--cookie $COOKIEJAR \
--data-urlencode "user=$USERNAME" \
--data-urlencode "pin=$PASSWORD" \
"https://$DOMAIN/accts/getAccts.asp?fname=SCRIPT" \
| egrep '\$[0-9,.]+' \
| sed 's/.*$\([0-9,.]*\).*/\1/' \
| head -n1
rm $COOKIEJAR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment