SHOW:
|
|
- or go back to the newest paste.
1 | #!/bin/bash | |
2 | ||
3 | if [ "$1" == "debug" ]; then set -x; fi | |
4 | - | applicationId="9nwGgQtrm7v4ScSJOQsq" |
4 | + | applicationId="9nwGgQXXXXXXXXXX" |
5 | - | secretkey="lsqxavsJrdMcXOIkk9SF0f68VbdO1IOghnHj3I61" |
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" |