Skip to content

Instantly share code, notes, and snippets.

@luissantos
luissantos / pre-commit
Created August 12, 2016 20:57 — forked from DmZ/pre-commit
Git pre-commit hook to search for Amazon AWS API keys.
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@luissantos
luissantos / gist:80ea2f64d30a1a524be7876040f3ef08
Created August 12, 2016 12:26 — forked from oli-logicnow/gist:da1be4c9dccadb94670338e21bf4f348
Find all the keys and their associated user for a specific account
export PROFILE=XXXX
for USER in `aws --profile $PROFILE iam list-users --query 'Users[].UserName' --output text`
do
for KEY in `aws --profile $PROFILE iam list-access-keys --user-name "$USER" --query 'AccessKeyMetadata[].AccessKeyId' --output text`
do
echo $USER $KEY
done
done