Advertisement
Guest User

unreg.sh

a guest
Dec 20th, 2013
5,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. if [ "$1" == "debug" ]; then set -x; fi
  4. applicationId="9nwGgQXXXXXXXXXX"
  5. secretkey="lsqXXXXXsJrdMcXXXXXXXXXXXXX"
  6. LATCH="/ftp-data/latch.accounts"
  7. account=`grep "^$USER:" $LATCH |cut -d: -f2`
  8. URL="/api/0.6/unpair/$account"
  9.  
  10. if [ -z "$account" ]; then echo -e "Error.";  exit 0; fi
  11.  
  12. requestSignature+="GET\n"
  13. date=`date -u '+%Y-%m-%d %H:%M:%S'`
  14. requestSignature+="$date\n\n$URL"
  15.  
  16. signed=`echo -en "$requestSignature" | openssl dgst -sha1 -hmac "$secretkey" -binary|sed -e 's|.*= \(.*\)|\
  17. 1|g'`
  18. b64signed=`echo -n "$signed"|base64`
  19. auth_header="Authorization:11PATHS $applicationId $b64signed"
  20. date_header="X-11Paths-Date: $date"
  21.  
  22. JSON=`wget -q --no-check-certificate -O - --header "$auth_header" --header "$date_header" "https://latch.el
  23. evenpaths.com$URL"`
  24. grep -v "^$USER:" $LATCH > /tmp/$$.tmp
  25. mv /tmp/$$.tmp $LATCH
  26. echo -e "\nDone.\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement