Re: SSH/Telnet program to Router/switch

2014-02-27 Thread Rodrick Brown


Sent from my iPhone

 On Feb 20, 2014, at 5:59 AM, Ferrous Cranus nikos.gr...@gmail.com wrote:
 
 Τη Τετάρτη, 19 Φεβρουαρίου 2014 10:45:53 π.μ. UTC+2, ο χρήστης Wojciech 
 Łysiak έγραψε:
 On 19.02.2014 09:14, Sujith S 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 ?
 
 
 
 Hello,
 
 If you are looking for a way to connect to your netdevices and then
 
 execute some shell commands (with output) via ssh then google for
 
 paramiko module for python.
 
 
 
 It works on windows and linux.
 
 
 
 -- 
 
 BR,
 
 Wojtek
 
 Hello,
 
 What will benefit the OP to go ahead and use paramiko opposed to just use 
 Putty or another perhaps even Chrome based ssh client?
 
 Is there an advantage to that?
This is a Python mailing list so obviously the OP wants to use python to 
automate logging into his devices and dispatching some commands. Why else would 
they ask here? 

 -- 
 https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-25 Thread Ferrous Cranus
Τη Τετάρτη, 19 Φεβρουαρίου 2014 10:45:53 π.μ. UTC+2, ο χρήστης Wojciech Łysiak 
έγραψε:
 On 19.02.2014 09:14, Sujith S 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 ?
 
 
 
 Hello,
 
  If you are looking for a way to connect to your netdevices and then
 
 execute some shell commands (with output) via ssh then google for
 
 paramiko module for python.
 
 
 
 It works on windows and linux.
 
 
 
 -- 
 
 BR,
 
 Wojtek

Hello,

What will benefit the OP to go ahead and use paramiko opposed to just use 
Putty or another perhaps even Chrome based ssh client?

Is there an advantage to that?
-- 
https://mail.python.org/mailman/listinfo/python-list


SSH/Telnet program to Router/switch

2014-02-19 Thread Sujith S
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 ?

Regards
Sujith
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Chris Angelico
On Wed, Feb 19, 2014 at 7:14 PM, Sujith S sujith...@gmail.com 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 ?


Yep! Look up the socket module. Straight-forward TCP sockets are
usually easy enough to work.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Wojciech Łysiak
On 19.02.2014 09:14, Sujith S 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 ?

Hello,
 If you are looking for a way to connect to your netdevices and then
execute some shell commands (with output) via ssh then google for
paramiko module for python.

It works on windows and linux.

-- 
BR,
Wojtek
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Johannes Schneider

On 19.02.2014 09:14, Sujith S 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 ?

Regards
Sujith





I'm using paramiko to access some routers and firewalls from python and 
it works very well.


bg,
Johannes


--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Roy Smith
In article d343f9af-54f2-4709-9a99-1ad5708c1...@googlegroups.com,
 Sujith S sujith...@gmail.com 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 (http://www.lag.net/paramiko/) which 
handles all the basic ssh connection stuff.

Next, fabric (http://docs.fabfile.org/en/1.8/), 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 
(http://docs.fabfile.org/en/1.8/usage/library.html).

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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Chris Angelico
On Thu, Feb 20, 2014 at 12:35 AM, Roy Smith r...@panix.com wrote:
 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.

If it's telnet, it's likely to be a pretty simple protocol. All you
really need is the socket module, build it all yourself. Networking's
easy enough to handle; it's the crypto on top of it (SSH, in your
case) that's not worth doing manually.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Roy Smith
In article roy-f02fd5.08350019022...@news.panix.com,
 Roy Smith r...@panix.com wrote:

 in conjunction with a near command-line driver tool called fab

Typo there: near should have been neat.

[this is why I love wikis]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread William Ray Wing
On Feb 19, 2014, at 3:14 AM, Sujith S sujith...@gmail.com 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 ?
 
 Regards
 Sujith
 -- 
 https://mail.python.org/mailman/listinfo/python-list

In addition to the other answers you've received (and noting that you are 
familiar with expect), you might want to investigate the pexpect module. 
Google will give you quite a long list of references to it, but you could start 
here:  http://pexpect.readthedocs.org/en/latest/

-Bill
-- 
https://mail.python.org/mailman/listinfo/python-list