elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Ayuda con Shell
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ayuda con Shell  (Leído 1,317 veces)
WarGhost
I love basket


Desconectado Desconectado

Mensajes: 1.070



Ver Perfil WWW
Ayuda con Shell
« en: 23 Junio 2006, 21:24 pm »

una pregunta esque tengo un modulo para hacer una shell:

Código:
Option Explicit

Public Declare Function CreatePipe Lib "kernel32" ( _
          phReadPipe As Long, _
          phWritePipe As Long, _
          lpPipeAttributes As Any, _
          ByVal nSize As Long) As Long
     
      'Leer Tunel
      Public 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
     
      'Esto lo usa la funcion CreateProcessA
      Public Type SECURITY_ATTRIBUTES
          nLength As Long
          lpSecurityDescriptor As Long
          bInheritHandle As Long
      End Type
     
      'Esto lo usa la funcion CreateProcessA
      Public 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
     
      'Esto lo usa la funcion CreateProcessA
      Public Type PROCESS_INFORMATION
          hProcess As Long
          hThread As Long
          dwProcessId As Long
          dwThreadID As Long
      End Type
     
      'Esta funcion lanza el proceso y
      'devuelve sus datos a traves de PROCESS_INFORMATION
      Public 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
     
      'Cierra el tunel
      Public Declare Function CloseHandle Lib "kernel32" ( _
          ByVal hHandle As Long) As Long
     
      'Constantes necesarias para lo de antes
      Public Const NORMAL_PRIORITY_CLASS = &H20&
      Public Const STARTF_USESTDHANDLES = &H100&
      Public Const STARTF_USESHOWWINDOW = &H1
     
     

Public Function CMD32(ByVal Comando As String) As String
Dim mCommand, mOutputs
      On Error GoTo ACAGAR
          Dim proc As PROCESS_INFORMATION     'Informacion de CreateProcessA
          Dim ret As Long                     'Esto se usa para obtener el retorno de las
                                              'funciones API
          Dim start As STARTUPINFO            'Informacion de inicio para CreateProcessA
     
          Dim SA As SECURITY_ATTRIBUTES       'Atributos de seguridad para
                                              'CreateProcessA
          Dim hReadPipe As Long               'Lectura de Tunel
          Dim hWritePipe As Long              'Escritura de Tunel
          Dim lngBytesread As Long            'Cantidad de Bytes leidos
          Dim strBuff As String * 256         'Buffer de lectura de tunel
     
          'Creamos el tunel...
          SA.nLength = Len(SA)
          SA.bInheritHandle = 1&
          SA.lpSecurityDescriptor = 0&
          ret = CreatePipe(hReadPipe, hWritePipe, SA, 0)
         
          If ret = 0 Then
              'Si falla la creacion del tunel
              CMD32 = "Fallo de Conexion con Proceso. Error: " & Err.LastDllError
              Exit Function
          End If
         
          'Lanzamos el interprete de comandos...
          start.cb = Len(start)
          start.dwFlags = STARTF_USESTDHANDLES Or STARTF_USESHOWWINDOW
          start.hStdOutput = hWritePipe
          start.hStdError = hWritePipe
          'Buscar la ruta del CMD.exe y añadir /c y el comando
          mCommand = Environ("COMSPEC") + " /c " + Comando
          'Creamos el proceso usando la String mCommand de antes...
          'y obtenemos RET para saber si se ha ejecutado
          ret& = CreateProcessA(0&, mCommand, SA, SA, 1&, _
              NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
             
          If ret <> 1 Then
              'si no se encuentra el comando...
              CMD32 = "Archivo o Comando no encontrado"
              Exit Function
          End If
         
          'Cerramos el tunel
          ret = CloseHandle(hWritePipe)
          mOutputs = ""
         
          'lo leemos
          Do
              ret = ReadFile(hReadPipe, strBuff, 256, lngBytesread, 0&)
              mOutputs = mOutputs & Left(strBuff, lngBytesread)
          Loop While ret <> 0
         
          'cerramos los Handles (controladores)
          ret = CloseHandle(proc.hProcess)
          ret = CloseHandle(proc.hThread)
          ret = CloseHandle(hReadPipe)
         
          'y hacemos que la funcion devuelva el resultado del comando a traves
          ' de la string mOutputs
          CMD32 = mOutputs
          Exit Function
ACAGAR:
          CMD32 = "Error:" + Err.Description
      End Function


pero no es compatible con Windows 98 hay alguno forma de hacerlo ¿?¿?


En línea

Hans el Topo


Desconectado Desconectado

Mensajes: 1.754


"Estoy cansado de no hacer nada"


Ver Perfil WWW
Re: Ayuda con Shell
« Respuesta #1 en: 23 Junio 2006, 21:43 pm »

una pregunta esque tengo un modulo para hacer una shell:

Código:
Option Explicit

Public Declare Function CreatePipe Lib "kernel32" ( _
          phReadPipe As Long, _
          phWritePipe As Long, _
          lpPipeAttributes As Any, _
          ByVal nSize As Long) As Long
     
      'Leer Tunel
      Public 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
     
      'Esto lo usa la funcion CreateProcessA
      Public Type SECURITY_ATTRIBUTES
          nLength As Long
          lpSecurityDescriptor As Long
          bInheritHandle As Long
      End Type
     
      'Esto lo usa la funcion CreateProcessA
      Public 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
     
      'Esto lo usa la funcion CreateProcessA
      Public Type PROCESS_INFORMATION
          hProcess As Long
          hThread As Long
          dwProcessId As Long
          dwThreadID As Long
      End Type
     
      'Esta funcion lanza el proceso y
      'devuelve sus datos a traves de PROCESS_INFORMATION
      Public 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
     
      'Cierra el tunel
      Public Declare Function CloseHandle Lib "kernel32" ( _
          ByVal hHandle As Long) As Long
     
      'Constantes necesarias para lo de antes
      Public Const NORMAL_PRIORITY_CLASS = &H20&
      Public Const STARTF_USESTDHANDLES = &H100&
      Public Const STARTF_USESHOWWINDOW = &H1
     
     

Public Function CMD32(ByVal Comando As String) As String
Dim mCommand, mOutputs
      On Error GoTo ACAGAR
          Dim proc As PROCESS_INFORMATION     'Informacion de CreateProcessA
          Dim ret As Long                     'Esto se usa para obtener el retorno de las
                                              'funciones API
          Dim start As STARTUPINFO            'Informacion de inicio para CreateProcessA
     
          Dim SA As SECURITY_ATTRIBUTES       'Atributos de seguridad para
                                              'CreateProcessA
          Dim hReadPipe As Long               'Lectura de Tunel
          Dim hWritePipe As Long              'Escritura de Tunel
          Dim lngBytesread As Long            'Cantidad de Bytes leidos
          Dim strBuff As String * 256         'Buffer de lectura de tunel
     
          'Creamos el tunel...
          SA.nLength = Len(SA)
          SA.bInheritHandle = 1&
          SA.lpSecurityDescriptor = 0&
          ret = CreatePipe(hReadPipe, hWritePipe, SA, 0)
         
          If ret = 0 Then
              'Si falla la creacion del tunel
              CMD32 = "Fallo de Conexion con Proceso. Error: " & Err.LastDllError
              Exit Function
          End If
         
          'Lanzamos el interprete de comandos...
          start.cb = Len(start)
          start.dwFlags = STARTF_USESTDHANDLES Or STARTF_USESHOWWINDOW
          start.hStdOutput = hWritePipe
          start.hStdError = hWritePipe
          'Buscar la ruta del CMD.exe y añadir /c y el comando
          mCommand = Environ("COMSPEC") + " /c " + Comando
          'Creamos el proceso usando la String mCommand de antes...
          'y obtenemos RET para saber si se ha ejecutado
          ret& = CreateProcessA(0&, mCommand, SA, SA, 1&, _
              NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
             
          If ret <> 1 Then
              'si no se encuentra el comando...
              CMD32 = "Archivo o Comando no encontrado"
              Exit Function
          End If
         
          'Cerramos el tunel
          ret = CloseHandle(hWritePipe)
          mOutputs = ""
         
          'lo leemos
          Do
              ret = ReadFile(hReadPipe, strBuff, 256, lngBytesread, 0&)
              mOutputs = mOutputs & Left(strBuff, lngBytesread)
          Loop While ret <> 0
         
          'cerramos los Handles (controladores)
          ret = CloseHandle(proc.hProcess)
          ret = CloseHandle(proc.hThread)
          ret = CloseHandle(hReadPipe)
         
          'y hacemos que la funcion devuelva el resultado del comando a traves
          ' de la string mOutputs
          CMD32 = mOutputs
          Exit Function
ACAGAR:
          CMD32 = "Error:" + Err.Description
      End Function


pero no es compatible con Windows 98 hay alguno forma de hacerlo ¿?¿?
buscando apis que funcionene en win98... xd
te diria cuales pero ando algo verde...


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[AYUDA] Shell local.
Programación Visual Basic
79137913 2 1,887 Último mensaje 2 Febrero 2011, 16:22 pm
por 79137913
[Ayuda] shell con net cat
Hacking
dekii 7 2,889 Último mensaje 7 Marzo 2012, 18:03 pm
por dekii
Ayuda con shell c99
Hacking
[u]nsigned 1 2,483 Último mensaje 28 Mayo 2012, 06:57 am
por tremolero
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines