dod-cyber-crime-center / pyhidra

Pyhidra is a Python library that provides direct access to the Ghidra API within a native CPython interpreter using jpype.
Other
184 stars 16 forks source link

SymbolsServerService Feature #26

Closed clearbluejar closed 1 year ago

clearbluejar commented 1 year ago

Hello, on a side project of mine I am leveraging pyhidra to build a command line decompiler.

One of the features I needed was for the symbol server to be configured to auto download symbols.

https://github.com/clearbluejar/ghidrecomp/blob/main/ghidrecomp/utility.py#L65

Is this outside the scope of pyhidra? Or would context like open_program benefit from an option symbol server config?

The options that seem natural for symbols are these: https://github.com/clearbluejar/ghidrecomp/blob/main/ghidrecomp/utility.py#L25-L28

  1. Auto download from symbol servers
  2. set specific file
  3. None
dc3-tsd commented 1 year ago

This looks like something that would be out of scope. Pyhidra's job is to simply provide access to native Python 3 in Ghidra.

However, you might be able add this functionality in your own library by registering one of pyhidra's entry_point hooks.

pyhidra.setup allows you to perform setup tasks such as installing your own plugins (ghidra not started yet) and pyhidra.pre_launch is called after Ghidra has setup it’s classpath but Ghidra has not yet been started. All of the Ghidra classes should be accessible but certain features are not usable until it has fully launched.

If you think we need another entry point for a different stage of the launch please let us know.

For example, we use these entry points to compile and install the rugosa ghidra plugin, which gets defined during setup

clearbluejar commented 1 year ago

This makes sense. I've yet to venture into the plugin development, but it looks like it might be next. Looks like both pyhidra and rugosa provide some good examples repositories. The python/java plugin that self compiles and installs itself is very meta. Nice work. Thanks.