[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

telnet from ASP to send a simple command?

Posted on 2004-10-24
19
Medium Priority
?
2,083 Views
Last Modified: 2007-12-19
Is there any way in a ASP I can create a telnet session wait for a prompt to return (or perhaps just wait for a few seconds) and then send a command? I don't need to send any login information or the like just a command which is an ordinary text string.
0
Comment
Question by:thedogeater
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 3
19 Comments
 

Author Comment

by:thedogeater
ID: 12394357
I should say as well this is VBScript not .NET ASP
0
 
LVL 2

Expert Comment

by:larellnielsen
ID: 12396864
You will not be able to interact directly but you could create a DLL to do the heavy lifting and call that from ASP.

LaRell
0
 
LVL 14

Expert Comment

by:huji
ID: 12398087
Yes there probably is. If you can do something from command prompt, then you can do it from within ASP using a speical feature named Wscript Shell.
An example is here:
You can type "nslookup -type=mx www.yahoo.com" to find the IP addresses of Yahoo mail servers. What if you want to do it from within asp? ASP by itself does not have a utility to perform a Name Server Lookup, so... this article shows you how it is done:
http://www.asp101.com/articles/hojjat/mxlookup/default.asp
Conclusion: May be we can manage it to perform a telnet connection (even) this way. I need your commands (which you can run from command prompt to work with that remote server) and will try to write a code (if I can) to do it from within ASP.
Wish I can help
Huji
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:thedogeater
ID: 12405145
The commands are simple in each case I need to only send one pice of text. I each case I just wish to send commands to certain IPs so I click on button 1 and it telnet to IP A and sends 'abc' click on button 2 and it sends '123' to IP B
0
 
LVL 2

Expert Comment

by:larellnielsen
ID: 12407394
I would caution you against do something like this. By utilizing the WSH you are going to have to expose areas that should be secured. Although it may be nice to do these type of function straight from ASP, always err on the side of percaution.

LaRell
0
 
LVL 14

Expert Comment

by:huji
ID: 12407817
All right.
It seems to be easy. Please send me a line of that command, and I'll try to manage it for you.
And larellnielsen, told some important point sooner than I would do! This is correct. See, when you are connecting to another computer with WScript Shell, or with XMLHTTP (the second one is something like, ASP opens a web browser, goes to a web site, and then stores the HTML passed to him from that web site, to you, so that you can use it; You may have noticed XMLHTTP in that ASP101 article too), you must accept the risk that, you may be at risk. But the amount of risk is just no more than when you connect to the computers with telnet yourself. ASP just does what you do, and the risk is just the same.
Waiting for your one line command.
Huji
0
 
LVL 2

Expert Comment

by:larellnielsen
ID: 12421732
Actually I was talking more towards exposing WSH within ASP. XMLHTTP is fine because it works more like a COM object than WSH. WSH is integrated into your OS :o( so it requires that you lower your security so that you can access it.

LaRell
0
 
LVL 14

Expert Comment

by:huji
ID: 12422963
Very correct, LaRell.
Please send anything here, thedogeater.
Huji
0
 

Author Comment

by:thedogeater
ID: 12439698
Thanks it does not help me much however. I would need to see how some code to do this would work. Perhaps even if I could have a batch script to the telneting and subsequent sending of the command, then it is simple to call this from ASP no?
Security is not a concern, as this is available only on an trusted internal network.
0
 
LVL 14

Expert Comment

by:huji
ID: 12442629
Yes it is possible to be called from ASP! That's what I say. From within ASP you can call the batch file! This is the point I'm trying to make you catch.
Please send me a sample batch file. And I'll send you the ASP code. Let's give it try, huh?
Waiting for your action
Wish I can help,
Huji
0
 

Author Comment

by:thedogeater
ID: 12453541
creating the batch script is a biger problem for me now.
0
 
LVL 14

Expert Comment

by:huji
ID: 12457824
All right, we may manage it too! Just answer to this question:
How do you cannot to those telnet remotes now, by typing some things in Comand Prmopt? Starting with:
telnet IP_ADDRESS
and so on?
If yes, just type all of those, here in the post box, and send them to me!
Huji
0
 

Author Comment

by:thedogeater
ID: 12465930
Indeed I do I telnet to say 10.0.0.2 wait for the prompt and type 'Command1' or 'Command2' for example. I dont know how I can automate the whole thing.
0
 
LVL 14

Expert Comment

by:huji
ID: 12466335
is it something like this:
You first go to command prompt. Then you type:
telnet 10.0.0.2
Then you hit enter. Then you type command1. Again enter. Is it?
Then try this:

telnet 10.0.0.2
command1
...

now save it in a file in notepad. Then change the extension of the file from TXT to BAT and double click on it. It will automatically do the stuff. If it worker, then let's do it from ASP.
Waiting for your commnet,
Huji
0
 

Author Comment

by:thedogeater
ID: 12525004
Hi Huji,

Thanks for you help but your script does not work the telnet command does not return untill it has finshed so can not take the input form the line bleow....
0
 
LVL 14

Accepted Solution

by:
huji earned 800 total points
ID: 12525379
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question