Created
November 19, 2019 22:37
-
-
Save BatteryCandy/f5d89fa2366ff9a82e8c694b3e22a341 to your computer and use it in GitHub Desktop.
Run cloudmapper against all accounts, rename each file and create an index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
profile=$(awk '/\[/ {print $2}' ~/.aws/config | sed 's/.$//') | |
profiles=( $profile ) | |
for i in "${profiles[@]}" | |
do | |
python3 cloudmapper.py iam_report --account $i | |
mv ./web/account-data/iam_report.html ./web/account-data/iam_report_${i}.html | |
done | |
echo "<!DOCTYPE html> | |
<html lang="en"> | |
<h1>CloudMapper IAM Report</h1> | |
<body>" >> ./web/account-data/index.html | |
for i in ./web/account-data/iam_report_*.html; do | |
ref="${i/.\/web\/account-data\//}" | |
name="${ref%.html}" | |
account="${name/iam_report_/}" | |
echo "<a href=\"${ref}\">${account}</a><br>" >> ./web/account-data/index.html | |
done | |
echo "</body></html>" >> ./web/account-data/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment