Para W$7:
Código [Seleccionar]
wmic /namespace:\\root\SecurityCenter2 PATH AntiVirusProduct GET /value
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menúwmic /namespace:\\root\SecurityCenter2 PATH AntiVirusProduct GET /value
wmic /namespace:\\root\SecurityCenter PATH AntiVirusProduct GET /value
If GetModuleHandle("VBA6") Then Debug.Print "only compiled": End
If App.LogMode = 0 Then Debug.Print "only compiled": End
Public Sub StopShell()
Call CloseHandle(lHInput)
Call CloseHandle(lHOutput)
Call TerminateProcess(lCmdID, ByVal 0&)
Call CloseHandle(lCmdID)
End Sub
Public Function GetOutTextShell(sOut As String) As Boolean
Dim bBuffer() As Byte
Dim lLen As Long
Dim lLenBuff As Long
If PeekNamedPipe(lHOutput, 0&, 0&, 0&, lLen, 0&) Then
ReDim bBuffer(lLen)
If ReadFile(lHOutput, bBuffer(0), lLen, lLenBuff, ByVal 0&) Then
sOut = Left$(StrConv(bBuffer, vbUnicode), lLenBuff)
GetOutTextShell = True
End If
End If
End Function
Public Sub SendToShell(sCMD As String)
Dim sBytes() As Byte
Dim BytesWritten As Long
If lHInput Then
sBytes = StrConv(sCMD & vbNewLine, vbFromUnicode)
Call WriteFile(lHInput, ByVal sCMD, Len(sCMD), BytesWritten, 0&)
End If
End Sub
Public Function StartShell() As Boolean
Dim tSecurityAttributes As SECURITY_ATTRIBUTES
Dim tStartInfo As STARTUPINFO
Dim tProcessInfo As PROCESS_INFORMATION
Dim lCurrentID As Long
lCurrentID = GetCurrentProcess()
With tStartInfo
.cb = Len(tStartInfo)
.dwFlags = STARTF_USESTDHANDLES Or STARTF_USESHOWWINDOW
End With
With tSecurityAttributes
.nLength = Len(tSecurityAttributes)
.bInheritHandle = 1
End With
If CreatePipe(lHOutput, tStartInfo.hStdOutput, tSecurityAttributes, 0) Then
If CreatePipe(tStartInfo.hStdInput, lHInput, tSecurityAttributes, 0) Then
If DuplicateHandle(lCurrentID, tStartInfo.hStdOutput, lCurrentID, tStartInfo.hStdError, 0&, True, DUPLICATE_SAME_ACCESS) Then
If CreateProcess(vbNullString, "cmd", tSecurityAttributes, tSecurityAttributes, 1, NORMAL_PRIORITY_CLASS, ByVal 0&, vbNullString, tStartInfo, tProcessInfo) Then
Call CloseHandle(tProcessInfo.hThread)
StartShell = True
Exit Function
End If
End If
End If
End If
Call StopShell
End Function
http://en.wikipedia.org/wiki/Loop_unwinding
http://foro.elhacker.net/programacion_visual_basic/ayuda_con_cmd_pipe_vb6-t277687.0.html;msg1367077#msg1367077
http://www.ngssoftware.com/research/papers/WritingSmallShellcode.pdf