cannot get pexpect to work

A

Andrei

Hi,

I'm at a crucial stage in the development of a wide area (multi-host) ssh
wrapper, and need to control what happens when a host requires password
authentication. After installing pexpect, the example script that looks most
inclined to help me (by basically handling this situation,) "passmass.py"
seems to fail, from whatever host to whatever host eg.

[user1@baddog01 scripts]$ ./passmass.py localhost
Username: user1
Current Password:
New Password:
Confirm New Password:
'Timeout exceeded in read().' <<< ?

Does anyone have a clue what's going on?

Many thanks

Andrei.
 
A

Andrei

Peter Hansen said:
No, but why is it asking for a new password confirmation?
You're just trying to log in, not change the password, aren't
you? Or does passmass.py actually change the passwords, not
just log in? (I don't have the script.) Have you read it?
Perhaps you've misinterpreted what it is supposed to do.

that's exactly right, as I forgot to mention: it changes passwds
on a list of remote systems, this list being the list of args to
the script, which is now linked here btw:

http://area52.homeunix.org/testarea/passmass.py.txt

cheers

A.
 
A

Andrei

the following is completely wrong of course in my own hacked version of the
script linked in the previous msg:

# SHELL_PROMPT = '[#\$] '
SHELL_PROMPT = '[$?] ${PWD#${PWD%/*/*/*}/}> '

but even when the login shell prompt on remote machine must end in # or $ as
the script insists, and you leave

SHELL_PROMPT = '[#\$] '

the "timed out" message persists, hence my puzzlement ...

A.
 
P

Peter Hansen

Andrei said:
that's exactly right, as I forgot to mention: it changes passwds
on a list of remote systems, this list being the list of args to
the script, which is now linked here btw:

http://area52.homeunix.org/testarea/passmass.py.txt

Unfortunately at this moment (13:45 EDT) I get no response to
connection requests on port 80. (That is, server is answering
pings, but no web server on standard port.)

-Peter
 
A

Andrei

Unfortunately at this moment (13:45 EDT) I get no response to
connection requests on port 80. (That is, server is answering
pings, but no web server on standard port.)

sorry, I had to bring the homeserver down because of a bad thunderstorm ...
after which someone else must have taken the ip address=)

here it is on another server which is altogether more impervious to
meteorogical changes ...

http://tufish.org/misc/passmass.py.txt
 
A

Andrei

Best solution: this is Python (!), so just start up an interactive
session and type the relevant commands yourself, based on what you
see in pexpect.py. Not only will you solve the problem, but you'll
end up with a much better understanding of pexpect.py and the passmass.py
script as well.

An interactive session certainly did the trick.
.... child.expect('password:')
.... print "problem encountered, password needed"
.... except Exception:
.... print "ok no passwd required"
....
0
problem encountered, password needed


I still haven't figured out why passmass.py isn't finishing and indeed times
out yet, but a basic understanding of pexpect is now creeping up on me, and
how it could help my project.

Thanks,

A.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top