document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #!/bin/bash
  2.  
  3. if [ "$2" == "debug" ]; then set -x; fi
  4. applicationId="9nwGgQtrm7XXXXXXX"
  5. secretkey="lsqxaXXXrdMcXXXXXXXXXXXXXXXXX"
  6. URL="/api/0.6/pair/$1"
  7. LATCH="/ftp-data/latch.accounts"
  8.  
  9. if [ -z "$1" ]; then
  10.  echo -e "\\nUsage: SITE LATCH-REG <pair-key>\\n"
  11.  exit 0
  12. fi
  13.  
  14. if [ `grep "^$USER:" $LATCH | wc -l` -ne 0 ]; then
  15.  echo -e "\\nAlready registered\\n"
  16.  exit 0
  17. fi
  18.  
  19. requestSignature+="GET\\n"
  20. date=`date -u \'+%Y-%m-%d %H:%M:%S\'`
  21. requestSignature+="$date\\n\\n$URL"
  22.  
  23. signed=`echo -en "$requestSignature" | openssl dgst -sha1 -hmac "$secretkey" -binary|sed -e \'s|.*= \\(.*\\)|\\1|g\'`
  24. b64signed=`echo -n "$signed"|base64`
  25. auth_header="Authorization:11PATHS $applicationId $b64signed"
  26. date_header="X-11Paths-Date: $date"
  27.  
  28. JSON=`wget -q --no-check-certificate -O - --header "$auth_header" --header "$date_header" "https://latch.elevenpaths.com$URL"`
  29. accountid=`echo "$JSON" | sed -e \'s|.*accountId":"\\(.*\\)"}.*|\\1|\'| sed -e \'s|\\(.*\\)".*|\\1|g\'`
  30. if [ -z $accountid ]; then
  31.  echo "Error."
  32. else
  33.  echo "$USER:$accountid" >> $LATCH
  34.  echo -e "\\nDone.\\n"
  35. fi
');