#1Qua Nov 14, 2012 11:04 pm
Fazer um injetor de dll simples delphi7
Vim trazer um video feito por min
Fazer um injetor de dll simples delphi7
Para vcs entenderem melhor
1°
Adicione:
2 Buttons
2 Edits
3 Label
1 OpenFileDialog
1 Timer
2°
Edite:
Form1 >> "Nome Do Seu Injetor"
Button1 >> Carregar
Button2 >> Aguardar Processo
Edit1 >> Em Branco
Edit2 >> Em Branco
Label1 >> Processo:
Label2 >> Dll:
Label3 >> Creditos: "Nome Do Criador" (So Coloque Essa Label Se Quiser)
Organize Ao Seu Gosto
3°
Adicionar Codigo:
Apague os codigos originais Copie o Codigo a baixo
[Tens de ter uma conta e sessão iniciada para poderes visualizar este link]
Agradeça Não Custa cash
Fazer um injetor de dll simples delphi7
Para vcs entenderem melhor
1°
Adicione:
2 Buttons
2 Edits
3 Label
1 OpenFileDialog
1 Timer
2°
Edite:
Form1 >> "Nome Do Seu Injetor"
Button1 >> Carregar
Button2 >> Aguardar Processo
Edit1 >> Em Branco
Edit2 >> Em Branco
Label1 >> Processo:
Label2 >> Dll:
Label3 >> Creditos: "Nome Do Criador" (So Coloque Essa Label Se Quiser)
Organize Ao Seu Gosto
3°
Adicionar Codigo:
Apague os codigos originais Copie o Codigo a baixo
- Código:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, TlHelp32;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
OpenDialog1: TOpenDialog;
Timer1: TTimer;
Button2: TButton;
Label3: TLabel;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetPID(ProcessName: string): DWORD;
var MyHandle: THandle;
Struct: TProcessEntry32;
begin
Result:=0;
try
MyHandle:=CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
Struct.dwSize:=Sizeof(TProcessEntry32);
if Process32First(MyHandle, Struct) then
if Struct.szExeFile=ProcessName then
begin
Result:=Struct.th32ProcessID;
Exit;
end;
while Process32Next(MyHandle, Struct) do
if Struct.szExeFile=ProcessName then
begin
Result:=Struct.th32ProcessID;
Exit;
end;
except on exception do
Exit;
end;
end;
function InjectDll(PID:DWORD; sDll:string):Boolean;
var
hLib: Pointer;
hThread: THandle;
pMod: Pointer;
hOpen: THandle;
dWritten: Cardinal;
ThreadID: Cardinal;
begin
Result := FALSE;
hOpen := OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID);
if hOpen <> INVALID_HANDLE_VALUE then
begin
hLib := GetProcAddress(GetModuleHandle(PChar('kernel32.dll')), PChar('LoadLibraryA'));
pMod := VirtualAllocEx(hOpen, nil, Length(sDll) + 1, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if WriteProcessMemory(hOpen, pMod, @sDll[1], Length(sDll), dWritten) then
Result := TRUE;
hThread := CreateRemoteThread(hOpen, nil, 0, hLib, pMod, 0, ThreadID);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hOpen);
CloseHandle(hThread);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not OpenDialog1.Execute then Exit;
Edit2.Text:=OpenDialog1.FileName;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Timer1.Enabled:=True;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var PID: DWORD;
begin
Timer1.Enabled:=False;
PID:=GetPID(Edit1.Text);
if PID=0 then
begin
Timer1.Enabled:=True;
Exit;
end;
Timer1.Enabled:=False;
if InjectDll(PID, Edit2.Text) then
MessageBoxA(Handle, 'DLL injetada com sucesso!', 'DLL Injector', MB_ICONEXCLAMATION+MB_SYSTEMMODAL)
else
MessageBoxA(Handle, 'Erro ao injetar DLL.', 'DLL Injector', MB_ICONERROR+MB_SYSTEMMODAL);
end;
end.
[Tens de ter uma conta e sessão iniciada para poderes visualizar este link]
Agradeça Não Custa cash