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
176 stars 15 forks source link

Troubleshooting: Github runner failing to find PyhidraInterpreterConnection #31

Closed clearbluejar closed 8 months ago

clearbluejar commented 11 months ago

When either starting pyhidra or running python -m pyhidra.install_plugins I receive the following error in the context of a github runner:

warning: [options] system modules path not set in conjunction with -source 11
/__w/repo/repo/.env/lib/python3.11/site-packages/pyhidra/java/plugin/PyhidraPlugin.java:37: warning: [removal] ProgramPlugin(PluginTool,boolean,boolean,boolean) in ProgramPlugin has been deprecated and marked for removal
        super(tool, true, true, true);
        ^
2 warnings
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/__w/repo/repo/.env/lib/python3.11/site-packages/pyhidra/install_plugins.py", line 9, in <module>
    pyhidra.HeadlessPyhidraLauncher().start()
  File "/__w/repo/repo/.env/lib/python3.11/site-packages/pyhidra/launcher.py", line 246, in start
    from pyhidra.java.plugin.plugin import PyPhidraPlugin
  File "/__w/repo/repo/.env/lib/python3.11/site-packages/pyhidra/java/plugin/plugin.py", line 168, in <module>
    @JImplements("dc3.pyhidra.plugin.interpreter.PyhidraInterpreterConnection")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/__w/repo/repo/.env/lib/python3.11/site-packages/jpype/_jproxy.py", line 142, in JProxyCreator
    return _createJProxy(cls, *interfaces, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/__w/repo/repo/.env/lib/python3.11/site-packages/jpype/_jproxy.py", line 86, in _createJProxy
    actualIntf = _prepareInterfaces(cls, intf)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/__w/repo/repo/.env/lib/python3.11/site-packages/jpype/_jproxy.py", line 51, in _prepareInterfaces
    actualIntf = _convertInterfaces(intf)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/__w/repo/repo/.env/lib/python3.11/site-packages/jpype/_jproxy.py", line 162, in _convertInterfaces
    actualIntf.add(_jpype.JClass(item))
                   ^^^^^^^^^^^^^^^^^^^
  File "/__w/repo/repo/.env/lib/python3.11/site-packages/jpype/_jclass.py", line 99, in __new__
    return _jpype._getClass(jc)
           ^^^^^^^^^^^^^^^^^^^^
TypeError: Class dc3.pyhidra.plugin.interpreter.PyhidraInterpreterConnection is not found

This happens in the following workflow running: https://github.com/clearbluejar/ghidriff/blob/285c2ea1f8f81ef9776aa6fa2611fd035eb7d635/.github/workflows/pytest-docker.yml#L45

This is likely not an issue with pyhidra, but an hints as to how I can debug this or why this issue might occur would be great.

clearbluejar commented 8 months ago

Was this fixed in the latest release?

image

https://github.com/dod-cyber-crime-center/pyhidra/releases/tag/1.0.0. Was it an issue with the java compiler specified? 11 vs 17?

dc3-tsd commented 8 months ago

The specified Java version when compiling the plugin is not related. Pyhidra is now getting the plugin path directly from Ghidra and this TypeError is now impossible. We haven't tested been able to test this issue on our side, but could you please let us know if it or any other issues are still present?

clearbluejar commented 8 months ago

I can confirm I no longer see this issue in my workflow. Thanks again. I will close the issue.