2017-09-18 6 views
0

Je joue un CTF et je cherche à injecter du contenu dans netcat afin d'obtenir une réponse d'une application écoutant sur un port.Transférer du texte dans Netcat en utilisant WScript.Exec

Voici ce que je suis en train de faire:

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" 

Ce que je reçois est une erreur

WshShell.Exec: The system cannot find the file specified. 

Ce que je suppose est sur la commande echo en supprimant cela fonctionne très bien. Qu'est-ce que je fais mal?

+0

Qu'est-ce que 'my_app.exe'? – omegastripes

+0

juste une application qui crée un socket sur 4444 –

+0

Essayez ['StdIn'] (https://msdn.microsoft.com/ru-ru/library/yzzwsz3t (v = vs.84) .aspx). – omegastripes

Répondre

0

@ m0atz comme @omegastripes mentionné, vous devez utiliser StdIn. L'exemple suivant montre comment:

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