mgeeky-Penetration-Testing-.../red-teaming/code-exec-templates/wscript-shell-stdin-code-ex...

20 lines
506 B
Plaintext
Raw Normal View History

2020-05-06 19:22:32 +02:00
'
' This script uses classic WScript.Shell Exec method to
' execute given command in a hidden window via StdIn passed to a dedicated
' launcher command (powershell.exe in this example).
'
' Mariusz B. / mgeeky, <mb@binary-offensive.com>
' (https://github.com/mgeeky)
'
command = "notepad.exe"
launcher = "powershell -nop -w hid -Command -"
With CreateObject("WScript.Shell")
With .Exec(launcher)
.StdIn.WriteLine command
.StdIn.WriteBlankLines 1
.Terminate
End With
End With