Computer Hope
Software => Computer programming => Topic started by: ann124 on November 23, 2004, 06:55:58 AM
-
I was able to set up a batch file to open a telnet session, but I still have to type in my username and password for the session to actually start. Is there any way to set up the batch file to automatically enter my username and password? ???
-
Hello friend
Please if you find a solution for this problem please send it to my mail address
[email protected]
-
Try using some Telnet switches:
Examples:
telnet -a 192.168.2.1
or
telnet -l username 192.168.2.1
There is no switch for the password. The "a" switch will try automatic logon using your signon from your machine. The "l" switch allows you to enter any username.
Hope this helps.
8)
-
You can also try having dos automatically put some input to the program through piping with the echo command.
See the following example:
echo y|copy file1.zip "D:\Program Files\file1.zip"
The echo pipes "y" to the copy program which is the answer to the question "Do you want to overwrite the existing file".
Maybe you can do the same with telnet
-
This is good. from this command we can login the username, but how do we login the password?
Try using some Telnet switches:
Examples:
telnet -a 192.168.2.1
or
telnet -l username 192.168.2.1
There is no switch for the password. The "a" switch will try automatic logon using your signon from your machine. The "l" switch allows you to enter any username.
Hope this helps.
8)
-
Like a phoenix rising from the ashes, old posts spring forth to haunt us. You do realize this post is over 2 years old, right?
You may need a working knowledge of how telnet prompts for parameters. Try combining the two responses above:
echo password | telnet -l username IPaddress
Be aware that putting unencrypted passwords into scripts/batch files is a security breach. Many programs will choke on the pipe; let's hope Microsoft followed their own standards.
Good luck. 8)
-
Thanks for the reply..
I'm not too sure where this comes in...
I have created a ".BAT" file inside it has this commands
----------------------------------------
c:\windows\system32\telnet.exe
----------------------------------------
this will open the telnet. Where do I go from here?
I would like to login the username and password using the BAT file. is this possible?
-
Did you run what was posted?
echo password | telnet -l username IPaddress
What were the results? Can you post the console output. If telnet cannot accept input from the pipe, it may be possible to redirect input from a file, but it will be necessary to see the sequence telnet requests the input.
Of course telnet may only take the password from the keyboard in which case you will be SOL.
Let us know. 8)
If the telnet userid and password are the same ones you use for Windows, try using the -a switch:
telnet -a IPaddress
-
alternatively you can use other languages such as Perl that has telnet modules to do this task.
eg
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("hostname");
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;
more information here (http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm) if you are interested.
-
Yes. It is possible with help of another executable called telnetd.exe. I have developed this executable to automate telnetd.exe(http://myresearchdev.blogspot.sg/) session using windows batch file.
Usage
telnetd.exe script.txt
scripts.txt -> for the telnet commands
After the execution of the batch file you can seelogs from telnetlog.txt. This telnetlog.txt will help you to troubleshoot the commands and responses.