| |||||||||||
Not able to encrypt/read passwords Posted by pcmenon (pcmenon), 14 May 2005 Hi,Here is the excerpt of the code that I have developed to enter and read password from the "Enter password:" prompt ------------------------------------------------------------------ expect { password: { stty -echo send_user "$passwd\n" expect_user -re "(.*)\n" send "$expect_out(1,string)\r" stty echo break; ------------------------------------------------------------------ The program runs displaying the password without encryption in the "Enter password:" prompt. Also I wanna read the password entered and if the password is valid it should go to the user's root prompt or else should display "Invald password". How should I go about solving this issue. -- pcmenon Posted by admin (Graham Ellis), 14 May 2005 have you set log_user 0 ? If you don't, then everything's going to be echoed.Posted by pcmenon (pcmenon), 20 May 2005 I have set log_user 0.even then I am failing to read the password. Is there any other way 2 read the encrypted password. Posted by admin (Graham Ellis), 20 May 2005 I'm getting confused here. Your first post reported that the password was appearing on the screen in plain text and your second post reports that the password isn't being read. Could you post up to clarify what's happening, please?By the way - if you do NOT do a log_user 0 you'll be able to see a trace of what's happening that should help you find where your code is sticking and debug it. Also look at exp_internal. Footnote - Try replacing password: with "password: " (Note the quotes and the space). Passwords are read differently from almost all other text, and you can't usually type them ahead. Password prompts usually end in a space, and if you write an expect program that does NOT allow for this it sometimes causes problems of the sort that I think you're describing. Posted by pcmenon (pcmenon), 21 May 2005 Hi Graham,My problem is to change the cli password of the root user who is logging into the IP ( & again to revert back to the old password for security reasons) Now the prompts are:- Enter password:- (Old password) --> here i want to store the user entered password into a variable. (as i want to keep a backup per se) New_UNIX_password:- (user enters the new password Retype new passworduser reenters the new password) Also if the old password that the user has entered is not matching with the default one then the messase "access denied" comes. I want this message also to be stored in a file Is there any way that I can get the exit_status ??. Regards pcmenon Posted by admin (Graham Ellis), 21 May 2005 on 05/21/05 at 08:12:37, pcmenon wrote:
There's three pages on this in Don Libes' book "Exploring Expect" - pages 117 through 119. Briefly, you need to run the process via a shell wrapper which echos the status - there isn't a shorthand. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |