Injecting modules into exeDSP

Ideas and dreaming will go this forum
Post Reply

smartsmurf
Official SamyGO Developer
Posts: 111
Joined: Thu Jun 24, 2010 8:26 am
Location: Frankfurt, Germany

Injecting modules into exeDSP

Post by smartsmurf » Thu Aug 26, 2010 9:56 am

Since I could not find a solution which fits into my requirements I wrote a little tool which allows injection of a module into exeDSP process space.

I use ptrace() to attach to exePDS and then inject a block of code onto stack. This code calls dlopen, dlsym, the module entry, dlclose and returns control back to exeDSP.

For me this is the most convenient way to attach my stuff to exeDSP.

The syntax (with given example) is

Code: Select all

./injectso `pidof exeDSP` module.so Inject_Main /dtv/
Actually this loads module.so, runs Inject_Main("/dtv") and closes the module afterwards.

Cheers,
SM
You do not have the required permissions to view the files attached to this post.
Last edited by smartsmurf on Mon Oct 11, 2010 10:03 am, edited 2 times in total.

smartsmurf
Official SamyGO Developer
Posts: 111
Joined: Thu Jun 24, 2010 8:26 am
Location: Frankfurt, Germany

Re: Injecting modules into exeDSP

Post by smartsmurf » Thu Aug 26, 2010 12:41 pm

bmwskead wrote: for understanding, to load a custom game module the execution line should be like this:

Code: Select all

./injectso `pidof exeDSP` load_custom_module.so Game_Main 
Actually yes, but please be aware that exeDSP opens the module. So if it is not within the search path, you need to specifiy

Code: Select all

./injectso `pidof exeDSP` /full/path/to/load_custom_module.so Game_Main 
Also when your Game_Main() function makes use of the path argument, you need to extend the line and pass it as first argument

Code: Select all

./injectso `pidof exeDSP` /full/path/to/load_custom_module.so Game_Main /full/path/to/ 
Just to avoid confusion.
Last edited by smartsmurf on Wed Oct 20, 2010 8:34 am, edited 1 time in total.

User avatar
erdem_ua
SamyGO Admin
Posts: 3090
Joined: Thu Oct 01, 2009 6:02 am
Location: Istanbul, Turkey
Contact:

Re: Injecting modules into exeDSP

Post by erdem_ua » Thu Aug 26, 2010 5:31 pm

Thanks, It looks better than GDB way :)

smartsmurf
Official SamyGO Developer
Posts: 111
Joined: Thu Jun 24, 2010 8:26 am
Location: Frankfurt, Germany

Re: Injecting modules into exeDSP

Post by smartsmurf » Mon Sep 06, 2010 10:22 pm

bmwskead wrote:any idea?
Ups. Sorry for the inconvenience...
I don't know what happened - but I did upload an old working copy. It contains a bug in the assembly part of it. The "Game_Main" parameter #1 is passed in R1 whereas it has to be passed in R0. The correct version is updated in the first post. Sorry again - but it seems you were the first one who tried it in depth. ;)

smartsmurf
Official SamyGO Developer
Posts: 111
Joined: Thu Jun 24, 2010 8:26 am
Location: Frankfurt, Germany

Re: Injecting modules into exeDSP

Post by smartsmurf » Tue Oct 05, 2010 8:57 am

Good point. I also thought about speeding up the search. The main issue is the fact, that all memory reads are done through ptrace commands.

Post Reply

Return to “[B] Brainstorm”

Who is online

Users browsing this forum: No registered users and 1 guest