Link to home
Create AccountLog in
VB Script

VB Script

--

Questions

--

Followers

Top Experts

Avatar of Simon336697
Simon336697๐Ÿ‡ฆ๐Ÿ‡บ

Telnet
Hi guys hope you can help.

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.


SOLUTION
Avatar of DjDezmondDjDezmond๐Ÿ‡ฌ๐Ÿ‡ง

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

ASKER CERTIFIED SOLUTION
Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.

Avatar of Simon336697Simon336697๐Ÿ‡ฆ๐Ÿ‡บ

ASKER

Thanks Adam and DjDezmond!

As usual..champion ...thank you.

S

Avatar of ADP indiaADP india๐Ÿ‡ฎ๐Ÿ‡ณ

Which code is below, Is it batch or VB?

use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10, Prompt => '');
if($t->open("computer.name.or.ip")) {
ย  ย  print "Connect successful\n";
}
else {
ย  ย  print "Could not connect\n";
}

Avatar of ADP indiaADP india๐Ÿ‡ฎ๐Ÿ‡ณ

ok ok, I got it,
ย it is a perl script

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

VB Script

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.