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

Binary File Decompiler To CPG #4804

Open
hac425xxx opened this issue Jul 27, 2024 · 2 comments
Open

Binary File Decompiler To CPG #4804

hac425xxx opened this issue Jul 27, 2024 · 2 comments

Comments

@hac425xxx
Copy link

currently joern support ghidra2cpg, with use ghidra to load binary to cpg.

but it seems only use the assembly instruction, why not use the decompiler infomation?

  Call(
    argumentIndex = -1,
    argumentName = None,
    code = "SUB RSP,0x30",
    columnNumber = None,
    dispatchType = "STATIC_DISPATCH",
    dynamicTypeHintFullName = IndexedSeq(),
    lineNumber = Some(value = 1053724),
    methodFullName = "<operator>.subtraction",
    name = "<operator>.subtraction",
    order = 0,
    possibleTypes = IndexedSeq(),
    signature = "",
    typeFullName = "<empty>"
  ),
  Call(
    argumentIndex = -1,
    argumentName = None,
    code = "MOV dword ptr [RBP + -0x14],EDI",
    columnNumber = None,
    dispatchType = "STATIC_DISPATCH",
    dynamicTypeHintFullName = IndexedSeq(),
    lineNumber = Some(value = 1053728),
    methodFullName = "<operator>.assignment",
    name = "<operator>.assignment",
    order = 0,
    possibleTypes = IndexedSeq(),
    signature = "",
    typeFullName = "<empty>"
  ),

@itsacoderepo
Copy link
Contributor

Hello hac425xx,

This approach is intentional because some people read assembly, searching for patterns and other specific details. While this may not be your use case, it's perfectly fine :)

However, you can use decompiled code as input for c2cpg; there's no reason it shouldn't work, aside from potential bugs or missing information.

@hac425xxx
Copy link
Author

hac425xxx commented Jul 27, 2024

Thank you very much, I understand what you mean, if use the decompiled output c file as the input of c2cpg, there may be many errors.

My idea is to build CPG directly using the decompiler's AST, so the result should be more accurate

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