Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: telnet script  (Read 4763 times)

0 Members and 1 Guest are viewing this topic.

abc

  • Guest
telnet script
« on: June 25, 2006, 02:12:03 AM »
Hi
  I am writing a simple batch file which will telnet to a server. I want to check the authentication status i.e., has user typed the correct username & password OR typed some control characters like ctrl-C,ctrl-D. Because based on the status I need to do some other business in the batch file.

Is it possible to suppress ctrl-C and ctrl-D while doing telnet so that the user can't escape the telnet authentication.

I hope U understand my problem. Thanx in advance.

ghostdog74



    Specialist

    Thanked: 27
    Re: telnet script
    « Reply #1 on: June 25, 2006, 02:53:37 AM »
    windows telnet has limited scripting components..what do you want to do after you authenticate? do u need to execute some remote commands? or is it just to provide an validation  mechanism ?

    abc

    • Guest
    Re: telnet script
    « Reply #2 on: June 25, 2006, 03:07:24 AM »
    It is just to provide a validation

    ghostdog74



      Specialist

      Thanked: 27
      Re: telnet script
      « Reply #3 on: June 25, 2006, 04:25:12 AM »
      Quote
      It is just to provide a validation
      like i said, windows telnet lack scripting components.you can either use vbscript or programming languages that have telnet scripting libraries, eg perl,python. Anyother way is to get those telnet clients that provide scripting components...
      simple example of using perl telnet module
      Code: [Select]
        use Net::Telnet ();
          $t = new Net::Telnet (Timeout => 10,
                                Prompt => '/bash\$ $/');
          $t->open("remoteserver");
          $t->login($username, $passwd) or die "Cannot login. Check login and password";