[Tutorial-EN] PRXtool

Acabo de crear este tutorial (link original) y lo he hecho directamente en inglés.
Sinceramente, considero que si se sabe programar, el inglés es casi como una segunda lengua, de ahi que no lo traduzca, ya que esta aplicación se usa, básicamente, para desarrollar, para hacer ingeniería inversa, y para poco más (quizá una serie de temas en concreto, pero no vienen a cuento)
De esta manera, está orientado tan sólo a desarrolladores o gente experimentada en ASM o ingeniería inversa, ya que es su uso principal. De cualquier manera, si alguien tiene una duda concreta, que me lo haga saber mediante una contestación en este hilo o un MP. Espero que os sea de utilidad.
Okay, i’m making this tutorial just to make the people know how to use PRXtool, a *very* useful development tool in what psp scene is about, and that works and uses a bunch of different options that i think that probably just a 5-10% know how to use and what does it does.

PRXtool was created from TyRaNiD (ps2dev forums, v1.0 was released at November, 2006)



Ok, first of all, we’ve to download prxtool.
svn co svn://svn.ps2dev.org/psp/trunk/prxtool
then, we’ve to compile it.
[i]cd prxtool[/i] [i]
./bootstrap[/i] [i]
./configure[/i] [i]
make[/i] [i]
make install[/i]
Or just download a precompiled win32 version here. (But dunno if it’s the latest version, it’s easier and better to download latest from ps2dev svn and compile it)

Also, you’d probably need cygwin1.dll to execute it, that you can find on your cygwin installation folder.



Then, having it compiled, we go to a cmd session to the prxtool folder,
[i]…[/i]
[i]cd prxtool[/i]
and now, let’s see what we can do with it.

Imagen

PRXtool options:

Basic Structure:
prxtool [options] [file]
(Having of course the file (prx, whatever) we want to study on the same dir)


--output [file] {or} -o file

-> Basic output system. If we want to have a file called “output.test”, we will have to put as an option, “–output output.test” or “-o output.test”. This option may get overrided by other options of output linking, as we will see in a few.

-> For example, “prxtool -o impose.txt impose.prx”

-> If no file is selected, or no “-o” option is written, it will use stdout (it will print it on the cmd session)


--idcout {or} -c

-> IDC (IDA PRO) file output, used as default output. (C dissassembling like) This is interesting when using IDA PRO as a dissassembler, and using this file gets things easier :)

-> For example, “prxtool -c -o impose.idc impose.prx”

-> Anyways, “-c” option can be omitted as it’s used by default output (this means that it will be used as an idc output always till we say it to use another output) when using “-o” option.


--mapout {or} -a

-> MAP file output. (.word, .byte, .map, …) With nids distinction. Example of the output:
00007968:
.word export_2_sceImpose_driver_C7E36CC7 ; NID c7e36cc7

-> For example, “prxtool -a -o impose.map impose.prx”


--xmlout {or} -x

-> XML file output, showing names, flags, nids, function names, and prxfile. Example of the output:
sceSysEventForKernel
0×00010011


0xCD9E4BB5
sceSysEventForKernel_CD9E4BB5


-> Example: “prxtool -x -o impose.xml impose.prx”


--elfout {or} -e

-> ELF output from an PRX file. (ELF heading file, interesting for that special use, will put more info @ elf’s in the future)

-> Example: “prxtool -e -o impose.elf impose.prx”


--debug {or} -o

-> Debug mode. Prints on screen each realocations, offsets, etc

-> Example: “prxtool -d [other_options] -o impose.xxx impose.prx”


--serial [ixrsl] {or} -s

-> Serial-printing mode. Prints on screen or in an output file (whatever output you choose) the elements you want.

-> “i” for imports, “e” for exports, “r” for relocs, “s” for sections, “l” for syslibexp (moduleinfo)

-> Example: “prxtool -s [ixrsl] -o impose.out impose.prx”


--xmlfile [file.xml] {or} -n

-> XML file adding mode, containing the NID tables, as for example the XML file we created using the –xmlout option.

-> Example: “prxtool -n nid_table.xml -o impose.idc impose.prx”, or with whatever other option (knowing that adding the xml file to the analysis, it will rename the nids on the final output, so it’s interesting to make a .xml file for our use and edit it adding the known nids so when studying the output on IDA or wherever, it’s more clear)


--xmldis {or} -g

-> XML disassembly output mode. Enables the disassembling function of an xml file when sorting the output file (whatever we use)

-> Example: “prxtool -n nid_table.xml -g -o impose.idc impose.prx”


--xmldb [title] {or} -w


-> XML database. Outputs the file as an XML database (ASM disassembly way) with a title (elf heading), but we can skip the title if wanted.

-> Example: “prxtool -w -o impose.asm impose.prx”


--stubs [file.xml] {or} -t


-> XML stub mode. Creates stub files (.S) for the XML file selected for each function or prxname.

-> Example: “prxtool -t nid_table.xml”


--prxstubs {or} -u

-> PRX stub mode. Creates stub files (.S) for the PRX file selected for each function or prxname (exports)

-> Example: “prxtool -u impose.prx”


--newstubs {or} -k

-> New SDK style stubs mode. Makes from a prx file an output (whatever option) with new style from SDK.

-> Example: “prxtool -k -o impose.out impose.prx”


--depends {or} -q

-> PRX dependencies. Prints on screen the PRX dependencies from an PRX selected, and with an XML also selected.

-> Example: “prxtool -n nid_table.xml -q impose.prx”


--modinfo {or} -m

-> ModInfo mode. Prints on screen module/library info to the screen. (import number, name, functions, variables, and flag)

-> Example: “prxtool -m impose.prx”


--impexp {or} -f


-> ImpExp mode. Prints on screen imports & exports of the prx. (also with functions)

-> Example: “prxtool -f impose.prx” (if added an nid table xml, it will print the functions on the xml that are also on the exports/imports of the prx )


--disasm {or} -w

-> Disasm mode. Disasm the executable sections of the file (prx) into an ASM output, similar as we saw on the -a option.

-> Example: “prxtool -w -o impose.dis impose.prx”

--dispots [opts] {or} -i

-> To use with -w option, makes us able to choose fromdifferent options of the disassembler:

-> “x” for hexadecimal way, “xd” for signed hexadecimal, “r” for rN format instead of mnemonics, “s” to print PC as symbol, “m” to diable macro instructions, “w” to indicate opcodes and etc after the disasm.

-> Example: “prxtool -w -i xdrw -o impose.out impose.prx”

--binary {or} -b

-> To use with -w option, makes the disassembler think the file as an binary file (with strings and so)

-> Example: “prxtool -w -b -i xdrw -o impose.out impose.prx”

--database [offset] {or} -l

-> To use with -w option, you specify the offset of the data section.

-> Example: “prxtool -w -l [offset] -i xdrw -o impose.out impose.prx”


--reloc [addr] {or} -r

-> Realocates the prx to a different address.

-> Example: “prxtool -r [address_XxXX] -o impose.out impose.prx”


--symbols {or} -y

-> Outputs a symbol file based on input.

-> Example: “prxtool -y file.syb”


--funcs [file] {or} -z

-> To use alone(?) or with -w option, specify a functions file (xml, prx, whatever) for disassembly. Not too interesting though, will look for it in the future to know what is it about.


--alias {or} -A

-> Prints the functions aliases when using -f option.

-> Example: “prxtool -f -A -o impose.out impose.prx”



Ok, this is all of it. Of couse, you can combine them into new stuff, but i will talk about that in other day. Feel free to experiment it by yourself!

Lo dicho.. cualquier duda, avisad. Pero no, no lo voy a traducir.
--Alek
pero como puedes ser asiii!! que crackk!!
Otra pagina mas para la biblia de la PSP, buen currazo alek, como siempre mis 5 estrellas pa ti makina siyu [oki]

La clave del saber es compartir el conocimiento.. (gracias por la clase y el tiempo alek ;-) )

Salu2
[flipa] pedazo currá, cuando tenga un poquito de tiempo le pegaré un vistazo [sonrisa]

Muchas gracias por el aporte ;)
He probado con varios prx, y con unos funciona y con otros no.

En particular, hay algunos prx que sale:

Loading SCAN.PRX
Error: Magic value incorrect (not an ELF?)
Error: Couldn't load prx file structures

Mirando con el editor exadecimal no empieza el fichero como los que si rulan:

Un ejemplo que rula empieza por:

7F 45 4C 46 .ELF

Un ejemplo que no funciona empieza por:

7E 53 43 40 .SCE

¿qué es lo que esta pasando?
cjsosa escribió:Un ejemplo que no funciona empieza por:

7E 53 43 40 .SCE

¿qué es lo que esta pasando?
Que esos no están desencriptados. (Boton [] del psardumper...)
Muy bueno!
Que pena que mi ingles no es muy bueno xD

5, 5, 5, 5, 5, 5 !

Gracias tio [beer]
La funcion de esto apra que es? Para conseguir el scr de un prx o algo asi?
Alguien me lo podria explicar?
rubensvaldemo escribió:La funcion de esto apra que es? Para conseguir el scr de un prx o algo asi?
Alguien me lo podria explicar?

Obtienes un código en código asm mips ya listo para empezar a reversar el prx.
Si sabes hacerlo puedes sacar el código de todo lo que quieras, de las apps, customs firmwares, etc...
becus25 escribió:Obtienes un código en código asm mips ya listo para empezar a reversar el prx.
Si sabes hacerlo puedes sacar el código de todo lo que quieras, de las apps, customs firmwares, etc...


Interesante... Pero no, no tengo ni puting idea de hacer esto...
Ya me gustaria
Muy bueno Alek, como siempre ;)

Saludos!
11 respuestas