Home > Archive > PERL CGI Beginners > November 2006 > Cannot Identify Telnet Prompt in Win Nt Machine
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Cannot Identify Telnet Prompt in Win Nt Machine
|
|
| Anil Pal 2004-08-28, 2:51 pm |
| Hi !!
I am trying to telnet to Win NT server, retrive the IP address using ipconfig and send the reply via Email.
Default WinNT prompt is [<MUMBSRV34_anl-C:\]
But its giving me an error 'command timed-out at ./tel1 line 16. '
The input file stores the ipconfig value but this error is coming.
Plz'e help me
I have attached the code
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 30, Prompt => '/[\$]/');
$t->input_log('input.txt');
$t->output_log('output.txt');
$t->open("server Ip address");
$t->waitfor('/:/');
$t->print("username");
$t->waitfor('/:/');
$t->print("password");
$t->waitfor('/:/');
$t->print("simple/advanced");
$t->waitfor('/]/');
@output1=$t->cmd('ipconfig');
print @output1;
$t->close; | |
| starmister 2006-11-14, 11:14 am |
| quote: Originally posted by Anil Pal
Hi !!
I am trying to telnet to Win NT server, retrive the IP address using ipconfig and send the reply via Email.
Default WinNT prompt is [<MUMBSRV34_anl-C:\]
But its giving me an error 'command timed-out at ./tel1 line 16. '
The input file stores the ipconfig value but this error is coming.
Plz'e help me
I have attached the code
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 30, Prompt => '/[\$]/');
$t->input_log('input.txt');
$t->output_log('output.txt');
$t->open("server Ip address");
$t->waitfor('/:/');
$t->print("username");
$t->waitfor('/:/');
$t->print("password");
$t->waitfor('/:/');
$t->print("simple/advanced");
$t->waitfor('/]/');
@output1=$t->cmd('ipconfig');
print @output1;
$t->close;
You'll need to have a Telnet network service running on the Windows NT box in order to telnet into it. It doesn't come with that. Basically, you can 'redirect' the command prompt to read from a serial port through some trickery, but the normal Windows command prompt doesn't allow remote login via the network. And, since this would leave a gaping security hole in Windows, it's not recommended.
You can find 3rd party packages that supply remote login options. Some are free, others are paid with support. But you may be better off looking into the more secure options, like those using SSH. |
|
|
|
|