{"id":19000484,"url":"https://github.com/allsafecybersecurity/ghidra-jython-kernel","last_synced_at":"2025-04-22T17:06:27.555Z","repository":{"id":42071896,"uuid":"230583517","full_name":"AllsafeCyberSecurity/ghidra-jython-kernel","owner":"AllsafeCyberSecurity","description":"Jupyter Kernel for Ghidra's Jython","archived":false,"fork":false,"pushed_at":"2022-04-13T22:58:08.000Z","size":290,"stargazers_count":29,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-17T07:17:33.840Z","etag":null,"topics":["ghidra","ghidra-scripts","jupyter","jupyter-notebook","jython","reverse-engineering"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AllsafeCyberSecurity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-28T08:46:20.000Z","updated_at":"2025-02-24T14:26:23.000Z","dependencies_parsed_at":"2022-08-12T04:01:23.532Z","dependency_job_id":null,"html_url":"https://github.com/AllsafeCyberSecurity/ghidra-jython-kernel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllsafeCyberSecurity%2Fghidra-jython-kernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllsafeCyberSecurity%2Fghidra-jython-kernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllsafeCyberSecurity%2Fghidra-jython-kernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllsafeCyberSecurity%2Fghidra-jython-kernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AllsafeCyberSecurity","download_url":"https://codeload.github.com/AllsafeCyberSecurity/ghidra-jython-kernel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250285676,"owners_count":21405297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ghidra","ghidra-scripts","jupyter","jupyter-notebook","jython","reverse-engineering"],"created_at":"2024-11-08T18:07:27.315Z","updated_at":"2025-04-22T17:06:27.511Z","avatar_url":"https://github.com/AllsafeCyberSecurity.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/AllsafeCyberSecurity/ghidra-jython-kernel/workflows/ghidra-jython-kernel%20test/badge.svg)](https://github.com/AllsafeCyberSecurity/ghidra-jython-kernel/actions)\n\n# Ghidra Jython Kernel\n\nJupyter kernel for Ghidra's Jython.\n\n\u003cimg src=\"doc/jupyter_example.png\" width=70%\u003e\n\n## Install\n```bash\n$ pip install ghidra-jython-kernel\n\n# make sure GHIDRA_INSTALL_DIR is defined\n# don't forget to add this line in your shell config (i.e. bashrc, zshrc)\n$ export GHIDRA_INSTALL_DIR=/path/to/your/ghidra_installation_folder\n```\n\n## Usage\n\nRun your Jupyter(`jupyter notebook`), and select `GhidraJython` named kernel.\n\n\nNote that, unlike GhidraPython plugin's interpreter, in the context the current running Jython interpreter, you have to import program by yourself. This means, pre-initialized variables in GhidraScript, like `currentProgram` or `state`, aren't available unless you import manually. You can import programs as following.\n\n```python\nfrom ghidra.app.util.importer import MessageLog, AutoImporter\nfrom ghidra.program.flatapi import FlatProgramAPI\nfrom ghidra.util.task import TaskMonitor\nfrom ghidra.util import Msg\nfrom java.io import File\nfrom java.util.function import Consumer\n\nclass Cons(Consumer):\n    def __init__(self, fn):\n        self.accept = fn\n\ndef import_program(filepath, enable_analysis=True):\n    program = AutoImporter.importByUsingBestGuess(\n        File(filepath),\n        None,\n        Cons(lambda x: Msg.error(None, err)), \n        MessageLog(),\n        TaskMonitor.DUMMY\n    )\n    \n    flatapi = FlatProgramAPI(program)\n    \n    if enable_analysis:\n        flatapi.start()\n        flatapi.analyze(flatapi.currentProgram)\n        \n    return flatapi\n\nghidra_app = import_program('/path/to/your/program')\n\n# now you can access to `currentProgram`\nghidra_app.currentProgram\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallsafecybersecurity%2Fghidra-jython-kernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallsafecybersecurity%2Fghidra-jython-kernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallsafecybersecurity%2Fghidra-jython-kernel/lists"}