Okay.
So in this example, I've got a Telnet script that I've written, I'm going to import py shock.
I'm going to capture traffic off the wire in real time on the saboteur.
Host on Ethernet zero.
I've got a loop once again looking for telnet traffic.
So is it telnet in the packet?
If it is, look for username in the string.
In other words, look for username in the output of the packet.
If you see username, print the username.
If you see password then print the password.
Now telnet isn't as nice as the other protocols and that's because the username and password are sent
in individual packets.
So we're not going to see everything as clearly as we saw with the other scripts, but that's not going
to stop us.
We'll still be able to capture the username and password.
So again, cat telnet p y there's our script.
Let's run Python to capture the username and password.
What I'll do in this example is use ubuntu two to telnet to the router.
So there's a boon to one which is our hacking server.
Here is a bunch of two router IP address.
Is 1921681 2282.
So telnet 1921681 2282.
Notice we suddenly see some output here.
So it's seeing something.
It's captured this thing called password.
Put the password in.
Don't if you saw that notice.
See, I.
Esko.
There's the Telnet password.
There's a prompt tap enable password.
There's the enabled password, Cisco.
Show Run.
We can see the running config here.
Now again, Telnet doesn't do this very nicely because the data is all over the place.
So I've kind of tried to highlight here that you must look for password after you see this line.
So let's change the the way the Cisco router works.
I'll say username David password, Cisco.
And rather than just using a standard password, I'll say login local.
So a username and password are used when I tell it to the writer.
Okay.
So let me go to the end here.
Tell it to the writer.
Notice we see username.
So we told be careful your username is going to be displayed now.
David.
There you can see the username.
David.
Now it gets copied twice because we're seeing the traffic from the PC to the router and from the router
to the PC password.
Cisco.
You can see that.
Yes, Cisco is the password.
It was only sent once because we don't see the password in the output here.
Top enable.
We can see that there there's enable.
Notice we are warned another password is going to be displayed here.
So I'll put the password in.
There's our password of Cisco.
So again, Telnet isn't as good as OSPF or FTP or other protocols when it comes to capturing traffic.
It's a bit all over the place, but you could save this to a file and then simply do a search for a
keyword like I've done here, a bunch of lines and password, and then you know that the password is
just off to that.
Or you could do a search for the actual keyword password and see the passwords in the text just after
that.
So there is my positive Cisco notice as an example, if we tap show run here, we'll see the actual
password in the output here like this.
And if I scroll down, I'll see.
The passport over here.
Okay, so, telnet, isn't that great?
Not that easy to do it as cleanly as the other protocols.
But there's my basic python script.
And again, in this example, I'm using sublime text.
Nice idea.
There are many others out there that are very good.
You can see that the script looks a lot nicer in sublime text.
Yes, my OSPF script.
It's only a few lines.
Here's my FTP script.
Here's my Telnet script.
You could take these scripts and change them and make them a lot more powerful.
I just wanted to show you a little bit about what Python can be used for and inspire you to think about
the options available to you.
Download these scripts and see what you can do with them.
As always, be careful.
Hacking Networks.
Make sure that you have permission to hack those networks or to grab usernames and passwords off those
networks.