VB Script
--
Questions
--
Followers
Top Experts
We have to find out what user account to use when connecting to a particular machine, whether it be NT or XP.
What we want to do is do the following WITHOUT establishing a connection to the target.
We want to telnet to the machine in question on port 3389 (rdp) to see if a blank banner comes up.
If it does, then we know it is an XP box.
So, basically, we a list of machines.
We want to run the telnet test on them on port 3389, then determine the outcome of the telnet test.
As running this test does not create a connection to the target, we can then determine what user account to use to create the connection, based on the outcome of the telnet test.
What Id like help with is:
If the test is successful, when I run the telnet test, I simply get a blank banner, and it just sits there.
If the test fails, I get back something to stdout.
C:\>telnet lv333 3389
Connecting To lv333...Could not open connection to the host, on port 3389: Connect failed
Guys how do we trap a blank banner's return code in a script, and close the banner automatically when running through a script?
Basically, what I want is:
1) If the result of the telnet test: ย telnet <computername> 3389
is successful, then use account <domain1>\useraccount
2) If the result fails, then use account <domain2>\useraccount
The problem I see is the test for a successful telnet results in a banner screen with nothing on it, and no way to close. If I can somehow trap this, close the banner window, and report back that it was successful, that would be great.
Thanks guys.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
As usual..champion ...thank you.
S
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10, Prompt => '');
if($t->open("computer.name
ย ย print "Connect successful\n";
}
else {
ย ย print "Could not connect\n";
}
ย it is a perl script






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
VB Script
--
Questions
--
Followers
Top Experts
VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.