Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ "$1" == "debug" ]; then set -x; fi
- applicationId="INSERT app ID HERE"
- secretkey="INSERT secret key HERE"
- LATCH="/root/home/latch.accounts"
- account=`grep "^$USER:" $LATCH |cut -d: -f2`
- URL="/api/0.6/unpair/$account"
- if [ -z "$account" ]; then echo -e "Error."; exit 0; fi
- requestSignature+="GET\n"
- date=`date -u '+%Y-%m-%d %H:%M:%S'`
- requestSignature+="$date\n\n$URL"
- signed=`echo -en "$requestSignature" | openssl dgst -sha1 -hmac "$secretkey" -binary|sed -e 's|.*= \(.*\)|\1|g'`
- b64signed=`echo -n "$signed"|base64`
- auth_header="Authorization:11PATHS $applicationId $b64signed"
- date_header="X-11Paths-Date: $date"
- JSON=`wget -q --no-check-certificate -O - --header "$auth_header" --header "$date_header" "https://latch.elevenpaths.com$URL"`
- grep -v "^$USER:" $LATCH > /tmp/$$.tmp
- mv /tmp/$$.tmp $LATCH
- echo -e "\nDone.\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement