Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file to start telnet sessions 1

Status
Not open for further replies.
Aug 6, 2004
271
GB
hi,

I want to create a batch file which will start a telnet session:

open dos
key in telnet
open to x.x.x.x
put in username
press enter
put in password
press enter


any ideas?
 
I am fairly confident that you cannot do this with Windows telnet. You can use other emulators to connect to a particular server, but even they will not enter a username and password - it would be a little insecure do you not think?

Alex
 
alexhu is correct about the use of .bat or .cmd files. The scripting tool works slightly differently (from the Help file of tst10:

Usage Syntax:

tst10.exe /r:script.txt [options]

/r:script.txt run script.txt
[options] any of these:

/o:eek:utput.txt send session output to output.txt
/m run script in minimized window

Usage Example:

tst10.exe /r:script.txt /o:eek:utput.txt /m

Scripting Syntax:

HOSTNAME PORT port number optional, default: 23
WAIT "string" string to wait for
SEND "string" string to send
\" represents the a quote character
\m represents a <CR/LF>
\\ represents the backslash character

Scripting Example:

hostname.com 23
WAIT "login"
SEND "root\m"
WAIT "password"
SEND "mypassword\m"
WAIT ">"
SEND "dip internet.dip\m"
WAIT ">"

Scripting Note:

You can start with either WAIT or SEND commands,
but you *must* alternate them. ie: you can't use two
or more WAIT or SEND in a row.

Note:

TST will disconnect and close as soon
as its done with the last entry of the script.

If you need to, you can type in the terminal
window while the script is running.
 
Really ? I am amazed that anyone would want to do this

Alex
 
I do it regularly to make it easier for local Admins to access Telnet only network devices for setup and maintenance chores.

For file transfers, using FTP is perfectly batch and script friendly, and likely a better general solution.

 
bcastner - "make it easier for local Admins"

whats wrong with typing? surely these scripts with embedded passwords are on your server, therefore if I get access to your server, I get access to more without any effort at all.

Or am I missing something here ?

Alex
 
Well then, I hope it helps you too.

Best,
Bill Castner
 
alexhu,

I think you are missing something called NTFS permissions.

Seriously:

. There has not been a credible report of a Kerberos hack
. The script files are protected by NTFS permissions

I am not sure how your servers are setup, but you are not getting into mine. And you are not getting access to any script file with a plaintext password stored, albeit I reduce them to a minimum.

Typing is fine for the one or two devices; it really is a pain for the hundreds or 1,000+ devices setup and maintenance. The very strong temptation is to use the same logon ID and password. I believe my solution is more secure, although I will grant that any username and password stored in plaintext is a vunlerability.




 
bcastner

Indeed, thats because I'm a UNIX admin :)

Thanks for the explantion - I can see your point with comms devices and the amount of passwords you would have to remember

Alex

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top