Getting the pre-login banner from server with VBScript - WeOnlyDo Discussion board

Getting the pre-login banner from server with VBScript (wodSSH / wodSSH.NET)

by Marvin, Thursday, July 01, 2021, 19:36 (1018 days ago) @ wodSupport

Thanks for the suggestions Jasmine. After taking your testing advices, i finally got the following to work. I had to remove the Login and Password properties and replace them with a series of WaitFor and Send's to handle the telnet login process. I also had to delay the Prompt property until after the login was complete. But by capturing the return from the first WaitFor, i was able to snag the banner data which had exactly what i needed. Below is the vbscript code that i got working and i'm providing it as a sample in case anyone else might find it of use.

On Error Resume Next
 Set connTelnet = CreateObject("WeOnlyDo.wodSSHCom")
 connTelnet.Hostname =
 connTelnet.Protocol = 1 'telnet
 connTelnet.Blocking = True
 connTelnet.StripANSI = True
 connTelnet.AllocatePty = False
 connTelnet.DataReady = 0
 telnetErr = err.Description
 banner = connTelnet.WaitFor("login:")
 connTelnet.Send "user" & VbCrLf
 connTelnet.WaitFor "password:"
 connTelnet.Send "password" & VbCrLf
 connTelnet.WaitFor "user>"
 wscript.echo "banner: " & VbCrLf& banner
 connTelnet.Prompt = "user>"
 buffOpen = connTelnet.Execute("ipconfig /all" & VbCrLf)
 connTelnet.Execute "exit" & VbCrLf, "\n"
 wscript.echo "telnetErr = " & telnetErr & VbCrLf & "buffOpen: " & buffOpen

Complete thread: