-
Notifications
You must be signed in to change notification settings - Fork 448
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
Adding cli functionality to check strings in an adhoc manner #52
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,29 @@ def secret_generator(self, string): # pragma: no cover | |
""" | ||
pass | ||
|
||
def adhoc_scan(self, string): | ||
"""To support faster discovery, we want the ability to conveniently | ||
check what different plugins say regarding a single line/secret. This | ||
supports that. | ||
This is very similar to self.analyze_string, but allows the flexibility | ||
for subclasses to add any other notable info (rather than just a | ||
PotentialSecret type). e.g. HighEntropyStrings adds their Shannon | ||
entropy in which they made their decision. | ||
:type string: str | ||
:param string: the string to analyze | ||
:rtype: str | ||
:returns: descriptive string that fits the format | ||
<classname>: <returned-value> | ||
""" | ||
# TODO: Handle multiple secrets on single line. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit in general: Maybe github issue instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (To bring attention of short-comings to reviewers, I normally call it out in github PR comment.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
results = self.analyze_string(string, 0, 'does_not_matter') | ||
if not results: | ||
return 'False' | ||
else: | ||
return 'True' | ||
|
||
@property | ||
def __dict__(self): | ||
return { | ||
|
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.
Super nit: it's not a line if it is a
bool
, maybeelse:
?