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

Feature request #19

Open
sebdraven opened this issue Mar 22, 2021 · 2 comments
Open

Feature request #19

sebdraven opened this issue Mar 22, 2021 · 2 comments

Comments

@sebdraven
Copy link

Hi,

a nice feature it's colorize the code reused in the listing of ghidra, it's very usefull to see quickly the function to analyze.

@utkonos
Copy link
Contributor

utkonos commented May 3, 2022

I'm giving this feature a go, but I am not a java programmer. I think I understand the basic components that are needed, but I am having a problem with syntax. This change belongs in the XMLParser.java script. This is where the code needs to be changed:

case "code_reuse":
row.setCodeReuse(data.toString());

Here is where I am:

case "code_reuse":
    String codeReuseString = data.toString();
    String substring = "malicious";
    if (codeReuseString.toLowerCase().contains(substring)) {

    }
    row.setCodeReuse(codeReuseString);

Where I am stuck is instantiating the ColorAndStyle container properly. The documentation for that class is here:

https://ghidra.re/ghidra_docs/api/ghidra/app/util/ColorAndStyle.html

The color object I think should be used for malicious is ghidra.util.WebColors.RED. The documentation for that class is here:

https://ghidra.re/ghidra_docs/api/ghidra/util/WebColors.html

Once the class is instantiated properly, I think the form that should be used will be the following or something like this:

codeReuseString = ColorAndStyle.toHtml(codeReuseString)

If anyone out there has a suggestion for how to get this over the finish line, please post something here.

@utkonos
Copy link
Contributor

utkonos commented May 3, 2022

I have started a branch in my dev fork for this feature:

https://github.com/utkonos/analyze-community-ghidra-plugin/tree/code_reuse_colors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants