Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66674 > unrolled thread
| Started by | Sujith S <sujiths80@gmail.com> |
|---|---|
| First post | 2014-02-19 00:14 -0800 |
| Last post | 2014-02-19 09:27 -0500 |
| Articles | 10 — 8 participants |
Back to article view | Back to comp.lang.python
SSH/Telnet program to Router/switch Sujith S <sujiths80@gmail.com> - 2014-02-19 00:14 -0800
Re: SSH/Telnet program to Router/switch Chris Angelico <rosuav@gmail.com> - 2014-02-19 19:45 +1100
Re: SSH/Telnet program to Router/switch Wojciech Łysiak <wojciech.lysiak@hotmail.com> - 2014-02-19 09:45 +0100
Re: SSH/Telnet program to Router/switch Ferrous Cranus <nikos.gr33k@gmail.com> - 2014-02-20 02:59 -0800
Re: SSH/Telnet program to Router/switch Rodrick Brown <rodrick.brown@gmail.com> - 2014-02-25 07:53 -0500
Re: SSH/Telnet program to Router/switch Johannes Schneider <johannes.schneider@galileo-press.de> - 2014-02-19 11:36 +0100
Re: SSH/Telnet program to Router/switch Roy Smith <roy@panix.com> - 2014-02-19 08:35 -0500
Re: SSH/Telnet program to Router/switch Chris Angelico <rosuav@gmail.com> - 2014-02-20 00:58 +1100
Re: SSH/Telnet program to Router/switch Roy Smith <roy@panix.com> - 2014-02-19 09:13 -0500
Re: SSH/Telnet program to Router/switch William Ray Wing <wrw@mac.com> - 2014-02-19 09:27 -0500
| From | Sujith S <sujiths80@gmail.com> |
|---|---|
| Date | 2014-02-19 00:14 -0800 |
| Subject | SSH/Telnet program to Router/switch |
| Message-ID | <d343f9af-54f2-4709-9a99-1ad5708c1f34@googlegroups.com> |
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
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-02-19 19:45 +1100 |
| Message-ID | <mailman.7141.1392799568.18130.python-list@python.org> |
| In reply to | #66674 |
On Wed, Feb 19, 2014 at 7:14 PM, Sujith S <sujiths80@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
[toc] | [prev] | [next] | [standalone]
| From | Wojciech Łysiak <wojciech.lysiak@hotmail.com> |
|---|---|
| Date | 2014-02-19 09:45 +0100 |
| Message-ID | <mailman.7142.1392800008.18130.python-list@python.org> |
| In reply to | #66674 |
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
[toc] | [prev] | [next] | [standalone]
| From | Ferrous Cranus <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2014-02-20 02:59 -0800 |
| Message-ID | <ff9a792c-c430-4d3a-be00-1fb15b3394ea@googlegroups.com> |
| In reply to | #66678 |
Τη Τετάρτη, 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?
[toc] | [prev] | [next] | [standalone]
| From | Rodrick Brown <rodrick.brown@gmail.com> |
|---|---|
| Date | 2014-02-25 07:53 -0500 |
| Message-ID | <mailman.7385.1393400594.18130.python-list@python.org> |
| In reply to | #66746 |
Sent from my iPhone > On Feb 20, 2014, at 5:59 AM, Ferrous Cranus <nikos.gr33k@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
[toc] | [prev] | [next] | [standalone]
| From | Johannes Schneider <johannes.schneider@galileo-press.de> |
|---|---|
| Date | 2014-02-19 11:36 +0100 |
| Message-ID | <mailman.7143.1392807623.18130.python-list@python.org> |
| In reply to | #66674 |
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.schneider@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
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-02-19 08:35 -0500 |
| Message-ID | <roy-F02FD5.08350019022014@news.panix.com> |
| In reply to | #66674 |
In article <d343f9af-54f2-4709-9a99-1ad5708c1f34@googlegroups.com>, Sujith S <sujiths80@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.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-02-20 00:58 +1100 |
| Message-ID | <mailman.7149.1392818316.18130.python-list@python.org> |
| In reply to | #66689 |
On Thu, Feb 20, 2014 at 12:35 AM, Roy Smith <roy@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
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-02-19 09:13 -0500 |
| Message-ID | <roy-2E2371.09132319022014@news.panix.com> |
| In reply to | #66689 |
In article <roy-F02FD5.08350019022014@news.panix.com>, Roy Smith <roy@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]
[toc] | [prev] | [next] | [standalone]
| From | William Ray Wing <wrw@mac.com> |
|---|---|
| Date | 2014-02-19 09:27 -0500 |
| Message-ID | <mailman.7150.1392820082.18130.python-list@python.org> |
| In reply to | #66674 |
On Feb 19, 2014, at 3:14 AM, Sujith S <sujiths80@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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web