From: <al....@ac...> - 2007-03-19 22:12:30
|
Hi Ronald, I have used your recommended approach in the past on my Sun servers with great success. Unfortunately due to the proprietary nature of the OS running on my non Sun remote servers the capability of setting up SSH keys is not supported.=20 After enabling exp-internal() in my script I found couple of \r\n in the prompt and was able to fix the issue. =20 Thank you all for your help. =20 =20 Al =20 -----Original Message----- From: der...@gm... [mailto:der...@gm...] On Behalf Of Roland Giersig Sent: Saturday, March 17, 2007 2:00 PM To: Pashazadeh, Al Cc: exp...@li... Subject: Re: [Expectperl-discuss] Multi Line Prompts - Help A classical example of a problem best solved by NOT using Expect... :-) Just set up ssh keys so you can log in without giving a password. This means that you have to log in to each server once to get its fingerprint into your known_hosts file and to add your public key to the authorized_keys file. Hope this helps... Roland On 3/15/07, al....@ac... <al....@ac...> wrote: > > Hello everyone, > > I need a bit of help with figuring out a problem with my Expect Perl script > and was hoping someone on the list might be able to point me in right > direction. I use Expect Perl module in my script for executing commands > remotely on some of my servers. The script uses Open SSH (4.2p1) on Solaris > 2.8 for logging into each remote server. The remote servers run on a > proprietary UNIX OS which can send back any of the following single or multi > line prompts during the SSH attempt: > > > > The authenticity of host 'testserver (10.10.11.12)' can't be established. > > RSA key fingerprint is > 8e:be:a4:4c:55:09:e8:72:f8:2b:e9:60:0c:84:f6:39. > > Are you sure you want to continue connecting (yes/no)? > > > > or > > > > User1@testserver's password: > > > > or > > > > Blank line > > Blank line > > Data ONTAP (testserver.domainname.com) > > login: > > > > For checking the prompts I am trying something similar to the following: > > > > $Prompt =3D 'Are you sure you want to continue connecting (yes/no)? '; - This > is the last line from the first prompt above. > > > > $which =3D $exp->expect ( 20, "$user_id\@$host_ip\'s password: ",$Prompt, > "login: ","[local_host_name%#]" ); > > > > I am using $which variable to find out which prompt is matched. This > appears to be working for the first two prompts but not for the third one. > I enabled logging to a file and noticed the following when opened the log > file via vi: > > > > ^M > > ^M > > Data OnTap (testserver.domainname.com)^M > > login: > > > > I can't tell if there is any other hidden character in the above prompt. I > don't know what regular expression to use to match for the above multi line > prompt and am not sure why the $Prompt work for the first multi line prompt. > Currently the following packages are installed on my Sun box: > > > > expect-5.43.0-sol8-sparc-local > > Expect-1.20 > > IO-Tty-1.07 > > perl-5.8.7-sol8-sparc-local > > > > Any help is appreciated. > > > > > > > > > > > > > This message is for the designated recipient only and may contain > privileged, proprietary, or otherwise private information. If you have > received it in error, please notify the sender immediately and delete the > original. Any other use of the email by you is prohibited. > ------------------------------------------------------------------------ - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE V > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > This message is for the designated recipient only and may contain = privileged, proprietary, or otherwise private information. If you have = received it in error, please notify the sender immediately and delete = the original. Any other use of the email by you is prohibited. |