capa
capa copied to clipboard
ghidra: update capa_explorer.py to enable users to select if comments and bookmarks are added
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.
Hi I'd like to work on this as a first time contributor, can you please assign it to me?
Done, thank you @danieldsouza13 ! Let us know if you have any questions.
hi is this issue still open to contribute to @mike-hunhoff
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!
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
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.
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
I also had a question about what set_plate_commen() and set_pre_comment() exactly do within capa_explorer.py @mike-hunhoff
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.
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.