ircmaxell/php-object-symbolresolver

question

SxtBox opened this issue · 5 comments

Hello
is there any way to do function extractor from .so modules like <?php function name ?>

What do you mean? Extract the executable code? the source code? just the function name?

What do you mean? Extract the executable code? the source code? just the function name?

for example to show source code as in phpoto

Screenshot 22_02_2022 (15-46-16)

sj-i commented

That's the demo code in this repository.

The return value of $parser->parse($file) is an instance of ObjectFile. It has the information of the parsed object file.
The return value of ObjectFile::getAllSymbols() is an array of strings, which contains the name of each symbol in the object file.

ELF files may have symbol information other than functions. For now, the library does not distinguish each symbol as a function or not.

If you need to get only function information and want to use this library, you need to modify this library.
If you need to get information other than the function name or what is in the properties of the Symbol class, you also need to modify this.
If you need to recover the original source code from an ELF file, it is not possible with this library. It is probably not possible with other libraries either. If you really need something close, you may want to look for a tool called a reverse compiler or decompiler.
If you just want to get information from ELF files and have no reason to use PHP for it, you can use tools like readelf or objdump instead of this library.

That's the demo code in this repository.

The return value of $parser->parse($file) is an instance of ObjectFile. It has the information of the parsed object file. The return value of ObjectFile::getAllSymbols() is an array of strings, which contains the name of each symbol in the object file.

ELF files may have symbol information other than functions. For now, the library does not distinguish each symbol as a function or not.

If you need to get only function information and want to use this library, you need to modify this library. If you need to get information other than the function name or what is in the properties of the Symbol class, you also need to modify this. If you need to recover the original source code from an ELF file, it is not possible with this library. It is probably not possible with other libraries either. If you really need something close, you may want to look for a tool called a reverse compiler or decompiler. If you just want to get information from ELF files and have no reason to use PHP for it, you can use tools like readelf or objdump instead of this library.

if you mail me@ircmaxell.com is active please check it.

Closing this as there doesn't seem to be an issue identified. (If there is one identified we can re-open)