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

#611
Bueno este código lo tenía por ahí de hace un par de años, y al final lo voy a perder así que aquí os lo dejo por a alguien le sirve.

Código (asm) [Seleccionar]
; Programado por mDrinky o Juan fary.
; drinky.94@hotmail.com

include 'win32ax.inc'

; Instrucciones a las que es capaz de sacar la longitud.

; mov esp,ebp                          = 0x8B  2 bytes
; push ebp                             = 0x55  1 byte
; mov Reg,DWORD                        = 0xB8 + Registro   5 bytes
; ret                                  = 0xC3 1 byte
; ret Numero                           = 0xC2 2 bytes
; mov dword[Direccion],Numero          = 0x83 7 bytes

.data
    DLL   db 'USER32.DLL',0
    API   db 'MessageBoxA',0
    MsgHook   db 'Api Hookeada',0

    ApiBuena   dd ?
    CanSalto   dd ?
    oPer   dd ?
    Salto   dd ?

.code
start:
    invoke LoadLibraryA,DLL
    invoke GetProcAddress,eax,API
    mov [ApiBuena],eax

    push MiFuncion
    Call Hookear

    push 0
    push 0
    push 0
    push 0

    call [MessageBoxA]

    push 0
    call [ExitProcess]


MiFuncion:
    pop ecx

    add esp,0xC

    push 0
    push 0
    push MsgHook
    push 0

    push ecx

    ApiVerdadera:
    db 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90

    push eax

    mov eax,[ApiBuena]
    add eax,[CanSalto]
    mov [Salto],eax

    pop eax

    jmp [Salto]


proc Hookear,FunHook

    mov ecx,0

    NumOpcode:

    cmp byte[eax],0x8B
    jne NoOp1

    add ecx,2
    add eax,2

    NoOp1:

    cmp byte[eax],0x55
    jne NoOp2

    add ecx,1
    add eax,1

    NoOp2:

    cmp byte[eax],0xB8
    jb NoOp3
    cmp byte[eax],0xBD
    ja NoOp3

    add ecx,5
    add eax,5

    NoOp3:

    cmp byte[eax],0xC3
    jne NoOp4

    add ecx,1
    add eax,1

    NoOp4:

    cmp byte[eax],0xC2
    jne NoOp5

    add ecx,2
    add eax,2

    NoOp5:

    cmp byte[eax],0x83
    jne NoOp6

    add ecx,7
    add eax,7

    NoOp6:

    cmp ecx,5
    jb NumOpcode

    mov [CanSalto],ecx

    invoke VirtualProtect,[ApiBuena],20,PAGE_EXECUTE_READWRITE,addr oPer
    invoke VirtualProtect,ApiVerdadera,20,PAGE_EXECUTE_READWRITE,addr oPer

    mov eax,[ApiBuena]
    mov edx,ApiVerdadera

    mov ecx,0

    GuardarBytes:
    mov bl,byte[eax+ecx]
    mov byte[edx+ecx],bl

    inc ecx

    cmp ecx,[CanSalto]
    jne GuardarBytes

    mov eax,[ApiBuena]

    mov byte[eax],0x68
    inc eax

    mov ebx,dword[FunHook]
    mov dword[eax],ebx

    add eax,4

    mov byte[eax],0xC3

    ret
endp

.end start


No recalcula todas las API pero si la gran mayoría.

saludos.
#612
Lo has resuelto de la manera que te explicaron hace dos días, poco habrás tenido que investigar XD
#613
Perl.   :rolleyes:
#614
Lo mas fácil y que no falla es ejecutarlo desde la terminal:

python archivo.py
#615
Foro Libre / Re: Cuando nos va a regalar el-brujo...
18 Diciembre 2014, 17:27 PM
Claro que sí, hacer la carta a los reyes magos que vuestros pedidos serán cumplidos!!  :rolleyes:
#616
Análisis y Diseño de Malware / Re: [?] Proactiva?
15 Diciembre 2014, 13:53 PM
Se llama heurística, y para hacerlo indetectable hay, o había varios truquillos como hacer un bucle de X duración al iniciar el programa y cosas así.

Básicamente detecta el modo en el que haces las cosas.


#617
He mirado el código y he hecho unos retoques.

#include <pthread.h>
#include <stdio.h>
#include <err.h>

#define NUM_THREADS 10

pthread_mutex_t mutex;
pthread_cond_t tickets_ready;

int tickets = 2;

void* pthread_function(void *myline)
{
char *theline;
pthread_mutex_lock(&mutex);
while(tickets==0)
{
pthread_cond_wait(&tickets_ready,&mutex);
}

-- tickets;
pthread_mutex_unlock(&mutex);

theline = (char *)myline;
printf("Thread working: ¡this is my line! -> %s\n", theline);
sleep(1);


pthread_mutex_lock(&mutex);
++tickets;
if (tickets>=1)
{
pthread_cond_broadcast(&tickets_ready);
/* code */
}

pthread_mutex_unlock(&mutex);
pthread_exit(NULL);
}

int main(int argc, char** argv)
{
pthread_t thread[NUM_THREADS];

long int i=0;
char *line;
//char *lines[NUM_THREADS];

FILE *file = fopen("commands.txt", "r");
char *data;
size_t len;


if(file == NULL)
{
err(1, "commands.txt");
}


while( i < NUM_THREADS &&  getline(&line,&len,file) != -1)
{
//printf("%s\n", line);
pthread_create(thread+i, NULL, pthread_function, (void *)line);
                pthread_join(thread[i], NULL);
++i;
}

/*for ( i = 0; i < NUM_THREADS; ++i)
{
pthread_join(thread[i], NULL);
}*/
return 0;
}


contenido de commands.txt:

1
2
3
4
5
6
7
8
9
0


Modo de compilación y ejecución del programa:

x@x:~/Escritorio$ gcc main.c -o main -lpthread
x@x:~/Escritorio$ ./main
Thread working: ¡this is my line! -> 1

Thread working: ¡this is my line! -> 2

Thread working: ¡this is my line! -> 3

Thread working: ¡this is my line! -> 4

Thread working: ¡this is my line! -> 5

Thread working: ¡this is my line! -> 6

Thread working: ¡this is my line! -> 7

Thread working: ¡this is my line! -> 8

Thread working: ¡this is my line! -> 9

Thread working: ¡this is my line! -> 0


saludos.
#618
Programación C/C++ / Re: InputBox Windows
12 Diciembre 2014, 19:28 PM
Con la API CreateWindowEx. Por aquí tienes algunos ejemplos.

#620
En realidad no creo que así puedas evitar muchos crackers.

Por otra parte desde una DLL se puede crear una ventana perfectamente, pero claro, una DLL no la puedes ejecutar como un ejecutable... así que la tendrías que cargar desde otro exe.