starting default telnet app and send commands
Author |
Message |
Papa Sa #1 / 12
|
 starting default telnet app and send commands
Hi All, I'm looking for a way to automate the setup of a telnet session to a number of hosts. What I would like is the ability to open the default telnet application to a certain host and wait for the various prompts and reply with some commands. After that the user of the application should work with the telnet session. I can open a telnet session from a vb script but I would like to know if it is possible to use some methods or properties to manipulate the session afterwards. If anyone has a sample or some info on how to manipulate a sesqion I would greatly appreciate Best regards, Papa
|
Sat, 21 Aug 2004 22:35:39 GMT |
|
 |
Alex Angelopoulo #2 / 12
|
 starting default telnet app and send commands
Cannot be done easily due to the way that Telnet sessions play with the console window - it does attempt to do direct writes and thus bypasses stdout (which would be what you want to capture if you were to automate a telnet session from WSH. Alternatively, you can do one of 3 things: (1) Buy a telnet ActiveX control (none of which I have seen that I've liked, so I can't recommend any - Dart, Mabry, and at least 2-3 other places make them. Those can be automated from VBScript. (2) Write your own (I keep hoping someone will). (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.
: Hi All, : : I'm looking for a way to automate the setup of a telnet session to a : number of hosts. : : What I would like is the ability to open the default telnet application : to a certain host and wait for the various prompts and reply with some : commands. : : After that the user of the application should work with the telnet : session. : : I can open a telnet session from a vb script but I would like to know if : it is possible to use some methods or properties to manipulate the : session afterwards. : : If anyone has a sample or some info on how to manipulate a sesqion I : would greatly appreciate : : Best regards, : : Papa
|
Sat, 21 Aug 2004 22:52:04 GMT |
|
 |
Papa Sa #3 / 12
|
 starting default telnet app and send commands
Thanks for your input Alex, My problem is that I don't have the right to install software on the clients. I use CRT from VanDyke Software, Inc and everything is possible from there but my customers have "standard" W2K pc's. So they only have the dos telnet. Could it be possible to force the telnet to write via stout only? Regards, Papa
|
Sat, 21 Aug 2004 23:13:46 GMT |
|
 |
Papa Sa #4 / 12
|
 starting default telnet app and send commands
Thanks for your input Alex, My problem is that I don't have the right to install software on the clients. I use CRT from VanDyke Software, Inc and everything is possible from there but my customers have "standard" W2K pc's. So they only have the dos telnet. Could it be possible to force the telnet to write via stout only? Regards, Papa
|
Sat, 21 Aug 2004 23:14:47 GMT |
|
 |
Alex Angelopoulo #5 / 12
|
 starting default telnet app and send commands
I've never seen anyone come up with a workable method [yet]. That's why I use TeraTerm. If you can play with the restrictions at all, neither TeraTerm nor IVT truly needs to be "installed"; they can be extracted as files and run remotely even - still problematic for a very careful LAN. There's nothing much that can do it raw. If you want to dig a bit, here's a link to the discussions on scripting telnet archived in Google. Watch out for wrapping URL - http://groups.google.com/groups?as_q=telnet&as_ugroup=microsoft.publi...
: Thanks for your input Alex, : : My problem is that I don't have the right to install software on the : clients. : : I use CRT from VanDyke Software, Inc and everything is possible from : there but my customers have : "standard" W2K pc's. : : So they only have the dos telnet. : : Could it be possible to force the telnet to write via stout only? : : Regards, : : Papa
|
Sat, 21 Aug 2004 23:26:58 GMT |
|
 |
Mythra #6 / 12
|
 starting default telnet app and send commands
Well, personally, I use SecureCRT from VanDyke Software :P Anywho, I have also written a telnet app for Windows using VB but haven't seen or used it in awhile, but I have done it therefore I know it can be done. If you guys need help with writing another, or even simply creating one that will be used in scripting, let me know and I will do my best to start you on the right path :) Mythran
Quote: > Thanks for your input Alex, > My problem is that I don't have the right to install software on the > clients. > I use CRT from VanDyke Software, Inc and everything is possible from > there but my customers have > "standard" W2K pc's. > So they only have the dos telnet. > Could it be possible to force the telnet to write via stout only? > Regards, > Papa
|
Sun, 22 Aug 2004 01:56:42 GMT |
|
 |
Alex Angelopoulo #7 / 12
|
 starting default telnet app and send commands
That's an interesting thought...would be *very* interesting if my plate wasn't so full. The thing about what I want is that it's fairly simple - I send text out, I want text back. I don't care if I can never see anything GUI at all - which simplifies everything except for the server side. Even *that* should be simpler because it just needs to be told "I'll take the lowest-tech terminfo you have". I would almost think this could be done somehow via a kludge with ADO or XMLHTTP....
: Well, personally, I use SecureCRT from VanDyke Software :P : : Anywho, I have also written a telnet app for Windows using VB but haven't : seen or used it in awhile, but I have done it therefore I know it can be : done. If you guys need help with writing another, or even simply creating : one that will be used : in scripting, let me know and I will do my best to start you on the right : path :) : : Mythran : :
: > Thanks for your input Alex, : > : > My problem is that I don't have the right to install software on the : > clients. : > : > I use CRT from VanDyke Software, Inc and everything is possible from : > there but my customers have : > "standard" W2K pc's. : > : > So they only have the dos telnet. : > : > Could it be possible to force the telnet to write via stout only? : > : > Regards, : > : > Papa : :
|
Sun, 22 Aug 2004 02:52:03 GMT |
|
 |
Mythra #8 / 12
|
 starting default telnet app and send commands
Well, if you want, try looking into the WinSock control and how to use it over the net and how to connect to a port. You don't need TELNET to do this. :) Mythran
Quote: > That's an interesting thought...would be *very* interesting if my plate wasn't so full. > The thing about what I want is that it's fairly simple - I send text out,
I want text back. I don't care if I can never see Quote: > anything GUI at all - which simplifies everything except for the server
side. Even *that* should be simpler because it just needs Quote: > to be told "I'll take the lowest-tech terminfo you have". > I would almost think this could be done somehow via a kludge with ADO or XMLHTTP....
Quote: > : Well, personally, I use SecureCRT from VanDyke Software :P > : > : Anywho, I have also written a telnet app for Windows using VB but haven't > : seen or used it in awhile, but I have done it therefore I know it can be > : done. If you guys need help with writing another, or even simply creating > : one that will be used > : in scripting, let me know and I will do my best to start you on the right > : path :) > : > : Mythran > : > :
> : > Thanks for your input Alex, > : > > : > My problem is that I don't have the right to install software on the > : > clients. > : > > : > I use CRT from VanDyke Software, Inc and everything is possible from > : > there but my customers have > : > "standard" W2K pc's. > : > > : > So they only have the dos telnet. > : > > : > Could it be possible to force the telnet to write via stout only? > : > > : > Regards, > : > > : > Papa > : > :
|
Sun, 22 Aug 2004 03:28:32 GMT |
|
 |
Alex Angelopoulo #9 / 12
|
 starting default telnet app and send commands
Unfortunately that has a lack of portability and sharability - but it would make sense for any of the centralized stuff I do. I think I've just been avoiding getting eyeball-to-eyeball with sockets..
: Well, if you want, try looking into the WinSock control and how to use it : over the net and how to connect to a port. You don't need TELNET to do : this. : : :) : : Mythran :
: > That's an interesting thought...would be *very* interesting if my plate : wasn't so full. : > : > The thing about what I want is that it's fairly simple - I send text out, : I want text back. I don't care if I can never see : > anything GUI at all - which simplifies everything except for the server : side. Even *that* should be simpler because it just needs : > to be told "I'll take the lowest-tech terminfo you have". : > : > I would almost think this could be done somehow via a kludge with ADO or : XMLHTTP.... : >
: > : Well, personally, I use SecureCRT from VanDyke Software :P : > : : > : Anywho, I have also written a telnet app for Windows using VB but : haven't : > : seen or used it in awhile, but I have done it therefore I know it can be : > : done. If you guys need help with writing another, or even simply : creating : > : one that will be used : > : in scripting, let me know and I will do my best to start you on the : right : > : path :) : > : : > : Mythran : > : : > :
: > : > Thanks for your input Alex, : > : > : > : > My problem is that I don't have the right to install software on the : > : > clients. : > : > : > : > I use CRT from VanDyke Software, Inc and everything is possible from : > : > there but my customers have : > : > "standard" W2K pc's. : > : > : > : > So they only have the dos telnet. : > : > : > : > Could it be possible to force the telnet to write via stout only? : > : > : > : > Regards, : > : > : > : > Papa : > : : > : : > : > : :
|
Sun, 22 Aug 2004 10:16:15 GMT |
|
 |
Papa Sa #10 / 12
|
 starting default telnet app and send commands
I'm not aware of the possibilities of using the winsock control from vbscript but I'm pretty sure it won't allow me to leave the script and 'hand over' the session to the user who is supposed to continue. (Unless I would write a complete telnet application in the script) But do share your knowledge anyway. In it's most primitive form its works like this. But it's not nice to use sleep rather than wait for something from the host as this makes it impossible to react to errors. If its not possible to capture from telnet is it the possible to read from the console screen ? Dim Shell Set Shell = CreateObject("WScript.Shell") output = Shell.Run("telnet 172.20.1.1") wscript.sleep(2000) Shell.Sendkeys "password1" & VBCrLf wscript.sleep(500) Shell.Sendkeys "enable" & VBCrLf wscript.sleep(500) Shell.Sendkeys "password2" & VBCrLf Wscript.sleep(500) Shell.Sendkeys "Command1" & VBCrLf Regards, Papa
|
Sun, 22 Aug 2004 16:46:36 GMT |
|
 |
Alex Angelopoulo #11 / 12
|
 starting default telnet app and send commands
Not reliably. In fact, I can never make it past a logon prompt, unfortunately...
: I'm not aware of the possibilities of using the winsock control from : vbscript but I'm pretty sure it won't allow me to leave the script and : 'hand over' the session to the user who is supposed to continue. : : (Unless I would write a complete telnet application in the script) : : But do share your knowledge anyway. : : In it's most primitive form its works like this. : But it's not nice to use sleep rather than wait for something from the : host as this makes it impossible to react to errors. : : If its not possible to capture from telnet is it the possible to read : from the console screen ? : : Dim Shell : Set Shell = CreateObject("WScript.Shell") : output = Shell.Run("telnet 172.20.1.1") : wscript.sleep(2000) : Shell.Sendkeys "password1" & VBCrLf : wscript.sleep(500) : Shell.Sendkeys "enable" & VBCrLf : wscript.sleep(500) : Shell.Sendkeys "password2" & VBCrLf : Wscript.sleep(500) : Shell.Sendkeys "Command1" & VBCrLf : : Regards, : : Papa
|
Mon, 23 Aug 2004 09:05:17 GMT |
|
 |
Alex Angelopoulo #12 / 12
|
 starting default telnet app and send commands
Kip, since I *really* don't want to use a controlled-distribution control - and since I might as well dig in at some point ant start playing with it - do you have any pointers on how I would go about starting to do *this* via VB5/VB6? ======================================== PROJECT: ActiveX (DLL?) TO RETURN PORT DATA ======================================== Goal: a lightweight control which is nothing more than a wrapper around a TCP component which exposes a single method - "probe", which sends a basic ping or query to a specific port on a specific IP address, and has a specified timeout. there should be 3 standard error levels - 1 for no response, another for a refused connection, and of course 0 if "something" was returned. There should also be provision for exposing data returned (via a property, or would this more appropriately be a return from the method?). I suspect there are 50 components out there which will do this and are free, but it sounds like it would be a simple enough thing for someone with minimal VB background to undertake..
: Well, if you want, try looking into the WinSock control and how to use it : over the net and how to connect to a port. You don't need TELNET to do : this. : : :) : : Mythran :
: > That's an interesting thought...would be *very* interesting if my plate : wasn't so full. : > : > The thing about what I want is that it's fairly simple - I send text out, : I want text back. I don't care if I can never see : > anything GUI at all - which simplifies everything except for the server : side. Even *that* should be simpler because it just needs : > to be told "I'll take the lowest-tech terminfo you have". : > : > I would almost think this could be done somehow via a kludge with ADO or : XMLHTTP.... : >
: > : Well, personally, I use SecureCRT from VanDyke Software :P : > : : > : Anywho, I have also written a telnet app for Windows using VB but : haven't : > : seen or used it in awhile, but I have done it therefore I know it can be : > : done. If you guys need help with writing another, or even simply : creating : > : one that will be used : > : in scripting, let me know and I will do my best to start you on the : right : > : path :) : > : : > : Mythran : > : : > :
: > : > Thanks for your input Alex, : > : > : > : > My problem is that I don't have the right to install software on the : > : > clients. : > : > : > : > I use CRT from VanDyke Software, Inc and everything is possible from : > : > there but my customers have : > : > "standard" W2K pc's. : > : > : > : > So they only have the dos telnet. : > : > : > : > Could it be possible to force the telnet to write via stout only? : > : > : > : > Regards, : > : > : > : > Papa : > : : > : : > : > : :
|
Mon, 23 Aug 2004 09:16:43 GMT |
|
|
|