Using SendKeys from vbs in a total hidden way?

0

1

Here is what I am planning to do

Set WshShell = WScript.CreateObject("WScript.Shell")    
WshShell.Run"cmd"
WshShell.AppActivate"telnet 192.168.1.1"     
WScript.Sleep 50    
WshShell.SendKeys"telnet 192.168.1.1 -f 22.txt{ENTER}" 
WScript.Sleep 2000    
WshShell.SendKeys "admin{ENTER}"     
WScript.sleep 50     
WshShell.SendKeys"sys info{ENTER}"   
WScript.Sleep 50

I want this totally hidden but the sendkeys just works on activated window so trying to make it hidden by minimizing the window failed. I couldn't find any understandable way to do this

Is this possible without additional tools?

mina nageh

Posted 2018-06-02T22:55:59.950

Reputation: 141

"Did you read over ss64.com/vb/run.html and see the section labeled Invisible.vbs" yes i did ............is there any way to hide that "cmd window running the telnet commands with sendkeys" that what i have meant in the first place. or the sendkeys can be replaced with something else ? – mina nageh – 2018-06-03T00:16:24.433

but how can i get it automaticed ?? – mina nageh – 2018-06-03T02:06:27.783

Answers

1

The only solution that I found is using AutoIt Scripting Language

DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) 
Run('cmd',"",@SW_HIDE) Local $hWnd = WinWait("[CLASS:cmd]", "", 1) 
Sleep (250) 
ControlSend("C:\WINDOWS\SYSTEM32\cmd.exe","","","telnet 192.168.1.1 -f log.txt{ENTER}") 
Sleep (2500) 
ControlSend("Telnet 192.168.1.1","","","pass1{ENTER}") 
ControlSend("Telnet 192.168.1.1","","","sysinfo{ENTER}") 
Sleep (1500) 
WinClose("Telnet 192.168.1.1")

mina nageh

Posted 2018-06-02T22:55:59.950

Reputation: 141

DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) Run('cmd',"",@SW_HIDE) Local $hWnd = WinWait("[CLASS:cmd]", "", 1) Sleep (250) ControlSend("C:\WINDOWS\SYSTEM32\cmd.exe","","","telnet 192.168.1.1 -f log.txt{ENTER}") Sleep (2500) ControlSend("Telnet 192.168.1.1","","","pass1{ENTER}") ControlSend("Telnet 192.168.1.1","","","sysinfo{ENTER}") Sleep (1500) WinClose("Telnet 192.168.1.1") – mina nageh – 2018-06-23T09:16:26.983

a screen shot of the organized one as i could not organize it in the comments https://i.imgur.com/KUGYN17.png

– mina nageh – 2018-06-23T09:19:22.200