OK so let's run off script.
Oh SPF dot P. why hopefully what we'll see.
Oh SPF passwords.
And there you go.
Oh SPF password is Cisco.
Now on the Cisco Rada once again I could change that password so interface gigabit 00 IP o SPF authentication
key.
Let's set it to 0 SPF POS.
What should happen is our python script should show us the new SPF password.
This has been captured off the wire in real time.
And there you go.
Oh SPF pass.
So my simple python script and all catatonia or SPF dopey why this simple python script is capturing
packets off the wire and then displaying the password.
Now you may want to save that to a file rather than have it just print to the screen so as an example
nano 0 SPF dot P. why let's rather than just printed to the screen save it to a file sole credit variable
called my file I'll open up a file called and let's make this 0 SPF passwords dot text.
This is gonna be a rectangle file.
So basically I'm opening up a file with this name.
I don't have to use text.
I'll just use that to be consistent with say what Windows does.
It's a read write file and then I'm gonna write the output to this file.
Now that's actually writing the packet so let's not do that.
Let's say write 0 SPF POS equals this
so equals the 0 SPF password string plus the actual password and then I'm gonna write the 0 SPF pass
here.
And if you concerned that it's actually the same word I'll just change it.
He had to something else.
So this is just a variable called 0 SPF password that equals 0 SPF password plus the actual password
that's captured.
We're opening up a file and then we're going to save that to the file.
And actually what I will do here is I don't want to open the file up every time because it'll overwrite
it.
I'll open up the file there and then write to the file.
Per that output so it'll write the password consistently to the file name coding this on the fly so
hopefully my code isn't that bad.
So let's give it a go.
I'll run the script.
We won't see anything because we're not writing to the screen in this example.
I'm just saving the information to a file but hopefully stop that script now.
Hopefully
we've got a file called SPF password which we do.
And if I kept that which is basically reading it notice we can see SPF password is 0 SPF pass or SPF
password and then we get a prompt.
Now that's not such a great way to do it.
So like all things when it comes to coding you iterate you iterate what you what you do.
So what I'll do is write that but put a carriage return after it and let's see what that does
so run it again.
Python 3 0 SPF dot P Y.
Very simple script.
Okay.
Didn't like that.
Let's see what I did wrong here.
Let's add that Mike bat.
That looks better.
This is the thing with coding you know start with a small script.
Try something.
See if it works.
Then try something else.
See if that works.
Keep iterating and keep improving your scripts.
Okay so that's should be long enough to clear the screen
Alice shows us our files.
Cat 0 SPF password or T X T.
Notice there's a password with the carriage returns after it.
Okay so just to make the point I'll run that again.
And then what I'll do here is clear the process but then I'll go on to the interface and change the
password to something else.
So let's set it to Hello.
1 2 3 so that should display in our text file.
Now again you could use cron to schedule this or end that now rather than running it interactively just
schedule this to run in the background and notice there is a password.
Hello.
One two three.
So I could as an example do this.
Notice I've started this script.
It's running in the background and I've got my terminal prompt now.
If I type top so notice top shows us that t shock is running in the background.
So is Python 3.
So that script is busy running in the background.
What I could do is kill the process so let's kill t shock kill process 1 2 4 8 and notice we see some
output that the script is done so clear the screen.
Alice shows us our files.
Let's read that 0 SPF password file.
Notice there's the password written to the file.
Now you could get fancy with your scripts you could get cron to kickstart that script and then run it
for a period of time.
So let's run it for half an hour or run it for a day or for a period of time you could get your script
to email you the passwords do all kinds of things.
The moral of the story here is you can leverage python and T shark to capture packets of the wire and
then do things.
So let me show you another example.
In the next video I'll show you how to use this to capture for instance FCP passwords.