Net::Telnet - Problems using "script->waitfor" - HELP Needed



Hello All,
I am having problems getting my Perl script to detect
different login scenarios in a unix environment. My code will work OK
for one box but every now and then a box will be configured differently
and the login prompts will be different, catering for this eventuality
in my script is where I am struggling, here is a snippet of the code:-

---------------------------------------------------------------------------------------------------------------------------------------
sub Telnet_To_Device
{
$script = new Net::Telnet ( Timeout=>5, Errmode=>'return', Prompt =>
"/:/i");
$script->dump_log(@Data[0]."debug.log");
if (!($script->open(@Data[1])))
{
print "FAILED TO CENNECT TO @Data[1]\n";
return;
} else {
$script->waitfor('/login:/i');
$script->print(@Data[2]);
$script->waitfor('/password:/i');
$script->print(@Data[3]);
$script->waitfor('/Do you understand/i');
$script->print('Y');
$script->waitfor('/:/');
#uname();
$script->print('quit');
}
}

---------------------------------------------------------------------------------------------------------------------------------------

As I said this will work for 80% of my machines but for the other 20%
there is a sticking point at the point just after where I input the
password, for these 20% of boxes they do not prompt the user for "Do
you understand" and expect the user to return either "Y/N" they go
straight to the box shell prompt. How can I get the code to say if you
see this then do this or if you see that then do that, an 'IF'
statement basically, the only way I can see this working is if you have
a list of the boxes that do this and then you can use an IF on the box
names to present different logins, this seems to long winded though,
there must be an easier route.

p.s. I have read the PM file before anyone asks, I could not find the
answer there.

Cheers, Mark.

.



Relevant Pages

  • Re: 5.0.7 machine locks up!
    ... I tried a terminal login, a virtual console, and even a telnet ... understand "All I had was one shell that responded, ... that already had a "login:" prompt waiting. ... disk activity. ...
    (comp.unix.sco.misc)
  • Cannot login or su
    ... I have installed woody in 3 boxes. ... directly responds with login failure. ... account, the problematic box does not prompt password, either. ...
    (Debian-User)
  • Access denied. You do not have permission to perform this action or access this resource.
    ... I am accessing it over the internet. ... In IE I have deleted cookies and files; I didn't delete all of the ... I don't get a login prompt. ... If I browse to that site with firefox I am prompted and can login. ...
    (microsoft.public.windows.server.sbs)
  • Re: I need help posting copyrighted content!
    ... You would have to create login application on your site prior to users having access to the links. ... The best approach is to get the school to restrict access to the individual files, ... I'm trying to make a class webpage for my school. ... I tried deleting cookies, etc, but it still doesn't prompt ...
    (microsoft.public.frontpage.client)
  • Re: I need help posting copyrighted content!
    ... Do you have any idea what the security issue might be on the school's ... > You would have to create login application on your site prior to users having access to the links. ... > provided by the school to access. ... I tried deleting cookies, etc, but it still doesn't prompt ...
    (microsoft.public.frontpage.client)