Conversation
Signed-off-by: kunalsz <kunalavengers@gmail.com>
Summary of ChangesHello @kunalsz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the feature extraction capabilities by introducing a new heuristic to identify and quantify the complexity of functions using Cyclomatic Complexity. This addition provides a standardized metric for function complexity, which can be leveraged for more nuanced code analysis and detection tasks. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new heuristic for identifying complex functions based on their cyclomatic complexity, which is a valuable addition. The implementation is sound, but I've identified a couple of areas for improvement. There's a bug in the new ComplexFunctions feature class where it's not initialized correctly, which would affect logging and string representation. Additionally, the error handling in the complexity calculation function could be improved by logging exceptions instead of silently ignoring them. My review includes specific suggestions to address these points.
mr-tz
left a comment
There was a problem hiding this comment.
Thanks a few first comments below
Signed-off-by: kunalsz <kunalavengers@gmail.com>
|
Can you gather some stats on the runtime of this calculation? Do you think it would help to identify many new functions vs. the existing heuristics considering it's potential slow down of the overall program runtime? |
|
@mr-tz Can you recommend some complex binaries against which I can test these heuristics and get a good comparison? |
|
You can initially try with some of the go/rust samples in https://github.com/mandiant/flare-floss-testfiles/tree/master/language or check out mimikatz or kernel32 or others in https://github.com/mandiant/capa-testfiles |
|
@mr-tz I ran floss with and without this new heuristic on Without
|
|
Also FLOSS’s heuristics are not “find obfuscation.” They are “find likely string-decoding routines" , in the /mrphrazer/obfuscation_detection repo it is written that for "string decryption routines" these techniques are used :
Out of which most are already implemented |
|
Yes, good points so maybe we table this idea and document what we learned in the issue. |
|
@mr-tz Are there any additional string deobfuscation routines or heuristics you’ve considered that aren’t yet implemented in FLOSS? I’d be happy to work on implementing them |
|
immediately to mind come only the ones listed in the code comments: # extract_function_order, # TODO decoding functions are often one of the first in a program
# extract_num_api_calls, # TODO decoding functions don't normally contain many (API) calls |


Added complex functions heuristic from mrphrazer/obfuscation_detection
Complex Function Heuristic
The code uses this formula for Cyclomatic Complexity
M = E - N + 2P. WhereFixes #696