SSH/Telnet program to Router/switch

Roy Smith roy at
Wed Feb 19 14:35:00 CET 2014

In article <d343f9af-54f2-4709-9a99-1ad5708c1f34 at>,
 Sujith S <sujiths80 at> wrote:

> Hi,
> I am new to programming and python. I am looking for a python script to do 
> ssh/telnet to a network equipment ? I know tcl/perl does this using 
> expect/send. 
> Do we have expect available in python as well or need to use some other 
> method ?

You want two libraries.

First, the low-level paramiko ( which 
handles all the basic ssh connection stuff.

Next, fabric (, which layers a very easy 
to use application layer on top of paramiko.  Fabric is most commonly 
used in conjunction with a near command-line driver tool called fab, but 
you can also work directly with the library layer 

Fabric rocks.  Don't waste your time with anything else (but see the 
next paragraph).

As far as I know, fabric only works with ssh.  If you are forced to use 
telnet to talk to legacy equipment, that's another problem.

More information about the Python-list mailing list