Re: SSH utility

2009-07-07 Thread romeoamp

Please look at on :


http://www.lag.net/paramiko/ http://www.lag.net/paramiko/ 


Sample Code: Find Attachment


Thanks,
S.V.RAJKUMAR,
XOU Solutions India Private Limited
No. 37, PM Towers,
Greams Road,
Thousand Lights,
Chennai - 6 .
Mobile No : +91 - 9940632275. 





half.italian wrote:
> 
> On Aug 11, 5:17 am, edwin.mad...@verizonwireless.com wrote:
>> for similar tasks, I use pexpecthttp://pypi.python.org/pypi/pexpect.
>>
>> spawning bash process and simulate an interactive session. Here sending
>> ls command, retrieving results and exiting. In the spawned process ssh or
>> any other command, is just another command.
>>
>> actual session--
>> $ python
>> Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
>> [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
>> Type "help", "copyright", "credits" or "license" for more information.>>>
>> import pexpect
>> >>> c = pexpect.spawn('/bin/bash')
>> >>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
>> 2
>> >>> c.before, c.after
>>
>> ('\x1b[?1034hmada...@njwarhqd0it696a:~\r\n', '$ ')>>> c.sendline('ls')
>> 3
>> >>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
>> 2
>> >>> c.before, c.after
>>
>> ('ls\r\x.txt  xx.txt  xy.txt  y.txt\r\nmada...@njwarhqd0it696a:~\r\n', '$
>> ')>>> c.sendline('exit')
>> 5
>> >>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
>> 1
>> >>> c.before, c.after
>>
>> ('exit\r\nexit\r\n', )>>> exit()
>>
>> mada...@njwarhqd0it696a:~
>> $
>> ---
>>
>> hope that helps.
>>
>> regards.
>> Edwin
>>
>> -Original Message-
>> From: python-list-bounces+edwin.madari=verizonwireless@python.org
>>
>> [mailto:python-list-bounces+edwin.madari=verizonwireless@python.org]
>> On Behalf Of James Brady
>> Sent: Monday, August 11, 2008 12:26 AM
>> To: python-l...@python.org
>> Subject: SSH utility
>>
>> Hi all,
>> I'm looking for a python library that lets me execute shell commands
>> on remote machines.
>>
>> I've tried a few SSH utilities so far: paramiko, PySSH and pssh;
>> unfortunately all been unreliable, and repeated questions on their
>> respective mailing lists haven't been answered...
>>
>> It seems like the sort of commodity task that there should be a pretty
>> robust library for. Are there any suggestions for alternative
>> libraries or approaches?
>>
>> Thanks!
>> James
>> --http://mail.python.org/mailman/listinfo/python-list
>>
>> The information contained in this message and any attachment may be
>> proprietary, confidential, and privileged or subject to the work
>> product doctrine and thus protected from disclosure.  If the reader
>> of this message is not the intended recipient, or an employee or
>> agent responsible for delivering this message to the intended
>> recipient, you are hereby notified that any dissemination,
>> distribution or copying of this communication is strictly prohibited.
>> If you have received this communication in error, please notify me
>> immediately by replying to this message and deleting it and all
>> copies and backups thereof.  Thank you.
> 
> I second pexpect and the nice little module that comes with it
> ssh_session.py.
> 
> Been using it for ages now!
> 
> ~Sean
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
> 
http://www.nabble.com/file/p24385961/sshclient.py sshclient.py 
-- 
View this message in context: 
http://www.nabble.com/SSH-utility-tp18920030p24385961.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SSH utility

2008-08-11 Thread Sean DiZazzo
On Aug 11, 5:17 am, [EMAIL PROTECTED] wrote:
> for similar tasks, I use pexpecthttp://pypi.python.org/pypi/pexpect.
>
> spawning bash process and simulate an interactive session. Here sending ls 
> command, retrieving results and exiting. In the spawned process ssh or any 
> other command, is just another command.
>
> actual session--
> $ python
> Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
> [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import pexpect
> >>> c = pexpect.spawn('/bin/bash')
> >>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
> 2
> >>> c.before, c.after
>
> ('[EMAIL PROTECTED]:~\r\n', '$ ')>>> c.sendline('ls')
> 3
> >>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
> 2
> >>> c.before, c.after
>
> ('ls\r\x.txt  xx.txt  xy.txt [EMAIL PROTECTED]:~\r\n', '$ ')>>> 
> c.sendline('exit')
> 5
> >>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
> 1
> >>> c.before, c.after
>
> ('exit\r\nexit\r\n', )>>> exit()
>
> [EMAIL PROTECTED]:~
> $
> ---
>
> hope that helps.
>
> regards.
> Edwin
>
> -Original Message-
> From: [EMAIL PROTECTED]
>
> [mailto:[EMAIL PROTECTED]
> On Behalf Of James Brady
> Sent: Monday, August 11, 2008 12:26 AM
> To: [EMAIL PROTECTED]
> Subject: SSH utility
>
> Hi all,
> I'm looking for a python library that lets me execute shell commands
> on remote machines.
>
> I've tried a few SSH utilities so far: paramiko, PySSH and pssh;
> unfortunately all been unreliable, and repeated questions on their
> respective mailing lists haven't been answered...
>
> It seems like the sort of commodity task that there should be a pretty
> robust library for. Are there any suggestions for alternative
> libraries or approaches?
>
> Thanks!
> James
> --http://mail.python.org/mailman/listinfo/python-list
>
> The information contained in this message and any attachment may be
> proprietary, confidential, and privileged or subject to the work
> product doctrine and thus protected from disclosure.  If the reader
> of this message is not the intended recipient, or an employee or
> agent responsible for delivering this message to the intended
> recipient, you are hereby notified that any dissemination,
> distribution or copying of this communication is strictly prohibited.
> If you have received this communication in error, please notify me
> immediately by replying to this message and deleting it and all
> copies and backups thereof.  Thank you.

I second pexpect and the nice little module that comes with it
ssh_session.py.

Been using it for ages now!

~Sean
--
http://mail.python.org/mailman/listinfo/python-list


RE: SSH utility

2008-08-11 Thread Support Desk
What about pexpect?


http://www.noah.org/wiki/Pexpect


-Original Message-
From: Alan Franzoni [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 11, 2008 5:41 AM
To: python-list@python.org
Subject: Re: SSH utility

James Brady was kind enough to say:

> Hi all,
> I'm looking for a python library that lets me execute shell commands
> on remote machines.
> 
> I've tried a few SSH utilities so far: paramiko, PySSH and pssh;
> unfortunately all been unreliable, and repeated questions on their
> respective mailing lists haven't been answered...

Twisted conch seems to be your last chance :-) 

-- 
Alan Franzoni <[EMAIL PROTECTED]>
-
Remove .xyz from my email in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E


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


Re: SSH utility

2008-08-11 Thread Michael Mabin
I use pexpect.

On Mon, Aug 11, 2008 at 7:22 AM, Jean-Paul Calderone <[EMAIL PROTECTED]>wrote:

> On Sun, 10 Aug 2008 21:25:38 -0700 (PDT), James Brady <
> [EMAIL PROTECTED]> wrote:
>
>> Hi all,
>> I'm looking for a python library that lets me execute shell commands
>> on remote machines.
>>
>> I've tried a few SSH utilities so far: paramiko, PySSH and pssh;
>> unfortunately all been unreliable, and repeated questions on their
>> respective mailing lists haven't been answered...
>>
>> It seems like the sort of commodity task that there should be a pretty
>> robust library for. Are there any suggestions for alternative
>> libraries or approaches?
>>
>
> You can find an example of running commands over SSH with Twisted online:
>
>  http://twistedmatrix.com/projects/conch/documentation/examples/
>
> Jean-Paul
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
| _ | * | _ |
| _ | _ | * |
| * | * | * |
--
http://mail.python.org/mailman/listinfo/python-list

Re: SSH utility

2008-08-11 Thread Jean-Paul Calderone

On Sun, 10 Aug 2008 21:25:38 -0700 (PDT), James Brady <[EMAIL PROTECTED]> wrote:

Hi all,
I'm looking for a python library that lets me execute shell commands
on remote machines.

I've tried a few SSH utilities so far: paramiko, PySSH and pssh;
unfortunately all been unreliable, and repeated questions on their
respective mailing lists haven't been answered...

It seems like the sort of commodity task that there should be a pretty
robust library for. Are there any suggestions for alternative
libraries or approaches?


You can find an example of running commands over SSH with Twisted online:

 http://twistedmatrix.com/projects/conch/documentation/examples/

Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list


Re: SSH utility

2008-08-11 Thread Edwin . Madari
for similar tasks, I use pexpect http://pypi.python.org/pypi/pexpect.

spawning bash process and simulate an interactive session. Here sending ls 
command, retrieving results and exiting. In the spawned process ssh or any 
other command, is just another command. 

actual session--
$ python
Python 2.5.1 (r251:54863, May 18 2007, 16:56:43) 
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pexpect
>>> c = pexpect.spawn('/bin/bash')
>>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
2
>>> c.before, c.after
('[EMAIL PROTECTED]:~\r\n', '$ ')
>>> c.sendline('ls')
3
>>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
2
>>> c.before, c.after
('ls\r\x.txt  xx.txt  xy.txt  [EMAIL PROTECTED]:~\r\n', '$ ')
>>> c.sendline('exit')
5
>>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ '])
1
>>> c.before, c.after
('exit\r\nexit\r\n', )
>>> exit()
[EMAIL PROTECTED]:~
$ 
---

hope that helps.

regards.
Edwin


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of James Brady
Sent: Monday, August 11, 2008 12:26 AM
To: python-list@python.org
Subject: SSH utility


Hi all,
I'm looking for a python library that lets me execute shell commands
on remote machines.

I've tried a few SSH utilities so far: paramiko, PySSH and pssh;
unfortunately all been unreliable, and repeated questions on their
respective mailing lists haven't been answered...

It seems like the sort of commodity task that there should be a pretty
robust library for. Are there any suggestions for alternative
libraries or approaches?

Thanks!
James
--
http://mail.python.org/mailman/listinfo/python-list



The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure.  If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof.  Thank you.


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


Re: SSH utility

2008-08-11 Thread Kris Kennaway

James Brady wrote:

Hi all,
I'm looking for a python library that lets me execute shell commands
on remote machines.

I've tried a few SSH utilities so far: paramiko, PySSH and pssh;
unfortunately all been unreliable, and repeated questions on their
respective mailing lists haven't been answered...

It seems like the sort of commodity task that there should be a pretty
robust library for. Are there any suggestions for alternative
libraries or approaches?


Personally I just Popen ssh directly.  Things like paramiko make me 
concerned; getting the SSH protocol right is tricky and not something I 
want to trust to projects that have not had significant experience and 
auditing.


Kris
--
http://mail.python.org/mailman/listinfo/python-list


Re: SSH utility

2008-08-11 Thread Alan Franzoni
James Brady was kind enough to say:

> Hi all,
> I'm looking for a python library that lets me execute shell commands
> on remote machines.
> 
> I've tried a few SSH utilities so far: paramiko, PySSH and pssh;
> unfortunately all been unreliable, and repeated questions on their
> respective mailing lists haven't been answered...

Twisted conch seems to be your last chance :-) 

-- 
Alan Franzoni <[EMAIL PROTECTED]>
-
Remove .xyz from my email in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E
--
http://mail.python.org/mailman/listinfo/python-list