Automation is a great way to test reliability in what you are doing, and to help ensure that your process is repeatable.
Why automate?
There are a lot of reasons to automate, however three reasons that often prompt me to look at automating my solutions are the following:
Repeatability - Being able to repeat the process is important for any task that I need someone else to replicate
Reliability - Being able to have a repeatable process increases the chance I find any errors and allows consistency with deployment
Building complexity - With complex tasks that involve multiple pieces working together, it can be difficult to understand how a small change in one place impacts the overall repeatability or reliability of the entire chain. With automation, the impact of small changes can be better understood.
Example
Part of automating is building tools to help your workflow through increased consistency and potentially also when troubleshooting!
One of the newest SCYTHE features is easier shellcode availability for customers. I wanted to build some examples of using this new feature for customers to leverage that may not already be familiar with shellcode. There is a ton of great blogs on leveraging shellcode from tools like Metasploit, including the ired.team blog here.
That blog highlights using the MSBuild MITRE ATT&CK Sub-Technique T1127.001 leveraged by adversaries to execute code. After walking through that blog post, I wanted to automate that process so I wrote a script to do part of the job for me.
I found that there were a few items that changed for me between executions that automating helped me troubleshoot faster:
Escape characters - This is a writing out characters with Python issue, but making sure to add an extra ‘\’ to escape certain characters is necessary
32 vs 64 bit shellcode - This is a major difference that not only requires changes to the XML document generated, but also leverages another 64 bit loader for execution afterward
Python vs PowerShell for base64 encoding - Some of the possible ways to output base64 encoded characters in Python do not work for decoding and executing in PowerShell, so making sure these encodings match up is important!