Using pxssh

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tereglow

    #1

    Using pxssh

    Hello,

    I am trying to convert some Expect/Tcl code into Python by using the
    Pexpect module. The environment is such that authenticated keys are
    disabled although SSH is available. I do not have control over this
    environment, so I'm trying to automate tasks within it via Expect.

    I noticed that, within the Pexpect documentation, it mentions a class
    called "pxssh". Has anyone used this before? If so, I'm having some
    trouble importing it. If I just import pxssh doesn't seem to work;
    really am not sure how this is related to Pexpect or how to use it
    from within it.

    Any help is appreciated.
    Tom

  • Nick Craig-Wood

    #2
    Re: Using pxssh

    tereglow <tom.rectenwald @eglow.netwrote :
    I am trying to convert some Expect/Tcl code into Python by using the
    Pexpect module. The environment is such that authenticated keys are
    disabled although SSH is available. I do not have control over this
    environment, so I'm trying to automate tasks within it via Expect.
    >
    I noticed that, within the Pexpect documentation, it mentions a class
    called "pxssh". Has anyone used this before? If so, I'm having some
    trouble importing it. If I just import pxssh doesn't seem to work;
    In what way doesn't it work?
    really am not sure how this is related to Pexpect or how to use it
    from within it.
    It works for me according to the documentation

    $ python
    Python 2.4.4 (#2, Jan 13 2007, 17:50:26)
    [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
    Type "help", "copyright" , "credits" or "license" for more information.
    >>import pxssh
    >>s = pxssh.pxssh()
    >>s.login("loca lhost", "user", "password")
    True
    >>s.sendline("l s -l")
    6
    >>s.prompt()
    True
    >>print s.before
    ls -l
    total 30944
    -rw-r--r-- 1 user user 936 Nov 3 14:52 #z.c#
    [snip]
    -rw-r--r-- 1 user user 221 Jan 30 11:51 z~
    >>s.logout()
    >>>
    I'm using the debian packaged version 2.1-1 with python 2.4

    --
    Nick Craig-Wood <nick@craig-wood.com-- http://www.craig-wood.com/nick

    Comment

    Working...