-
Notifications
You must be signed in to change notification settings - Fork 494
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
tighten rule pre-selection #2080
base: feat/1755
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased)
section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed
@property | ||
def file_rules(self): | ||
return self.rules_by_scope[Scope.FILE] | ||
|
||
@property | ||
def process_rules(self): | ||
return self.rules_by_scope[Scope.PROCESS] | ||
|
||
@property | ||
def thread_rules(self): | ||
return self.rules_by_scope[Scope.THREAD] | ||
|
||
@property | ||
def call_rules(self): | ||
return self.rules_by_scope[Scope.CALL] | ||
|
||
@property | ||
def function_rules(self): | ||
return self.rules_by_scope[Scope.FUNCTION] | ||
|
||
@property | ||
def basic_block_rules(self): | ||
return self.rules_by_scope[Scope.BASIC_BLOCK] | ||
|
||
@property | ||
def instruction_rules(self): | ||
return self.rules_by_scope[Scope.INSTRUCTION] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for backwards compatibility. during a major version, we can probably remove these with preference to rules_by_scope
.
Opened the PR here so the code is no longer sitting on my laptop and at risk of getting lost due to hardware failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work, we should do extensive tests comparing the results before and after to ensure everything works as expected. the speedup looks promising!
I plan to run this implementation side by side with the |
CHANGELOG updated or no update needed, thanks! 😄
…to perf-rule-pre-selection
…to perf-rule-pre-selection
closes #2074
ref #2063, particularly "tighten rule pre-selection" and "lots of time spent in instancecheck"
Stacked on #1950, so I've marked this as a PR onto that branch so the diff is sensible. I think we can probably rebase onto master, though, if necessary.
This PR implements the "tighten rule pre-selection" algorithm described here: #2063 (comment) . In summary:
This seems to work pretty well. Total evaluations when running against mimikatz drop from 19M to 815K (wow!) and capa seems to match around 3x more functions per second (wow wow). I did not expect such a good result - in fact, although the capa matches seem the be the same, I still wonder if something is broken 🤔. More tests needed.
TODO: