Is it possible and how to use the script to get the content of another project?
I want to do some code comparison, so I don't know whether I can use API in one project to open and get the content of another project at the same time, such as function.
No, you can't reach across projects. Can you just use one project with multiple programs in it?
If you are looking for something to do from you GUI, maybe you are looking for the following.
In the Project Window, you can have one active project with one program or more programs in it, and then choose Project->View Project... to have another project with corresponding programs that you want to compare in it.
Then in the Code Browser, you can choose the Diff tool (Tools->Program Differences...) (or use the Diff tool icon) and in the Current Projects pull-down, select this second project that you had earlier selected to view in the Project Manager, and then choose the program that you want to compare from the selected project with the current program you have open in the Code Browser.
Search the help for more clues as to how to do this.
No, you can't reach across projects. Can you just use one project with multiple programs in it?
Ok, I don't think that's possible either. I'm using a diaphora/bindiff approach, where I scan the first program, then serialize what I need, then deserialize the first program in the second program, and then compare.
I can put multiple programs in a project, but does that mean I can get content across programs? Are there any examples or materials to refer to? Thank you!
If you are looking for something to do from you GUI, maybe you are looking for the following.
In the Project Window, you can have one active project with one program or more programs in it, and then choose
Project->View Project...to have another project with corresponding programs that you want to compare in it.Then in the Code Browser, you can choose the Diff tool (
Tools->Program Differences...) (or use the Diff tool icon) and in theCurrent Projectspull-down, select this second project that you had earlier selected to view in the Project Manager, and then choose the program that you want to compare from the selected project with the current program you have open in the Code Browser.Search the help for more clues as to how to do this.
Thank you, I know how the GUI works, but here I want to try to implement it with scripts only.
Take a look at the code starting here:
https://github.com/NationalSecurityAgency/ghidra/blob/3c4c734132202f95fe2e928da50f1ebc662b1fbd/Ghidra/Features/FileFormats/ghidra_scripts/UpgradeDexToGhidra71Script.java#L55-L57
It shows how to go back to the project manager and walk through the folders/files to access other programs in the project.
Take a look at the code starting here:
https://github.com/NationalSecurityAgency/ghidra/blob/3c4c734132202f95fe2e928da50f1ebc662b1fbd/Ghidra/Features/FileFormats/ghidra_scripts/UpgradeDexToGhidra71Script.java#L55-L57It shows how to go back to the project manager and walk through the folders/files to access other programs in the project.
Cool, we have tested it according to your method, which is very great, thank you very much!
Most helpful comment
Take a look at the code starting here:
https://github.com/NationalSecurityAgency/ghidra/blob/3c4c734132202f95fe2e928da50f1ebc662b1fbd/Ghidra/Features/FileFormats/ghidra_scripts/UpgradeDexToGhidra71Script.java#L55-L57
It shows how to go back to the project manager and walk through the folders/files to access other programs in the project.