Menú

Mostrar Mensajes

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ú

Mensajes - fary

#901
ASM / Re: ASM 32Bits (Consola?)
4 Mayo 2011, 20:34 PM
format PE Console

Lo unico que para entrada y salida de datos tendras que usar API, no puedes usar interrupciones.

salu2!
#902
Este es el código que he reparado con los errores que me diiste Zero pero sigue sin funcionar:

Código (asm) [Seleccionar]
format PE GUI 4.0 DLL
entry DllEntryPoint

include 'win32ax.inc'

section '.code' code readable executable

proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
        locals
            proteccion dd ?
        endl

        invoke LoadLibrary,'user32.dll'
        invoke GetProcAddress,eax,"MessageBoxA"
        mov ebx,eax; ebx  = direccion MessageBoxA

        invoke VirtualProtect,ebx,5,PAGE_EXECUTE_READWRITE,addr proteccion

        mov byte[ebx],0xE9
        inc ebx
        call distancia
        distancia:
        pop ecx
        add ecx,4
        sub ecx,hook
        mov dword[ebx],ecx
        add ebx,4
        ret
endp

proc hook,uno,dos,tres,cuatro
    invoke MessageBox,0,'Juan te hookeo',0,0
    mov eax,0
    ret
endp
; VOID ShowErrorMessage(HWND hWnd,DWORD dwError);

proc ShowErrorMessage hWnd,dwError
  local lpBuffer:DWORD
        lea     eax,[lpBuffer]
        invoke  FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
        invoke  MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK
        invoke  LocalFree,[lpBuffer]
        ret
endp

; VOID ShowLastError(HWND hWnd);

proc ShowLastError hWnd
        invoke  GetLastError
        stdcall ShowErrorMessage,[hWnd],eax
        ret
endp
section '.data' data readable writeable
        mensajito db ?


section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL'

  import kernel,\
         GetLastError,'GetLastError',\
         SetLastError,'SetLastError',\
         FormatMessage,'FormatMessageA',\
         LocalFree,'LocalFree',\
         LoadLibrary,'LoadLibraryA',\
         GetProcAddress,'GetProcAddress',\
         VirtualProtect,'VirtualProtect'

  import user,\
         MessageBox,'MessageBoxA'

section '.edata' export data readable

  export 'ERRORMSG.DLL',\
         ShowErrorMessage,'ShowErrorMessage',\
         ShowLastError,'ShowLastError'

section '.reloc' fixups data discardable         


salu2! y gracias por la ayudaaa
#903
Bueno estoi intentando hookear una API desde una DLL creada en Fasm pero no lo consigo y nose que estoi haciendo mal, este es el código de la dll:

Código (asm) [Seleccionar]
format PE GUI 4.0 DLL
entry DllEntryPoint

include 'win32ax.inc'

section '.code' code readable executable

proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
        locals
            proteccion dd ?
        endl

        invoke LoadLibrary,'user32.dll'
        invoke GetProcAddress,eax,"MessageBoxA"
        mov ebx,eax; ebx  = direccion MessageBoxA

        invoke VirtualProtect,-1,ebx,5,PAGE_EXECUTE_READWRITE,edx

        mov ebx,0xE9
        inc ebx
        mov dword[ebx],hook
        add ebx,4
        ret
endp

proc hook,uno,dos,tres,cuatro
    invoke MessageBox,0,0,0,0
    mov eax,0
    ret
endp
; VOID ShowErrorMessage(HWND hWnd,DWORD dwError);

proc ShowErrorMessage hWnd,dwError
  local lpBuffer:DWORD
        lea     eax,[lpBuffer]
        invoke  FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
        invoke  MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK
        invoke  LocalFree,[lpBuffer]
        ret
endp

; VOID ShowLastError(HWND hWnd);

proc ShowLastError hWnd
        invoke  GetLastError
        stdcall ShowErrorMessage,[hWnd],eax
        ret
endp
section '.data' data readable writeable
        mensajito db ?


section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL'

  import kernel,\
         GetLastError,'GetLastError',\
         SetLastError,'SetLastError',\
         FormatMessage,'FormatMessageA',\
         LocalFree,'LocalFree',\
         LoadLibrary,'LoadLibraryA',\
         GetProcAddress,'GetProcAddress',\
         VirtualProtect,'VirtualProtectEx'

  import user,\
         MessageBox,'MessageBoxA'

section '.edata' export data readable

  export 'ERRORMSG.DLL',\
         ShowErrorMessage,'ShowErrorMessage',\
         ShowLastError,'ShowLastError'

section '.reloc' fixups data discardable 



Esperando repuesta...

salu2!
#904
ya que esta programado en VB lo mas sensato seria decompilarlo con VBDecompiler y ver lo que hace tranquilamente  :P

salu2!
#905
Ah, vale...   ;D

thanks...
#906
Cita de: Karcrack en 27 Marzo 2011, 21:26 PM
Hasta que el proceso no se crea no continua la ejecución de tu programa :D

No se me ocurre como hacerlo... de una forma rápida, alguna pista?

salu2!
#907
Te refieres a esperar a que se cree el proceso usando WaitForSingleObject, no?

salu2!
#908
Muchas gracias a los dos, ya lo consegui hacer... el caso es que me quedo así:

#include <windows.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
   SECURITY_ATTRIBUTES sa;
   STARTUPINFO si;
   PROCESS_INFORMATION pi;
   
   void * leer;
   void * escribir;
 
   ZeroMemory(&sa,sizeof(&sa));
   
   sa.nLength = sizeof(SECURITY_ATTRIBUTES);
   sa.bInheritHandle = TRUE;
   sa.lpSecurityDescriptor = NULL;

    CreatePipe(&leer,&escribir,&sa,0);

    GetStartupInfoA(&si);
   
   si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
   si.wShowWindow = SW_HIDE;
   si.hStdOutput = escribir;
   si.hStdError  = escribir;
   si.hStdInput = leer;
   
   CreateProcessA(0,"c:\\windows\\system32\\cmd.exe /c dir",0,0,TRUE,0,0,0,&si,&pi);
   Sleep(200);
   CloseHandle(escribir);
   
   char buffer[1024];
   DWORD bleidos;
   ReadFile(leer,buffer,1024,&bleidos,0);
   MessageBoxA(0,buffer,0,0);
   
   system("PAUSE");
   return 0;
}



No es una "MegaShell" pero su "apaño" hace  :P
salu2!
#909
Muchas gracias Karcrack sin duda lo leeré pero tambien me gustaria saber que ago mal en el código que postee.

salu2!
#910
Buenas, estoi intentando hacer una Shell Remota en C  ya que nunca hice una en este lenguaje y me pica la curiosidad  :xD el caso es que no me sale...

El código que tengo es este:

#include <windows.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
    PHANDLE leer;
    PHANDLE escribir;
   
    SECURITY_ATTRIBUTES sa;
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
   
    DWORD bytes;

    CreatePipe(leer,escribir,&sa,0);

    si.cb = 68;
    si.dwFlags = 257;
   
    si.hStdError = escribir;
    si.hStdOutput = escribir;
   
    CreateProcessA(0,"cmd.exe /c ping 127.0.0.1", &sa, &sa, 1, NORMAL_PRIORITY_CLASS, 0, 0, &si, &pi);
    Sleep(100);
    CloseHandle(escribir);
   
    char buffer[1024];
    char total[1024];
   
    int ret = ReadFile(leer,buffer,250,&bytes,0);
   
    lstrcat(total,buffer);
   
    while(ret != 0)
    {
        ret = ReadFile(leer,buffer,250,&bytes,0);
        lstrcat(total,buffer);       
    }
   
    MessageBoxA(0,total,0,0);
    system("PAUSE");

    return 0;
}


Alguien sabe que hago mal?

salu2!