-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaws-pt.sh
More file actions
executable file
·30 lines (26 loc) · 911 Bytes
/
aws-pt.sh
File metadata and controls
executable file
·30 lines (26 loc) · 911 Bytes
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
#!/bin/bash
echo "[*]Checking if AWS credentials are present"
sleep 1
if [[ -f ~/.aws/credentials ]] ; then
echo "[+]Fetching Credentials"
else
echo "[-]Please Configure AWS CLI"
exit
fi
#Add test to check if the ~/.aws/config file is present
response=$(curl --write-out %{http_code} --silent --output /dev/null s3.amazonaws.com/$1)
if [ $response -eq 404 ] ; then
printf "\033[1;31m[-]Please check the bucket name. Bucket not found $1\033[0m\n"
exit
else
if [ $response -eq 403 ] ; then
printf "\033[1;31m[-]No Read Access without Key\033[0m\n"
aws s3 ls s3://$1 > RESULTS
printf "\033[1;31m[+]Misconfigured ACL - Access with Any Key in $1\033[0m\n"
echo "[*]Check RESULTS to view the bucket contents"
else
aws s3 ls s3://$1 --no-sign-request > RESULTS
printf "\033[1;31m[+]Misconfigured ACL - Univeral Access in $1\033[0m\n"
echo "[*]Check RESULTS to view the bucket contents"
fi
fi