Invoke-AKSH and easily manage your local lab
Having worked on AKSH (my Discord bot) and witnessing how easy it made deploying and managing a lab on AWS, I wanted something similar for my local lab as well. On my local machines I use VMWare Workstation to create and manage virtual labs. Even though it has an intuitive GUI, it lacks a mechanism to perform actions (start, stop, snapshot, revert etc.) on multiple virtual machines via single click (maybe that’s where vSphere comes in!). However, to compensate for that, it exposes a command line interface (vmrun.exe) that can aid in automating actions on multiple virtual machines.
That’s where Invoke-AKSH comes in. It adds a bit of PowerShell scripting magic on top of vmrun.exe and automates the management of a local lab via single command.
Supported actions
Invoke-AKSH automates the following actions:
start – start the entire lab
stop – stop the entire lab
suspend – suspend or hibernate the entire lab
pause – pause the entire lab
unpause – unpause the entire lab
snapshot – create snapshot of the entire lab (while performing this action it checks if a previous snapshot exists. If it finds one, it deletes that snapshot and creates a new one. It does not account for snapshots taken manually from the GUI)
revert – revert the entire lab to a previous snapshot (It does not account for snapshots taken manually from the GUI)
It can be used to perform all of the above actions on a single virtual machine as well.
Invoke-AKSH at work
Here are few screenshots demonstrating Invoke-AKSH being used to manage a local version of Tax First Labz (companion red team lab for my course Red Team Adversary Emulation):
Next steps
Support multiple labs – In it’s current form, Invoke-AKSH can manage a single lab. To be able to use it with multiple labs, a copy of the script needs to be placed in all lab folders. Not a neat way of doing things!
Integrate with KFKA (another Discord bot of mine) – Imagine how cool it will be if Invoke-AKSH can be invoked via Discord. No need to even launch the PowerShell terminal!
Backup and restore the entire lab – A single command to backup and restore the entire lab to and from a network share. No need to remember scp / sftp syntax!
Have comments or suggestions? Reach out to me via Twitter @udmittal