0

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?

  • "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 Jun 3 '18 at 0:16
  • but how can i get it automaticed ?? – mina nageh Jun 3 '18 at 2:06
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")
  • 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 Jun 23 '18 at 9:16
  • a screen shot of the organized one as i could not organize it in the comments i.imgur.com/KUGYN17.png – mina nageh Jun 23 '18 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.