我正在玩CTF,并希望将某些内容输送到NetCat中,以便在端口上侦听应用程序的响应。
这是我想做的:
Dim oShell : Set oShell = CreateObject("WScript.Shell")
oShell.Run "C:\users\me\Desktop\my_app.exe"
WScript.Sleep 1000
oShell.Exec "echo hello > C:\users\me\Desktop\netcat\nc.exe 127.0.0.1 4444"
我得到的是错误
WshShell.Exec: The system cannot find the file specified.
我认为是关于echo命令的,因为将其删除正常。我在做什么错?
@m0atz如所述@OmeGastripes,您需要使用stdin。以下说明了:
Dim wshShell, oExec, buffer
Set wshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("C:\users\me\Desktop\netcat\nc.exe 127.0.0.1 4444")
oExec.StdIn.Write "hello" & vbCrLf
buffer = ""
While Not oExec.StdOut.AtEndOfStream
buffer = buffer & oExec.StdOut.Read(1)
Wend
WScript.Echo buffer