Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghidra: update capa_explorer.py to enable users to select if comments and bookmarks are added #1977

Open
mike-hunhoff opened this issue Feb 7, 2024 · 10 comments
Assignees
Labels
enhancement New feature or request ghidra Related to Ghidra integration good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mike-hunhoff
Copy link
Collaborator

capa_explorer.py adds comments and bookmarks when executed. We should enable users to choose which of these options, if any, they want to use when the script is executed. capa_ghidra.py can be referenced for understanding how the Ghidra API can be used to solicit input from users. Ghidra's askChoices API is the likely choice.

@mike-hunhoff mike-hunhoff added enhancement New feature or request good first issue Good for newcomers ghidra Related to Ghidra integration labels Feb 7, 2024
@mike-hunhoff mike-hunhoff changed the title update capa_explorer.py to enable users to select if comments and bookmarks are added ghidra: update capa_explorer.py to enable users to select if comments and bookmarks are added Feb 7, 2024
@mike-hunhoff mike-hunhoff added the help wanted Extra attention is needed label Feb 7, 2024
@danieldsouza13
Copy link

Hi I'd like to work on this as a first time contributor, can you please assign it to me?

@mike-hunhoff
Copy link
Collaborator Author

Done, thank you @danieldsouza13 ! Let us know if you have any questions.

@Atlas-64
Copy link
Contributor

Atlas-64 commented Mar 2, 2024

hi is this issue still open to contribute to @mike-hunhoff

@mike-hunhoff
Copy link
Collaborator Author

Thanks for reaching out @Atlas-64 . This issue has already been assigned to someone else. @danieldsouza13 are you still working on this? If so, please provide a status update. If not, I’ll unassign it from you for someone else to grab. Thank you!

@Atlas-64
Copy link
Contributor

Atlas-64 commented Mar 4, 2024

oh okay then @mike-hunhoff i guess I can work on it on the side , and discussing my proposed solution here wouldn't hurt right , haha

@mike-hunhoff
Copy link
Collaborator Author

Removing @danieldsouza13 due to inactivity. @Atlas-64 I've assigned this issue to you. Please ask any questions here otherwise I'll keep an eye out for your PR.

@Atlas-64
Copy link
Contributor

Atlas-64 commented Mar 7, 2024

sorry for the delay , I finally got the time to go through the code right now so basically on going through capa_ghidra.py, where it uses askChoices to get the capa output verbosity. We can just have a similar statement in capa_explorer.py which takes the user input through the pop-up and then just have an if-else statement within main to call the bookmark and comment causing functions. lemme know if I have any fallacy in my logic :) . @mike-hunhoff

@Atlas-64
Copy link
Contributor

Atlas-64 commented Mar 10, 2024

I also had a question about what set_plate_commen() and set_pre_comment() exactly do within capa_explorer.py
@mike-hunhoff

@mike-hunhoff
Copy link
Collaborator Author

sorry for the delay , I finally got the time to go through the code right now so basically on going through capa_ghidra.py, where it uses askChoices to get the capa output verbosity. We can just have a similar statement in capa_explorer.py which takes the user input through the pop-up and then just have an if-else statement within main to call the bookmark and comment causing functions. lemme know if I have any fallacy in my logic :) . @mike-hunhoff

This sounds like a good place to start. Open a PR when you're ready and we'll be happy to take a look at and comment further on your code.

@mike-hunhoff
Copy link
Collaborator Author

I also had a question about what set_plate_commen() and set_pre_comment() exactly do within capa_explorer.py @mike-hunhoff

These helper functions set ghidra.program.model.listing.CodeUnit.PLATE_COMMENT and ghidra.program.model.listing.CodeUnit.PRE_COMMENT comments using Ghidra's flat program APIs setPlateComment and setPreComment , respectfully. Generally, in the capa + Ghidra code the comment # type: ignore [name-defined] # noqa: F821 at the end of a line identifies use of Ghidra's flat program APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ghidra Related to Ghidra integration good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants