-
Notifications
You must be signed in to change notification settings - Fork 228
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
feat: converted strings plugin to v1 and integrated strings eval #1323
base: master
Are you sure you want to change the base?
Conversation
jstucke
commented
Jan 10, 2025
•
edited
Loading
edited
- migrates the "printable_strings" plugin to the new base class
- integrates the "string_evaluation" plugin into the "printable_strings" plugin
- uses bootstrap-table to display the new result structure in the template
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1323 +/- ##
==========================================
- Coverage 92.48% 91.81% -0.67%
==========================================
Files 379 374 -5
Lines 24115 20981 -3134
==========================================
- Hits 22302 19264 -3038
+ Misses 1813 1717 -96 ☔ View full report in Codecov by Sentry. |
f7e09d0
to
ef8b2a8
Compare
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.
Overall lgtm (The table is especially nice!). Just a few nits.
DICTIONARY = {'version', 'v.', 'http', 'ftp', 'usage', 'Usage', 'ssh', 'SSH', 'password', 'Version'} | ||
|
||
|
||
def evaluate_string(string: str) -> float: |
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.
nit: What about renaming this to string_relevance
?
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.
string_relevance
is lacking a verb. I renamed it to calculate_relevance_score
Schema=self.Schema, | ||
) | ||
) | ||
) | ||
self.regexes = self._compile_regexes() | ||
|
||
def _compile_regexes(self) -> list[tuple[Pattern[bytes], str]]: | ||
min_length = getattr(config.backend.plugin.get(self.NAME, {}), 'min-length', 8) |
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.
This only works as long as we use AnalysisBasePluginAdapterMixin
.
Instead this should use self.metadata.name
.
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.
Good catch. Totally overlooked that bit
metadata=( | ||
self.MetaData( | ||
name='printable_strings', | ||
description='extracts strings and their offsets from the files consisting of printable characters', |
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.
What do you think?
description='extracts strings and their offsets from the files consisting of printable characters', | |
description='Extracts printable strings from a file and assigns a relevance score based on a predefined ruleset.', |
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.
I think your change better reflects what the plugin does -> changed
""" | ||
evaluate relevance of strings | ||
|
||
Credits: | ||
Original version by Paul Schiffer created during Firmware Bootcamp WT16/17 at University of Bonn | ||
Refactored and improved by Fraunhofer FKIE | ||
""" |
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.
I don't think that doc comment is that useful.
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.
Removed the doc part and added a more informative docstring to the function instead.
a6fcef0
to
8486990
Compare
* migrates the "printable_strings" plugin to the new base class * integrates the "string_evaluation" plugin into the "printable_strings" plugin * uses bootstrap-table to display the new result structure in the template
8486990
to
dc02b8d
Compare