Automate a telnet session 
Author Message
 Automate a telnet session

Does anyone know a way that I can automate a telnet session like one can
with an FTP script?  I need the script to answer with my username when it
asks, my password when it asks, and the number "2" when it asks.  These
questions are asked in this order when the session to the telnet server is
opened.  This should be simple, since the telnet server only asks these
three questions.  I know how to do this with an FTP script but not with a
telnet script .

--



Sun, 07 Aug 2005 00:56:04 GMT  
 Automate a telnet session

Quote:
> Does anyone know a way that I can automate a telnet session like one
> can with an FTP script?  I need the script to answer with my username
> when it asks, my password when it asks, and the number "2" when it
> asks.  These questions are asked in this order when the session to
> the telnet server is opened.  This should be simple, since the telnet
> server only asks these three questions.  I know how to do this with
> an FTP script but not with a telnet script .

Your best bet is something like TeraTerm Pro (freeware) which is built to be
automated.
http://hp.vector.co.jp/authors/VA002416/teraterm.html
If you do much telnetting, you'll love this thing.  And wait for Alex K.
Angelopoulos to chime in; he's got some nifty add-ons/extensions for TTPro
(but I'm daft today and can't find my shortcut to them).


Sun, 07 Aug 2005 01:55:40 GMT  
 Automate a telnet session

Quote:


> > Does anyone know a way that I can automate a telnet session like one
> > can with an FTP script?  I need the script to answer with my username
> > when it asks, my password when it asks, and the number "2" when it
> > asks.  These questions are asked in this order when the session to
> > the telnet server is opened.  This should be simple, since the telnet
> > server only asks these three questions.  I know how to do this with
> > an FTP script but not with a telnet script .

> Your best bet is something like TeraTerm Pro (freeware) which is built to be
> automated.
> http://hp.vector.co.jp/authors/VA002416/teraterm.html
> If you do much telnetting, you'll love this thing.  And wait for Alex K.
> Angelopoulos to chime in; he's got some nifty add-ons/extensions for TTPro
> (but I'm daft today and can't find my shortcut to them).

I couldn't find it either, but here are a quote from a previous post by Alex

<quote>
3) Use a scripted Telnet client.  There are several which are commercially
available; the 2 which I use consistently are TeraTerm Pro and IVT Telnet.

http://hp.vector.co.jp/authors/VA002416/teraterm.html is the home page for
TeraTerm; it is open and easy to use, but is beginning to age.

http://home.planet.nl/~ruurdb/IVT.HTM IVT telnet is alive and kicking and has
just gone "semi-commercial" - if you don't need Kerberos support, you can get it
for free also.
</quote>

and then we have this one ;-)


Subject: Telnet from WSH - AND IT'S ABOUT FLIPPIN' TIME!!!!!
Newsgroups: microsoft.public.scripting.wsh
Date: 2002-10-25 19:28:03 PST
http://groups.google.com/groups?th=f46671143f20f68f

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Sun, 07 Aug 2005 02:28:37 GMT  
 Automate a telnet session
@ECHO OFF
echo set sh=WScript.CreateObject("WScript.Shell")>telnet.vbs
echo WScript.Sleep 500>>telnet.vbs
echo sh.SendKeys "USERID">>telnet.vbs
echo WScript.Sleep 500>>telnet.vbs
echo sh.SendKeys "~">>telnet.vbs
echo WScript.Sleep 500>>telnet.vbs
echo sh.SendKeys "PASSWD">>telnet.vbs
echo sh.SendKeys "~">>telnet.vbs

start /realtime telnet.exe MACHINE
C:\WINNT\system32\cscript.exe  //nologo telnet.vbs



Quote:
> Does anyone know a way that I can automate a telnet session like one can
> with an FTP script?  I need the script to answer with my username when it
> asks, my password when it asks, and the number "2" when it asks.  These
> questions are asked in this order when the session to the telnet server is
> opened.  This should be simple, since the telnet server only asks these
> three questions.  I know how to do this with an FTP script but not with a
> telnet script .

> --



Sun, 07 Aug 2005 07:11:09 GMT  
 Automate a telnet session

work in a vb script.

--


Quote:

> echo set sh=WScript.CreateObject("WScript.Shell")>telnet.vbs
> echo WScript.Sleep 500>>telnet.vbs
> echo sh.SendKeys "USERID">>telnet.vbs
> echo WScript.Sleep 500>>telnet.vbs
> echo sh.SendKeys "~">>telnet.vbs
> echo WScript.Sleep 500>>telnet.vbs
> echo sh.SendKeys "PASSWD">>telnet.vbs
> echo sh.SendKeys "~">>telnet.vbs

> start /realtime telnet.exe MACHINE
> C:\WINNT\system32\cscript.exe  //nologo telnet.vbs



> > Does anyone know a way that I can automate a telnet session like one can
> > with an FTP script?  I need the script to answer with my username when
it
> > asks, my password when it asks, and the number "2" when it asks.  These
> > questions are asked in this order when the session to the telnet server
is
> > opened.  This should be simple, since the telnet server only asks these
> > three questions.  I know how to do this with an FTP script but not with
a
> > telnet script .

> > --



Sun, 07 Aug 2005 09:52:17 GMT  
 Automate a telnet session

Quote:




> > echo set sh=WScript.CreateObject("WScript.Shell")>telnet.vbs
> > echo WScript.Sleep 500>>telnet.vbs
> > echo sh.SendKeys "USERID">>telnet.vbs
> > echo WScript.Sleep 500>>telnet.vbs
> > echo sh.SendKeys "~">>telnet.vbs
> > echo WScript.Sleep 500>>telnet.vbs
> > echo sh.SendKeys "PASSWD">>telnet.vbs
> > echo sh.SendKeys "~">>telnet.vbs

> > start /realtime telnet.exe MACHINE
> > C:\WINNT\system32\cscript.exe  //nologo telnet.vbs



Actually, the script above is not a VBScript, but a batch file that creates a

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Sun, 07 Aug 2005 10:09:17 GMT  
 Automate a telnet session


:

Quote:



> > > echo set sh=WScript.CreateObject("WScript.Shell")>telnet.vbs

> Actually, the script above is not a vbscript, but a batch file that creates a


The question I had is - why?

I know there must be a reason for using a static batch script to generate a
static VBScript, but I don't get it...

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp



Mon, 08 Aug 2005 06:19:18 GMT  
 Automate a telnet session
I'm including the new "microsoft.public.windows.server.scripting" newsgroup in
this response.  This group is a new one focused on Windows administrative
scripting issues, and fits well with the topic of your post.

(And besides that, I'm shocked that we haven't already gotten 50 questions in
there about telnet automation...)


Quote:
> Does anyone know a way that I can automate a telnet session like one can
> with an FTP script?  I need the script to answer with my username when it
> asks, my password when it asks, and the number "2" when it asks.  These
> questions are asked in this order when the session to the telnet server is
> opened.  This should be simple, since the telnet server only asks these
> three questions.  I know how to do this with an FTP script but not with a
> telnet script .

Here's a real short summary answer related to this;  you've already gotten the
best how-to answers, but I will repeat what Curtis and Torgeir mentioned for the
people in windows.server.scripting...

There's no native automated telnet tool. It is theoretically somewhat possible
with a screenscraper and the NT4-era telnet client, but the newer one doesn't
work worth a diddle due to various oddities such as screen control characters.

There are several telnet clients which can be automated; the "free" ones include
most prominently feature TeraTerm, IVT, and TelScript; below is my quote of
Torgeir quoting me on the three tools, for people in windows.server.scripting
(did I really say all this?<g>) :

================
....There are several which are commercially
available; the 2 which I use consistently are TeraTerm Pro and IVT Telnet.

http://hp.vector.co.jp/authors/VA002416/teraterm.html is the home page for
TeraTerm; it is open and easy to use, but is beginning to age.

http://home.planet.nl/~ruurdb/IVT.HTM IVT telnet is alive and kicking and has
just gone "semi-commercial" - if you don't need Kerberos support, you can get it
for free also.

and then we have this one ;-)


Subject: Telnet from WSH - AND IT'S ABOUT FLIPPIN' TIME!!!!!
Newsgroups: microsoft.public.scripting.wsh
Date: 2002-10-25 19:28:03 PST
http://groups.google.com/groups?th=f46671143f20f68f

================

As for scripts to handle this, the TeraTerm ones are easy.  The web server I use
is experimental and is not listening for uploads right now, so I can't get my
TTL scripts transferred, but a short set will be there "soon" at
http://dev.remotenetworktechnology.com/files/ttscripts.zip

In the interim, here's a TeraTerm script that logs on to a Win2K server via
Telnet and does a password change.  Details of the logon sequence and characters
to wait for will vary depending on the OS/type of the system to which you
connect.

; 1 - we set variables - prompts and the passwords
 UsernamePrompt = 'login:'
 Username = 'administrator'
 PasswordPrompt = 'password:'
 ;Current password
 ;New password (assumes a password change)
 Password = 'modron'
 NewPassword = 'modron'
 ;this is the LOCAL log file
 PathtoLogFile = 'c:\data\logs\w2klog.txt'

;2 - we connect
 connect param2

;3 - then we log in
 wait   UsernamePrompt
 sendln Username
 wait   PasswordPrompt
 sendln Password

;4 - wait for the w2k prompt; if it doesn't come in 5 seconds,
; assume its OK
 wait '>'
 timeout=5

;5 - Login is done, so we start a log, 0 for text not binary,
; 1 for append not overwrite
 logopen PathtoLogFile 0 1

;6a - Kludge - since I can't echo params to log,
' we'll do an ipconfig to capture address
 sendln 'ipconfig'
 wait '>'

;6b - Now we do the password change and exit
 sendln 'net user ' Username ' *'
 wait 'user:'
 sendln NewPassword
 wait 'confirm'
 sendln NewPassword
 wait '>'
 sendln 'exit'

;7 - Stop logging
 logclose

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp



Mon, 08 Aug 2005 06:46:01 GMT  
 Automate a telnet session

Quote:


> :



> > > > echo set sh=WScript.CreateObject("WScript.Shell")>telnet.vbs

> > Actually, the script above is not a vbscript, but a batch file that creates a

> The question I had is - why?

> I know there must be a reason for using a static batch script to generate a
> static VBScript, but I don't get it...

LOL, I guess Popete feels more comfortable with a batch file...

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page Scripting
Guide: http://www.microsoft.com/technet/scriptcenter



Mon, 08 Aug 2005 10:28:31 GMT  
 Automate a telnet session



Quote:



> > :



> > > > > echo set sh=WScript.CreateObject("WScript.Shell")>telnet.vbs

> > > Actually, the script above is not a vbscript, but a batch file that
creates a

> > The question I had is - why?

> > I know there must be a reason for using a static batch script to generate a
> > static VBScript, but I don't get it...

> LOL, I guess Popete feels more comfortable with a batch file...

Ah-hah!

There actually are a couple of good reasons for doing this I found digging back
through my telnet stuff, but it's for on-the-fly script creation through a
telnet session and such...

Since it's this, I'll match you and raise you one level of indirection,
Popete.;)

The only problem is, he can do this right back to me... <g>

Set Sh = CreateObject("WScript.Shell")

Sh.Run "%COMSPEC% /C echo set sh=WScript.CreateObject(""" _
 & """WScript.Shell"")>telnet.vbs", 0, True
Sh.Run "%COMSPEC% /C echo WScript.Sleep 500>>telnet.vbs", 0, True
Sh.Run "%COMSPEC% /C echo sh.SendKeys ""USERID"">>telnet.vbs", 0, True
Sh.Run "%COMSPEC% /C echo WScript.Sleep 500>>telnet.vbs", 0, True
Sh.Run "%COMSPEC% /C echo sh.SendKeys ""~"">>telnet.vbs", 0, True
Sh.Run "%COMSPEC% /C echo WScript.Sleep 500>>telnet.vbs", 0, True
Sh.Run "%COMSPEC% /C echo sh.SendKeys ""PASSWD"">>telnet.vbs", 0, True
Sh.Run "%COMSPEC% /C echo sh.SendKeys ""~"">>telnet.vbs", 0, True

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp



Mon, 08 Aug 2005 11:10:45 GMT  
 Automate a telnet session



Quote:
> I'm including the new "microsoft.public.windows.server.scripting"
newsgroup in
> this response.  This group is a new one focused on Windows administrative
> scripting issues, and fits well with the topic of your post.

> (And besides that, I'm shocked that we haven't already gotten 50 questions
in
> there about telnet automation...)



> > Does anyone know a way that I can automate a telnet session like one can
> > with an FTP script?  I need the script to answer with my username when
it
> > asks, my password when it asks, and the number "2" when it asks.  These
> > questions are asked in this order when the session to the telnet server
is
> > opened.  This should be simple, since the telnet server only asks these
> > three questions.  I know how to do this with an FTP script but not with
a
> > telnet script .

> Here's a real short summary answer related to this;  you've already gotten
the
> best how-to answers, but I will repeat what Curtis and Torgeir mentioned
for the
> people in windows.server.scripting...

> There's no native automated telnet tool. It is theoretically somewhat
possible
> with a screenscraper and the NT4-era telnet client, but the newer one
doesn't
> work worth a diddle due to various oddities such as screen control
characters.

> There are several telnet clients which can be automated; the "free" ones
include
> most prominently feature TeraTerm, IVT, and TelScript; below is my quote
of
> Torgeir quoting me on the three tools, for people in

windows.server.scripting

- Show quoted text -

Quote:
> (did I really say all this?<g>) :

> ================
> ....There are several which are commercially
> available; the 2 which I use consistently are TeraTerm Pro and IVT Telnet.

> http://hp.vector.co.jp/authors/VA002416/teraterm.html is the home page for
> TeraTerm; it is open and easy to use, but is beginning to age.

> http://home.planet.nl/~ruurdb/IVT.HTM IVT telnet is alive and kicking and
has
> just gone "semi-commercial" - if you don't need Kerberos support, you can
get it
> for free also.

> and then we have this one ;-)


> Subject: Telnet from WSH - AND IT'S ABOUT FLIPPIN' TIME!!!!!
> Newsgroups: microsoft.public.scripting.wsh
> Date: 2002-10-25 19:28:03 PST
> http://groups.google.com/groups?th=f46671143f20f68f

> ================

> As for scripts to handle this, the TeraTerm ones are easy.  The web server
I use
> is experimental and is not listening for uploads right now, so I can't get
my
> TTL scripts transferred, but a short set will be there "soon" at
> http://dev.remotenetworktechnology.com/files/ttscripts.zip

> In the interim, here's a TeraTerm script that logs on to a Win2K server
via
> Telnet and does a password change.  Details of the logon sequence and
characters
> to wait for will vary depending on the OS/type of the system to which you
> connect.

> ; 1 - we set variables - prompts and the passwords
>  UsernamePrompt = 'login:'
>  Username = 'administrator'
>  PasswordPrompt = 'password:'
>  ;Current password
>  ;New password (assumes a password change)
>  Password = 'modron'
>  NewPassword = 'modron'
>  ;this is the LOCAL log file
>  PathtoLogFile = 'c:\data\logs\w2klog.txt'

> ;2 - we connect
>  connect param2

> ;3 - then we log in
>  wait   UsernamePrompt
>  sendln Username
>  wait   PasswordPrompt
>  sendln Password

> ;4 - wait for the w2k prompt; if it doesn't come in 5 seconds,
> ; assume its OK
>  wait '>'
>  timeout=5

> ;5 - Login is done, so we start a log, 0 for text not binary,
> ; 1 for append not overwrite
>  logopen PathtoLogFile 0 1

> ;6a - Kludge - since I can't echo params to log,
> ' we'll do an ipconfig to capture address
>  sendln 'ipconfig'
>  wait '>'

> ;6b - Now we do the password change and exit
>  sendln 'net user ' Username ' *'
>  wait 'user:'
>  sendln NewPassword
>  wait 'confirm'
>  sendln NewPassword
>  wait '>'
>  sendln 'exit'

> ;7 - Stop logging
>  logclose

> --
> Please respond in the newsgroup so everyone may benefit.
>  http://dev.remotenetworktechnology.com
> (email requests for support contract information welcomed)
>  ----------
>  Subscribe to Microsoft's Security Bulletins:
>  http://www.microsoft.com/technet/security/bulletin/notify.asp

> about  Automate a telnet session ( or automate any application needed

interaction )

on UNIX ,there is a very good solution, Expect of TCL.

just search stdout (with regular express) and send repository to stdin ,

only microsoft modify object TextStream of WSH maybe ok.

Or extend TextStream class to control stdout,stdin,stderr.

unix solution on http://expect.nist.gov/

every systemadmin shoud go there.



Mon, 08 Aug 2005 22:36:48 GMT  
 Automate a telnet session
Set Tel = CreateObject("Telst.Tel.1")
Tel.connect "192.168.2.11", "23"
'Tel.Minimize
WScript.Sleep 2000
Tel.PutCmd("Administrator" & vbCr)
WScript.Echo Response
Tel.PutCmd("password" & vbCr)
WScript.Echo Response

Alex, this script returns an error on both a Windows NT Server and A Windows
XP Pro computer, both saying:

Script: C:\Telnet.vbs
Line: 1
Char: 1
Error:  ActiveX component can't create object:  'Telst.Tel.1'
Code:  800A01AD
Source:  Microsoft VBScript runtime engine



Quote:
> I'm including the new "microsoft.public.windows.server.scripting"
newsgroup in
> this response.  This group is a new one focused on Windows administrative
> scripting issues, and fits well with the topic of your post.

> (And besides that, I'm shocked that we haven't already gotten 50 questions
in
> there about telnet automation...)



> > Does anyone know a way that I can automate a telnet session like one can
> > with an FTP script?  I need the script to answer with my username when
it
> > asks, my password when it asks, and the number "2" when it asks.  These
> > questions are asked in this order when the session to the telnet server
is
> > opened.  This should be simple, since the telnet server only asks these
> > three questions.  I know how to do this with an FTP script but not with
a
> > telnet script .

> Here's a real short summary answer related to this;  you've already gotten
the
> best how-to answers, but I will repeat what Curtis and Torgeir mentioned
for the
> people in windows.server.scripting...

> There's no native automated telnet tool. It is theoretically somewhat
possible
> with a screenscraper and the NT4-era telnet client, but the newer one
doesn't
> work worth a diddle due to various oddities such as screen control
characters.

> There are several telnet clients which can be automated; the "free" ones
include
> most prominently feature TeraTerm, IVT, and TelScript; below is my quote
of
> Torgeir quoting me on the three tools, for people in

windows.server.scripting

- Show quoted text -

Quote:
> (did I really say all this?<g>) :

> ================
> ....There are several which are commercially
> available; the 2 which I use consistently are TeraTerm Pro and IVT Telnet.

> http://hp.vector.co.jp/authors/VA002416/teraterm.html is the home page for
> TeraTerm; it is open and easy to use, but is beginning to age.

> http://home.planet.nl/~ruurdb/IVT.HTM IVT telnet is alive and kicking and
has
> just gone "semi-commercial" - if you don't need Kerberos support, you can
get it
> for free also.

> and then we have this one ;-)


> Subject: Telnet from WSH - AND IT'S ABOUT FLIPPIN' TIME!!!!!
> Newsgroups: microsoft.public.scripting.wsh
> Date: 2002-10-25 19:28:03 PST
> http://groups.google.com/groups?th=f46671143f20f68f

> ================

> As for scripts to handle this, the TeraTerm ones are easy.  The web server
I use
> is experimental and is not listening for uploads right now, so I can't get
my
> TTL scripts transferred, but a short set will be there "soon" at
> http://dev.remotenetworktechnology.com/files/ttscripts.zip

> In the interim, here's a TeraTerm script that logs on to a Win2K server
via
> Telnet and does a password change.  Details of the logon sequence and
characters
> to wait for will vary depending on the OS/type of the system to which you
> connect.

> ; 1 - we set variables - prompts and the passwords
>  UsernamePrompt = 'login:'
>  Username = 'administrator'
>  PasswordPrompt = 'password:'
>  ;Current password
>  ;New password (assumes a password change)
>  Password = 'modron'
>  NewPassword = 'modron'
>  ;this is the LOCAL log file
>  PathtoLogFile = 'c:\data\logs\w2klog.txt'

> ;2 - we connect
>  connect param2

> ;3 - then we log in
>  wait   UsernamePrompt
>  sendln Username
>  wait   PasswordPrompt
>  sendln Password

> ;4 - wait for the w2k prompt; if it doesn't come in 5 seconds,
> ; assume its OK
>  wait '>'
>  timeout=5

> ;5 - Login is done, so we start a log, 0 for text not binary,
> ; 1 for append not overwrite
>  logopen PathtoLogFile 0 1

> ;6a - Kludge - since I can't echo params to log,
> ' we'll do an ipconfig to capture address
>  sendln 'ipconfig'
>  wait '>'

> ;6b - Now we do the password change and exit
>  sendln 'net user ' Username ' *'
>  wait 'user:'
>  sendln NewPassword
>  wait 'confirm'
>  sendln NewPassword
>  wait '>'
>  sendln 'exit'

> ;7 - Stop logging
>  logclose

> --
> Please respond in the newsgroup so everyone may benefit.
>  http://dev.remotenetworktechnology.com
> (email requests for support contract information welcomed)
>  ----------
>  Subscribe to Microsoft's Security Bulletins:
>  http://www.microsoft.com/technet/security/bulletin/notify.asp



Sat, 13 Aug 2005 02:03:25 GMT  
 Automate a telnet session
Make sure you run the EXE from the location where it is being kept first - and
run the RegisterAll.bat script as well.  There are some weird dependencies
between the files.

I'm able to make it run OK...

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Quote:
> Set Tel = CreateObject("Telst.Tel.1")
> Tel.connect "192.168.2.11", "23"
> 'Tel.Minimize
> WScript.Sleep 2000
> Tel.PutCmd("Administrator" & vbCr)
> WScript.Echo Response
> Tel.PutCmd("password" & vbCr)
> WScript.Echo Response

> Alex, this script returns an error on both a Windows NT Server and A Windows
> XP Pro computer, both saying:

> Script: C:\Telnet.vbs
> Line: 1
> Char: 1
> Error:  ActiveX component can't create object:  'Telst.Tel.1'
> Code:  800A01AD
> Source:  Microsoft VBScript runtime engine



> > I'm including the new "microsoft.public.windows.server.scripting"
> newsgroup in
> > this response.  This group is a new one focused on Windows administrative
> > scripting issues, and fits well with the topic of your post.

> > (And besides that, I'm shocked that we haven't already gotten 50 questions
> in
> > there about telnet automation...)



> > > Does anyone know a way that I can automate a telnet session like one can
> > > with an FTP script?  I need the script to answer with my username when
> it
> > > asks, my password when it asks, and the number "2" when it asks.  These
> > > questions are asked in this order when the session to the telnet server
> is
> > > opened.  This should be simple, since the telnet server only asks these
> > > three questions.  I know how to do this with an FTP script but not with
> a
> > > telnet script .

> > Here's a real short summary answer related to this;  you've already gotten
> the
> > best how-to answers, but I will repeat what Curtis and Torgeir mentioned
> for the
> > people in windows.server.scripting...

> > There's no native automated telnet tool. It is theoretically somewhat
> possible
> > with a screenscraper and the NT4-era telnet client, but the newer one
> doesn't
> > work worth a diddle due to various oddities such as screen control
> characters.

> > There are several telnet clients which can be automated; the "free" ones
> include
> > most prominently feature TeraTerm, IVT, and TelScript; below is my quote
> of
> > Torgeir quoting me on the three tools, for people in
> windows.server.scripting
> > (did I really say all this?<g>) :

> > ================
> > ....There are several which are commercially
> > available; the 2 which I use consistently are TeraTerm Pro and IVT Telnet.

> > http://hp.vector.co.jp/authors/VA002416/teraterm.html is the home page for
> > TeraTerm; it is open and easy to use, but is beginning to age.

> > http://home.planet.nl/~ruurdb/IVT.HTM IVT telnet is alive and kicking and
> has
> > just gone "semi-commercial" - if you don't need Kerberos support, you can
> get it
> > for free also.

> > and then we have this one ;-)


> > Subject: Telnet from WSH - AND IT'S ABOUT FLIPPIN' TIME!!!!!
> > Newsgroups: microsoft.public.scripting.wsh
> > Date: 2002-10-25 19:28:03 PST
> > http://groups.google.com/groups?th=f46671143f20f68f

> > ================

> > As for scripts to handle this, the TeraTerm ones are easy.  The web server
> I use
> > is experimental and is not listening for uploads right now, so I can't get
> my
> > TTL scripts transferred, but a short set will be there "soon" at
> > http://dev.remotenetworktechnology.com/files/ttscripts.zip

> > In the interim, here's a TeraTerm script that logs on to a Win2K server
> via
> > Telnet and does a password change.  Details of the logon sequence and
> characters
> > to wait for will vary depending on the OS/type of the system to which you
> > connect.

> > ; 1 - we set variables - prompts and the passwords
> >  UsernamePrompt = 'login:'
> >  Username = 'administrator'
> >  PasswordPrompt = 'password:'
> >  ;Current password
> >  ;New password (assumes a password change)
> >  Password = 'modron'
> >  NewPassword = 'modron'
> >  ;this is the LOCAL log file
> >  PathtoLogFile = 'c:\data\logs\w2klog.txt'

> > ;2 - we connect
> >  connect param2

> > ;3 - then we log in
> >  wait   UsernamePrompt
> >  sendln Username
> >  wait   PasswordPrompt
> >  sendln Password

> > ;4 - wait for the w2k prompt; if it doesn't come in 5 seconds,
> > ; assume its OK
> >  wait '>'
> >  timeout=5

> > ;5 - Login is done, so we start a log, 0 for text not binary,
> > ; 1 for append not overwrite
> >  logopen PathtoLogFile 0 1

> > ;6a - Kludge - since I can't echo params to log,
> > ' we'll do an ipconfig to capture address
> >  sendln 'ipconfig'
> >  wait '>'

> > ;6b - Now we do the password change and exit
> >  sendln 'net user ' Username ' *'
> >  wait 'user:'
> >  sendln NewPassword
> >  wait 'confirm'
> >  sendln NewPassword
> >  wait '>'
> >  sendln 'exit'

> > ;7 - Stop logging
> >  logclose

> > --
> > Please respond in the newsgroup so everyone may benefit.
> >  http://dev.remotenetworktechnology.com
> > (email requests for support contract information welcomed)
> >  ----------
> >  Subscribe to Microsoft's Security Bulletins:
> >  http://www.microsoft.com/technet/security/bulletin/notify.asp



Sat, 13 Aug 2005 04:49:28 GMT  
 Automate a telnet session
Really?  I named the script telnet.vbs.  Where is the RegisterAll.bat script
located?  This was the script:

Set Tel = CreateObject("Telst.Tel.1")
Tel.connect "192.168.0.1", "23"
'Tel.Minimize'
WScript.Sleep 2000
Tel.PutCmd("Administrator" & vbCr)
WScript.Echo Response
Tel.PutCmd("password" & vbCr)
WScript.Echo Response



Quote:
> Make sure you run the EXE from the location where it is being kept first -
and
> run the RegisterAll.bat script as well.  There are some weird dependencies
> between the files.

> I'm able to make it run OK...

> --
> Please respond in the newsgroup so everyone may benefit.
>  http://dev.remotenetworktechnology.com
> (email requests for support contract information welcomed)
>  ----------
>  Subscribe to Microsoft's Security Bulletins:
>  http://www.microsoft.com/technet/security/bulletin/notify.asp



> > Set Tel = CreateObject("Telst.Tel.1")
> > Tel.connect "192.168.2.11", "23"
> > 'Tel.Minimize
> > WScript.Sleep 2000
> > Tel.PutCmd("Administrator" & vbCr)
> > WScript.Echo Response
> > Tel.PutCmd("password" & vbCr)
> > WScript.Echo Response

> > Alex, this script returns an error on both a Windows NT Server and A
Windows
> > XP Pro computer, both saying:

> > Script: C:\Telnet.vbs
> > Line: 1
> > Char: 1
> > Error:  ActiveX component can't create object:  'Telst.Tel.1'
> > Code:  800A01AD
> > Source:  Microsoft VBScript runtime engine



> > > I'm including the new "microsoft.public.windows.server.scripting"
> > newsgroup in
> > > this response.  This group is a new one focused on Windows
administrative
> > > scripting issues, and fits well with the topic of your post.

> > > (And besides that, I'm shocked that we haven't already gotten 50
questions
> > in
> > > there about telnet automation...)



> > > > Does anyone know a way that I can automate a telnet session like one
can
> > > > with an FTP script?  I need the script to answer with my username
when
> > it
> > > > asks, my password when it asks, and the number "2" when it asks.
These
> > > > questions are asked in this order when the session to the telnet
server
> > is
> > > > opened.  This should be simple, since the telnet server only asks
these
> > > > three questions.  I know how to do this with an FTP script but not
with
> > a
> > > > telnet script .

> > > Here's a real short summary answer related to this;  you've already
gotten
> > the
> > > best how-to answers, but I will repeat what Curtis and Torgeir
mentioned
> > for the
> > > people in windows.server.scripting...

> > > There's no native automated telnet tool. It is theoretically somewhat
> > possible
> > > with a screenscraper and the NT4-era telnet client, but the newer one
> > doesn't
> > > work worth a diddle due to various oddities such as screen control
> > characters.

> > > There are several telnet clients which can be automated; the "free"
ones
> > include
> > > most prominently feature TeraTerm, IVT, and TelScript; below is my
quote
> > of
> > > Torgeir quoting me on the three tools, for people in
> > windows.server.scripting
> > > (did I really say all this?<g>) :

> > > ================
> > > ....There are several which are commercially
> > > available; the 2 which I use consistently are TeraTerm Pro and IVT
Telnet.

> > > http://hp.vector.co.jp/authors/VA002416/teraterm.html is the home page
for
> > > TeraTerm; it is open and easy to use, but is beginning to age.

> > > http://home.planet.nl/~ruurdb/IVT.HTM IVT telnet is alive and kicking
and
> > has
> > > just gone "semi-commercial" - if you don't need Kerberos support, you
can
> > get it
> > > for free also.

> > > and then we have this one ;-)


> > > Subject: Telnet from WSH - AND IT'S ABOUT FLIPPIN' TIME!!!!!
> > > Newsgroups: microsoft.public.scripting.wsh
> > > Date: 2002-10-25 19:28:03 PST
> > > http://groups.google.com/groups?th=f46671143f20f68f

> > > ================

> > > As for scripts to handle this, the TeraTerm ones are easy.  The web
server
> > I use
> > > is experimental and is not listening for uploads right now, so I can't
get
> > my
> > > TTL scripts transferred, but a short set will be there "soon" at
> > > http://dev.remotenetworktechnology.com/files/ttscripts.zip

> > > In the interim, here's a TeraTerm script that logs on to a Win2K
server
> > via
> > > Telnet and does a password change.  Details of the logon sequence and
> > characters
> > > to wait for will vary depending on the OS/type of the system to which
you
> > > connect.

> > > ; 1 - we set variables - prompts and the passwords
> > >  UsernamePrompt = 'login:'
> > >  Username = 'administrator'
> > >  PasswordPrompt = 'password:'
> > >  ;Current password
> > >  ;New password (assumes a password change)
> > >  Password = 'modron'
> > >  NewPassword = 'modron'
> > >  ;this is the LOCAL log file
> > >  PathtoLogFile = 'c:\data\logs\w2klog.txt'

> > > ;2 - we connect
> > >  connect param2

> > > ;3 - then we log in
> > >  wait   UsernamePrompt
> > >  sendln Username
> > >  wait   PasswordPrompt
> > >  sendln Password

> > > ;4 - wait for the w2k prompt; if it doesn't come in 5 seconds,
> > > ; assume its OK
> > >  wait '>'
> > >  timeout=5

> > > ;5 - Login is done, so we start a log, 0 for text not binary,
> > > ; 1 for append not overwrite
> > >  logopen PathtoLogFile 0 1

> > > ;6a - Kludge - since I can't echo params to log,
> > > ' we'll do an ipconfig to capture address
> > >  sendln 'ipconfig'
> > >  wait '>'

> > > ;6b - Now we do the password change and exit
> > >  sendln 'net user ' Username ' *'
> > >  wait 'user:'
> > >  sendln NewPassword
> > >  wait 'confirm'
> > >  sendln NewPassword
> > >  wait '>'
> > >  sendln 'exit'

> > > ;7 - Stop logging
> > >  logclose

> > > --
> > > Please respond in the newsgroup so everyone may benefit.
> > >  http://dev.remotenetworktechnology.com
> > > (email requests for support contract information welcomed)
> > >  ----------
> > >  Subscribe to Microsoft's Security Bulletins:
> > >  http://www.microsoft.com/technet/security/bulletin/notify.asp



Sat, 13 Aug 2005 05:55:42 GMT  
 Automate a telnet session
In the folder where you installed Sivokho's ActiveX telnet client...

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Quote:
> Really?  I named the script telnet.vbs.  Where is the RegisterAll.bat script
> located?  This was the script:

> Set Tel = CreateObject("Telst.Tel.1")
> Tel.connect "192.168.0.1", "23"
> 'Tel.Minimize'
> WScript.Sleep 2000
> Tel.PutCmd("Administrator" & vbCr)
> WScript.Echo Response
> Tel.PutCmd("password" & vbCr)
> WScript.Echo Response



> > Make sure you run the EXE from the location where it is being kept first -
> and
> > run the RegisterAll.bat script as well.  There are some weird dependencies
> > between the files.

> > I'm able to make it run OK...

> > --
> > Please respond in the newsgroup so everyone may benefit.
> >  http://dev.remotenetworktechnology.com
> > (email requests for support contract information welcomed)
> >  ----------
> >  Subscribe to Microsoft's Security Bulletins:
> >  http://www.microsoft.com/technet/security/bulletin/notify.asp



> > > Set Tel = CreateObject("Telst.Tel.1")
> > > Tel.connect "192.168.2.11", "23"
> > > 'Tel.Minimize
> > > WScript.Sleep 2000
> > > Tel.PutCmd("Administrator" & vbCr)
> > > WScript.Echo Response
> > > Tel.PutCmd("password" & vbCr)
> > > WScript.Echo Response

> > > Alex, this script returns an error on both a Windows NT Server and A
> Windows
> > > XP Pro computer, both saying:

> > > Script: C:\Telnet.vbs
> > > Line: 1
> > > Char: 1
> > > Error:  ActiveX component can't create object:  'Telst.Tel.1'
> > > Code:  800A01AD
> > > Source:  Microsoft VBScript runtime engine



> > > > I'm including the new "microsoft.public.windows.server.scripting"
> > > newsgroup in
> > > > this response.  This group is a new one focused on Windows
> administrative
> > > > scripting issues, and fits well with the topic of your post.

> > > > (And besides that, I'm shocked that we haven't already gotten 50
> questions
> > > in
> > > > there about telnet automation...)



> > > > > Does anyone know a way that I can automate a telnet session like one
> can
> > > > > with an FTP script?  I need the script to answer with my username
> when
> > > it
> > > > > asks, my password when it asks, and the number "2" when it asks.
> These
> > > > > questions are asked in this order when the session to the telnet
> server
> > > is
> > > > > opened.  This should be simple, since the telnet server only asks
> these
> > > > > three questions.  I know how to do this with an FTP script but not
> with
> > > a
> > > > > telnet script .

> > > > Here's a real short summary answer related to this;  you've already
> gotten
> > > the
> > > > best how-to answers, but I will repeat what Curtis and Torgeir
> mentioned
> > > for the
> > > > people in windows.server.scripting...

> > > > There's no native automated telnet tool. It is theoretically somewhat
> > > possible
> > > > with a screenscraper and the NT4-era telnet client, but the newer one
> > > doesn't
> > > > work worth a diddle due to various oddities such as screen control
> > > characters.

> > > > There are several telnet clients which can be automated; the "free"
> ones
> > > include
> > > > most prominently feature TeraTerm, IVT, and TelScript; below is my
> quote
> > > of
> > > > Torgeir quoting me on the three tools, for people in
> > > windows.server.scripting
> > > > (did I really say all this?<g>) :

> > > > ================
> > > > ....There are several which are commercially
> > > > available; the 2 which I use consistently are TeraTerm Pro and IVT
> Telnet.

> > > > http://hp.vector.co.jp/authors/VA002416/teraterm.html is the home page
> for
> > > > TeraTerm; it is open and easy to use, but is beginning to age.

> > > > http://home.planet.nl/~ruurdb/IVT.HTM IVT telnet is alive and kicking
> and
> > > has
> > > > just gone "semi-commercial" - if you don't need Kerberos support, you
> can
> > > get it
> > > > for free also.

> > > > and then we have this one ;-)


> > > > Subject: Telnet from WSH - AND IT'S ABOUT FLIPPIN' TIME!!!!!
> > > > Newsgroups: microsoft.public.scripting.wsh
> > > > Date: 2002-10-25 19:28:03 PST
> > > > http://groups.google.com/groups?th=f46671143f20f68f

> > > > ================

> > > > As for scripts to handle this, the TeraTerm ones are easy.  The web
> server
> > > I use
> > > > is experimental and is not listening for uploads right now, so I can't
> get
> > > my
> > > > TTL scripts transferred, but a short set will be there "soon" at
> > > > http://dev.remotenetworktechnology.com/files/ttscripts.zip

> > > > In the interim, here's a TeraTerm script that logs on to a Win2K
> server
> > > via
> > > > Telnet and does a password change.  Details of the logon sequence and
> > > characters
> > > > to wait for will vary depending on the OS/type of the system to which
> you
> > > > connect.

> > > > ; 1 - we set variables - prompts and the passwords
> > > >  UsernamePrompt = 'login:'
> > > >  Username = 'administrator'
> > > >  PasswordPrompt = 'password:'
> > > >  ;Current password
> > > >  ;New password (assumes a password change)
> > > >  Password = 'modron'
> > > >  NewPassword = 'modron'
> > > >  ;this is the LOCAL log file
> > > >  PathtoLogFile = 'c:\data\logs\w2klog.txt'

> > > > ;2 - we connect
> > > >  connect param2

> > > > ;3 - then we log in
> > > >  wait   UsernamePrompt
> > > >  sendln Username
> > > >  wait   PasswordPrompt
> > > >  sendln Password

> > > > ;4 - wait for the w2k prompt; if it doesn't come in 5 seconds,
> > > > ; assume its OK
> > > >  wait '>'
> > > >  timeout=5

> > > > ;5 - Login is done, so we start a log, 0 for text not binary,
> > > > ; 1 for append not overwrite
> > > >  logopen PathtoLogFile 0 1

> > > > ;6a - Kludge - since I can't echo params to log,
> > > > ' we'll do an ipconfig to capture address
> > > >  sendln 'ipconfig'
> > > >  wait '>'

> > > > ;6b - Now we do the password change and exit
> > > >  sendln 'net user ' Username ' *'
> > > >  wait 'user:'
> > > >  sendln NewPassword
> > > >  wait 'confirm'
> > > >  sendln NewPassword
> > > >  wait '>'
> > > >  sendln 'exit'

> > > > ;7 - Stop logging
> > > >  logclose

> > > > --
> > > > Please respond in the newsgroup so everyone may benefit.
> > > >  http://dev.remotenetworktechnology.com
> > > > (email requests for support contract information welcomed)
> > > >  ----------
> > > >  Subscribe to Microsoft's Security Bulletins:
> > > >  http://www.microsoft.com/technet/security/bulletin/notify.asp



Sat, 13 Aug 2005 10:17:20 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Automating a telnet session.

2. Automating a telnet session.

3. Automate a telnet session

4. Automate Telnet Session : Tool/Control Needed

5. Howto open a telnet session from vbscript

6. script to able telnet session

7. Open Telnet Session

8. Script a telnet session

9. Open Telnet Session

10. Script a telnet session

11. Is there a way of scripting Telnet sessions ?

12. Automate a Telnet Command

 

 
Powered by phpBB® Forum Software