Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[MASM32]DLL Injector
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Sat Oct 20, 2007 10:22 am    Post subject: [MASM32]DLL Injector Reply with quote

Source included, hope you'll find this usefull (advises\corrections are welcomed).
Link


Last edited by DoomsDay on Sat Apr 05, 2008 1:54 pm; edited 3 times in total
Back to top
View user's profile Send private message
AJAX88
Expert Cheater
Reputation: 0

Joined: 27 Sep 2007
Posts: 168

PostPosted: Tue Oct 23, 2007 6:43 pm    Post subject: Reply with quote

Nice work Wink
Back to top
View user's profile Send private message
Hackerdevelopment
Advanced Cheater
Reputation: 0

Joined: 11 Oct 2007
Posts: 55

PostPosted: Tue Oct 23, 2007 6:48 pm    Post subject: Reply with quote

wat is this?just want to know.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Oct 23, 2007 6:51 pm    Post subject: Reply with quote

it injects a messagebox into the application. But you can customize it to inject a dll into any app.
_________________
Back to top
View user's profile Send private message
Hackerdevelopment
Advanced Cheater
Reputation: 0

Joined: 11 Oct 2007
Posts: 55

PostPosted: Tue Oct 23, 2007 6:58 pm    Post subject: Reply with quote

Ok thanks!
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Tue Oct 23, 2007 7:18 pm    Post subject: Reply with quote

Great job, but idk masm ;D

if it could be in C/C++/Delphi i'd appreacite Smile
Back to top
View user's profile Send private message
FerrisBuellerYourMyHero
Master Cheater
Reputation: 0

Joined: 14 Feb 2007
Posts: 401
Location: Inside your <kernel>

PostPosted: Sun Oct 28, 2007 8:32 am    Post subject: Reply with quote

Kaspersky wrote:
Great job, but idk masm ;D

if it could be in C/C++/Delphi i'd appreacite Smile



Kasp! things coded in straight ASM are very fast running and high performance!!!

If you can code it in ASM, then do it!

but you could easily re-create it in c++ or delphi if you wanted too...

but IDK why you'd want to lose some performance by doing that

_________________
You know, life moves pretty fast. If you don't stop and look around once in a while, You could miss it!

Back to top
View user's profile Send private message MSN Messenger
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Sun Oct 28, 2007 9:44 am    Post subject: Reply with quote

Delphi version:
Code:
program Injector;

{$APPTYPE CONSOLE}

uses
  SysUtils, windows, psapi, tlhelp32, inifiles;

var
  WName,PName,DName:string;
  DLLLocation:string;
  ProcessId:DWORD;

procedure PhraseINI();
var
  IniFile:TIniFile;
begin
  if FileExists(GetCurrentDir + '\Injector.ini') then
  begin
    IniFile:=TIniFile.Create(GetCurrentDir + '\Injector.ini');
    WName:=IniFile.ReadString('DLL Injector','Window','');
    PName:=IniFile.ReadString('DLL Injector','Target','notepad.exe');
    DName:=IniFile.ReadString('DLL Injector','DLL','MessageBox.dll');
  end
  else
  begin
    IniFile:=TIniFile.Create(GetCurrentDir + '\Injector.ini');
    IniFile.WriteString('Injector','Window','Untitled - Notepad');
    IniFile.WriteString('Injector','Target','notepad.exe');
    IniFile.WriteString('Injector','DLL','MessageBox.dll');
    PhraseINI();
  end;
end;

procedure GetPID();
var
  TempSnapshot:THandle;
  Process32:TProcessEntry32;
begin
  while (ProcessId=0) do
  begin
    TempSnapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
    Process32First(TempSnapshot,Process32);
    while Process32Next(TempSnapshot,Process32) do
      begin
        if Process32.szExeFile = PName then
            ProcessId:=Process32.th32ProcessID;
      end;
    CloseHandle(TempSnapshot);
  end;
end;

procedure InjectDLL();
var
  Process:THandle;
  TempHandle:THandle;
  AllocatedRegion:pointer;
  Empty:DWORD;
  NumberOfBytesWritten:Cardinal;
begin
  Process:=OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);
  AllocatedRegion:=VirtualAllocEx(Process,NIL,length(DLLLocation),MEM_COMMIT,PAGE_EXECUTE_READWRITE);
  WriteProcessMemory(Process,AllocatedRegion,pchar(DLLLocation),length(DLLLocation),NumberOfBytesWritten);
  if WName='' then
    sleep(750)
  else
    while FindWindow(nil,pchar(WName))=0 do
      sleep(10);
  TempHandle:=CreateRemoteThread(Process,nil,0,GetProcAddress(GetModuleHandle('kernel32.dll'),'LoadLibraryA'),AllocatedRegion,0,Empty);
  WaitForSingleObject(TempHandle,INFINITE);
  CloseHandle(TempHandle);
end;

begin
  PhraseINI();
  Writeln('- DLL Injector -'+#$0A+#$0D+'----------------');
  DLLLocation:=GetCurrentDir()+'\'+DName;
  if not FileExists(DLLLocation) then
  begin
    Writeln('Unable to locate the DLL');
    sleep(7000);
    exitprocess(0);
  end;
  Writeln('Waiting for process: '+PName);
  GetPID();
  Writeln(' - Process found'+#$0A+#$0D);
  Writeln('Injecting '+DName+' into '+PName);
  InjectDLL();
  Writeln(' - DLL injected');
  sleep(7000);
end.


Last edited by DoomsDay on Sun Oct 28, 2007 2:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sun Oct 28, 2007 12:28 pm    Post subject: Reply with quote

Thanks DoomsDay ! Very Happy
Back to top
View user's profile Send private message
giveme
Grandmaster Cheater
Reputation: 0

Joined: 16 Jan 2007
Posts: 933
Location: GMS - Khaini

PostPosted: Wed Oct 31, 2007 8:16 pm    Post subject: Reply with quote

can u make the injector to inject 3 dlls into 3different process?
Back to top
View user's profile Send private message
charch84
How do I cheat?
Reputation: 0

Joined: 25 Mar 2008
Posts: 7

PostPosted: Sat Apr 05, 2008 10:40 am    Post subject: Reply with quote

Thanks so much DoomsDay! Works well Cool
Back to top
View user's profile Send private message
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Sat Apr 05, 2008 12:47 pm    Post subject: Reply with quote

So, can you make a DLL which contains a ShowMessage, and then it would pop up in the application we injected it in?
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sat Apr 05, 2008 1:22 pm    Post subject: Reply with quote

Moller wrote:
So, can you make a DLL which contains a ShowMessage, and then it would pop up in the application we injected it in?
Sure, just call it in the DLLMain procedure.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Sat Apr 05, 2008 3:47 pm    Post subject: Reply with quote

charch84 wrote:
Thanks so much DoomsDay! Works well Cool


You bumped this even though the link is dead, saying 'works well' lol...?

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Sun Apr 06, 2008 1:40 am    Post subject: Reply with quote

Wiccaan wrote:
charch84 wrote:
Thanks so much DoomsDay! Works well Cool


You bumped this even though the link is dead, saying 'works well' lol...?

I think he ment the delphi one.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites