GhidraJupyter / ghidra-jupyter-kotlin

MIT License
115 stars 10 forks source link

Support Library Descriptor Feature for Easy Access to Extensions/Imports #29

Closed fmagin closed 2 years ago

fmagin commented 2 years ago

This allows adding a file like

{
  "link": "https://github.com/GhidraJupyter/ghidra-jupyter-kotlin",
  "description": "Shortcut to load features in Kotlin Kernel",
  "imports": [
    "GhidraJupyterKotlin.extensions.address.*",
    "GhidraJupyterKotlin.extensions.data.*",
    "GhidraJupyterKotlin.extensions.misc.*"

  ]
}

to $HOME/.jupyter_kotlin/libraries/, e.g. with the name ghidraJupyter.json and then run %use ghidraJupyter in the kernel to automatically import those packages (and thus register the extension functions). This also supports various other features like registering renderers for specific types, running certain code on initial import and more. See https://github.com/Kotlin/kotlin-jupyter/blob/stable-kotlin-2/docs/libraries.md

I still want to test this for a bit before merging, and maybe the hack with the invalid homedir can be removed by then anyway, then this would just require bumping to a new stable release of the kernel.