Advertising (This ad goes away for registered users. You can Login or Register)

[Release] Module Analyzer 1.17 w/ source included

Plugins for PSPs running on 6.XX
User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

[Release] Module Analyzer 1.17 w/ source included

Post by Omega2058 » Wed Jun 04, 2014 2:37 am

Originally, this plugin was developed by Felix a while ago. Since I tend to update it and use it frequently , I've decided to just release the thing with new neat features I added. If there are any features that you'd like to see added, please let me know as well. :)

Original Post/Description (With slight changes to keep it relevant):
This program will analyze custom modules (i.e. game modules, homebrew modules,etc...). It will map imported sce functions to their stub addresses, meaning that you know where a function stub is located in memory. This is useful for people who want to call imported sce functions of a game through MIPS ASM code using a cheat device. (If you know the program prxtool, you should have an imagination, what I am talking about.)

Furthermore, this program will show you where module_start, module_stop of a game is located in user memory, thus helping you to start reversing the game.

How to use:

1) Put module_analyzer.prx into your seplugins folder located on the root of your memstick.

2) Add the line "ms0:/seplugins/module_analyzer.prx 1" into the game.txt file in your seplugins folder.

3) Start the PSP Program you want to have analyzed (it can be a game, homebrew,...).

4) Wait until you are in the main menu of that program. (Optionally, you can let the game running, thus the program will collect other modules being loaded during this time. Like network modules, if you start Multiplayer on a game.)

5) Exit the program.

6) Connect your PSP with your PC and go to the folder "Module_Analyzer" (located on the root of your Memstick).

7) You now see a folder called "ProgramXYZ" or "GAME-ID", where GAME-ID is the id of the game you just loaded. Go into that folder and you see at least three files. "modules.txt", "XXX_imports.txt" and "XXX_exports.txt".

About the files:

"modules.txt" contains all the modules which have been loaded during the program boot process. It shows you if a module is a SONY OFW module and or a custom module (i.e. a game module, homebrew module).

If the module is a custom module, you will see information about its .text segment (the segment where the executable code of the program is stored in), its .stub segment (where the imported libraries are), its entry address (where the program execution routine starts) and its global pointer value.

The "%s_imports.txt" file will show you the NIDs of imported sce functions used by the game and the address of their stubs. If you want to call an imported function, like sceKernelExitGame, simply JAL to its stub address. The file also shows you what library imports what NID.

The "%s_exports.txt" file shows you the exported functions/variables of your program. For example, where the function module_start is located, so you can jump into reversing the game directly from the root. It also shows you where the .rodata.sceModuleInfo section is stored in user memory.

The "%s_segments.txt" file shows the mapped .sceStub.text. sections from low-order to high-order in the RAM.

In order to understand, what NID belongs to what sce function you need to check the NIDs in a file called "psplibdoc-xml". Open that file and search for the NID you want to know the function it represents.
Changelog:
1.17
-----------
[-] Seperate thread creation removed since delays are no longer used.
[+] More modules now logged at run-time.

1.16
-----------
[+] Source code cleaned up and revised.
[+] Folder support for Homebrew added. No more storing in "ms0:/Module_Analyzer/ProgramXYZ/" by default.
[~] Game information stored in a new format ("XXXXZZZZZZ" instead of "XXXX-ZZZZZZ", where "X" is considered as a letter and "Z" a number).
[-] Removed Folder deletion method as it was unnecessary.
[-] Removed RAM dump feature as it was unnecessary.

1.15
------------
[+] Holding "R Trigger" during the game/homebrew booting process will also dump the RAM contents as "dump.bin" after module information has been logged in the appropriate folder.

Note: Other chances to dump the memory will be when it's apparent that the menu changes (Another menu loads, scene change, going online). If the process seems iffy let me know and I'll make changes to it accordingly

1.14
-------------
[+] Upon running homebrew, the folder/files containing the previously loaded brew will now be deleted in order to keep things from becoming a mess when attempting to analyze information.

1.13
-------------
[!] Fixed issue where homebrew information was not being saved properly at all.
-The default path for all homebrew is now set to "ms0:/Module_Analyzer/ProgramXYZ/".

1.12
-------------
[+] When playing games while using module_analyzer, the information is now stored at "ms0:/Module_Analyzer/{GameID HERE}/" by default.
[+] Added ability for users to play as many games as they want and the information is now stored in an organized manner. Homebrew is a seperate case.
Homebrew folder support, sup?
Image

Edit: Spelling

Edit 2: Added a zip archive for those who are not able to extract from a 7z archive.

Edit 3: Forgot to remove the .o and .elf files. Thanks for pointing that out Joel.

Edit 4: Removed some unnecessary things.
Advertising
Attachments
Module Analyzer 1.17.zip
(57.16 KiB) Downloaded 138 times
Last edited by Omega2058 on Sat Jul 12, 2014 7:12 am, edited 11 times in total.

User avatar
Joel16
Posts: 912
Joined: Wed Oct 12, 2011 8:47 pm

Re: [Release] Module Analyzer 1.14

Post by Joel16 » Wed Jun 04, 2014 3:42 am

Hi, this is a pretty neat plugin. Would be of great use when it comes to Re-ing am I correct? :)
I would've included this in my blog post if I had waited a little longer.
Advertising
"Forever in darkness, a guardian devil."

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [Release] Module Analyzer 1.14

Post by Omega2058 » Wed Jun 04, 2014 4:01 am

sauske_firekid wrote:Hi, this is a pretty neat plugin. Would be of great use when it comes to Re-ing am I correct? :)
I would've included this in my blog post if I had waited a little longer.
Yes that is correct, this tool is really useful when it comes to reverse engineering. It's fine that you didn't get a chance to do it though :)

User avatar
Joel16
Posts: 912
Joined: Wed Oct 12, 2011 8:47 pm

Re: [Release] Module Analyzer 1.14

Post by Joel16 » Wed Jun 04, 2014 4:07 am

No worries, I'll get wololo to do it for me. Cause I can't edit posts once they're published. This definitely deserves a spot on my post, especially since we barely have anything new for the PSP, and this is of great use.
Nice work you two :)
"Forever in darkness, a guardian devil."

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [Release] Module Analyzer 1.14

Post by Omega2058 » Wed Jun 04, 2014 4:14 am

Understandable then and in that case thanks a bunch mate (:

User avatar
Joel16
Posts: 912
Joined: Wed Oct 12, 2011 8:47 pm

Re: [Release] Module Analyzer 1.14

Post by Joel16 » Wed Jun 04, 2014 4:42 am

No probs, and it's done :) (Number 3)
http://wololo.net/2014/06/02/sony-plays ... velopment/
"Forever in darkness, a guardian devil."

User avatar
MadZiontist
Posts: 553
Joined: Sun Mar 18, 2012 3:14 am
Location: Rap City

Re: [Release] Module Analyzer 1.14

Post by MadZiontist » Wed Jun 04, 2014 11:46 am

I sorta get the gist of what you posted, and I think I get the general concept of this. Either way I can tell it's a great plugin for those who totally understand it, which will hopefully include myself one day. :)
PSP Star Wars 2001 TA-085v1 128GB 6.60 ME-2.3
PSV 1001 3G 64GB 3.18 TN-V10: Talkman Travel: Tokyo & PS Loader: XS Moto
PSTV 64GB 3.20 TN-V10: Patapon

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [Release] Module Analyzer 1.14

Post by Omega2058 » Wed Jun 04, 2014 12:14 pm

MadZiontist wrote:I sorta get the gist of what you posted, and I think I get the general concept of this. Either way I can tell it's a great plugin for those who totally understand it, which will hopefully include myself one day. :)
If you have any questions feel free to ask in any way you please and I'll do my best to help you.

saiyan x
Posts: 79
Joined: Mon Oct 31, 2011 1:17 pm
Contact:

Re: [Release] Module Analyzer 1.14

Post by saiyan x » Wed Jun 04, 2014 2:06 pm

I have a question, does this plugin help to RE and then make mods of homebrews(whose source is not available) or Sony titles?

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [Release] Module Analyzer 1.14

Post by Omega2058 » Wed Jun 04, 2014 2:58 pm

It works both ways, a majority of the time I just use it to create small patches for Official Games that I like to play since I live in the middle of nowhere.

I managed to make the plugin below for Phantasy Star Portable 2 that picks up items and opens doors by walking next to them. Using the analyzer I got the list of imported functions and I just found a reference call to "sceCtrlPeekBufferPositive" and followed it. Then by hooking out of that function, I emulated a button press whenever you got near an item or a door by changing the value of the "buttons" member in the SceCtrlData structure located on stack (In the worst/laziest way possible :lol:). The same can be done for any game.

I wrote the patch itself in ASM, then I found a location in userspace that wasn't used (via a memory editor) and copied it (memcpy). Finally I manually patched a "jr ra" command to jump to my code and execute it immediately afterwards. You can use what I wrote as a template for every game currently available (Although I should've added some checks for the game-id, oops).

Plugin Source: https://github.com/Omega2058/PSP2_PU

For example, lets say you liked playing a certain emulator (It can be any), but you wanted to add functionality and bring up an extra menu when the user exits the program (Say the creator uses an alternative method to exiting). You can run the homebrew with the analyzer running, find the function for exiting the menu and hook into it. This will have the effect of it jumping to your own code.

I couldn't really think of a better example, but I hope that helps you understand it a little better if anything.

Edit: Spelling errors

Post Reply

Return to “Plugins”