Jrhenderson11 / pentesting-az-templates

Collection of az templates / scripts for pentesting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pentesting-az-templates

Collection of az templates / scripts for pentesting.

How to use

#!/bin/zsh
rg=o365-rg
loc="uksouth"

user="o365admin"
password=$(diceware -d "-")
fname=office_vm

/usr/bin/ssh-keygen -C "" -t ecdsa -f $fname -P ""
ssh_pubkey=$(cat $fname.pub)

echo "[-] $fg[green]SSH key generated$fg[reset_color]"

az group create --name $rg --location $loc
output=$(az deployment group create --resource-group $rg --template-uri https://raw.githubusercontent.com/Jrhenderson11/pentesting-az-templates/main/windows/office-with-ssh/azuredeploy.json --parameters vmAdminUserName=$user vmAdminPassword=$password dnsLabelPrefix="o365vm-pip" location=$loc publicSshKey=$ssh_pubkey)
ssh_string="$(echo $output | jq .properties.outputs.sshhost_connect.value | python3 -c "print(input()[1:-1])") -i office_vm"

echo "------------------------------------"
echo "[-] $fg[green]VM deployed:$fg[reset_color]"
echo $ssh_string
echo "[-] $fg[green]Password: $password$fg[reset_color]"
echo "------------------------------------"

# Get ip
az vm list-ip-addresses -g $rg --name O365VM | grep ipAddress

# RDP
xfreerdp /u:"o365admin" /v:o365vm-pip.uksouth.cloudapp.azure.com:3389 /f +fonts /floatbar /smart-sizing -grab-keyboard /sound /microphone /multimon

# Delete
az deployment group delete -g $rg -n azuredeploy
az group delete --name $rg

https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-use-parameter-file?tabs=azure-powershell https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/variables

TODO

Acknowledgements

scripts frankensteined from following sources:

About

Collection of az templates / scripts for pentesting


Languages

Language:PowerShell 100.0%