In this demo, I'm going to run through a few of these and show you the output.
To be honest, not all that exciting of a demo so far.
As you can see,
each of these pretty much run as expected while running
commands from the command prompt.
Now where this gets a little tricky,
and I'll open it in the command prompt to make it easier for you to read,
is when we start a new process and call an application from that prompt.
In the first example,
I'm calling out an OWASP tool called ZAP and asking it to
kick off a passive scan of example.com.
So while I run that,
think of some of the possibilities of where you can set up
scripts for your dev teams to run that will scan the lower
environment application they are developing and return a log of
potential issues to the screen.
Now, we're not going to go through all of that right now,
but one thing I did want to point out is you see
here as soon as I ran the script,
the finished text displayed even though the ZAP application is still running.
Now let's start a new process again, this time of a different application.
We're going to go with notepad.exe.
And when I start this script over again,
you will see the subprocess kick off to open Notepad. But as you
can see, the finished text hasn't displayed yet. The text won't
display until a Notepad process is killed.
So, that is why I said make sure you test it and play with it to make sure
it is running and responding as expected throughout.
Back to the ZAP executable, but instead of kicking it off with the run method,
I'm going to kick it off with this check_output method.
It is the method that determines the outcome of the
subprocess executing before moving on.
So unlike run, which immediately moved on in the script,
the check_output method is waiting for the ZAP tool to close.
Now this is where you can run a scan and dump the output into a results
folder at which time you can have a script redirect you to the folder
and start to parse the outcome without having to run a new script or
rerun the one that you just finished.