This file is indexed.

/usr/bin/anc-cmd is in anc-api-tools 2010.12.30.1-0ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
#       This file is part of anc-api-tools.
#       
#       anc-api-tools is free software: you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation, either version 3 of the License, or
#       (at your option) any later version.
#       
#       anc-api-tools is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with anc-api-tools.  If not, see <http://www.gnu.org/licenses/>.
#       
#       Written by Atlantic.Net <see AUTHORS file for additional information>
#       for use with Atlantic.Net's Public Cloud - http://cloud.atlantic.net

ANC_VERSION="2010-12-30"
ANC_BASE_URL="https://cloud.atlantic.net/api.php/?"
ANC_CURL_OPTIONS=""
ANC_WGET_OPTIONS="--quiet --output-document=-"

#Make sure all of our variables are set correctly.

#Make sure ANC_ACCESS_KEY_ID is set:
if [ ! -n "$ANC_ACCESS_KEY_ID" ]; then
	echo "Variable ANC_ACCESS_KEY_ID is not set. Please make sure the ANC_ACCESS_KEY_ID is set with the full path and file name of your ANC Access Key ID."
	exit 1
fi

#Make sure ANC_ACCESS_KEY_ID is readble:
if [ ! -r "$ANC_ACCESS_KEY_ID" ]
then
	echo "ANC_ACCESS_KEY_ID file $ANC_ACCESS_KEY_ID is not readable by user $USER. Please make sure that the file set in variable ANC_ACCESS_KEY_ID is readable by $USER."
	exit 1
fi

#Put the ANC Access Key ID into a variable:
ANC_ACCESS_KEY_ID_VALUE="`cat $ANC_ACCESS_KEY_ID`"

#ANC_PRIVATE_KEY variable:

#Make sure ANC_PRIVATE_KEY is set:
if [ ! -n "$ANC_PRIVATE_KEY" ]; then
	echo "Variable ANC_PRIVATE_KEY is not set. Please make sure the ANC_PRIVATE_KEY is set with the full path and file name of your ANC Private Key."
	exit 1
fi

#Make sure ANC_PRIVATE_KEY is readble:
if [ ! -r "$ANC_PRIVATE_KEY" ]
then
	echo "ANC_PRIVATE_KEY file $ANC_PRIVATE_KEY is not readable by user $USER. Please make sure that the file set in variable ANC_PRIVATE_KEY is readable by $USER."
	exit 1
fi

#Put the ANC Private Key into a variable:
ANC_PRIVATE_KEY_VALUE="`cat $ANC_PRIVATE_KEY`"

#Convert the actions and verbs to a valid URL:
for ANC_OPTION in $*
do
		#Split the verb from the action:
        ANC_VERB="`echo $ANC_OPTION | cut -d '=' -f 1`"
        ANC_ACTION="`echo $ANC_OPTION | cut -d '=' -f 2-`"
        
        #URL encode the verb and the action:
        ANC_VERB="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$ANC_VERB")"
        ANC_ACTION="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$ANC_ACTION")"
        
        #Rejoin the verb and the action:
        ANC_OPTIONS="${ANC_OPTIONS}${ANC_VERB}=${ANC_ACTION}&"
done

#Remove the last ampersand appended by the above for loop:
ANC_OPTIONS="`echo $ANC_OPTIONS | sed 's/&$//'`"

#Create the rndguid:
ANC_RNDGUID=`uuidgen -r`

#Get the current unix timestamp:
ANC_SECONDS_SINCE_EPOCH=`date +%s`

#Create the string that needs to be encoded to make the signature:
ANC_STRING_TO_SIGN=$ANC_SECONDS_SINCE_EPOCH$ANC_RNDGUID

#Create a hash of the signature using sha256 and then base64 encode the sha256 hash:
ANC_SIGNATURE=`echo -n "$ANC_STRING_TO_SIGN" | openssl dgst -sha256 -hmac "$ANC_PRIVATE_KEY_VALUE" -binary | openssl enc -base64`

#URL encode the signature:
ANC_SIGNATURE="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$ANC_SIGNATURE")"

#Create the full URL to call:
ANC_URL="${ANC_BASE_URL}&${ANC_OPTIONS}&Version=${ANC_VERSION}&ACSAccessKeyId=${ANC_ACCESS_KEY_ID_VALUE}&Timestamp=${ANC_SECONDS_SINCE_EPOCH}&Rndguid=${ANC_RNDGUID}&Signature=${ANC_SIGNATURE}"

#Execute the command via curl:
curl $ANC_CURL_OPTIONS "$ANC_URL"

#curl doesn't exist in this system's $PATH so execute the command via wget:
if [ $? -eq 127 ]
then
	wget $ANC_WGET_OPTIONS "$ANC_URL"
fi

#Both curl and wget don't exist in this system's $PATH. Notify the console and exit:
if [ $? -eq 127 ]
then
	echo "$0 version $ANC_VERSION error: Commands curl and wget not found in $PATH." >&2
	exit 1
fi