-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Add / (search) commands to newshell + rewrite of rz_search #4742
base: dev
Are you sure you want to change the base?
Conversation
RZ_API void rz_search_collection_free(RZ_NULLABLE RzSearchCollection *sc); | ||
RZ_API void rz_search_hit_free(RZ_NULLABLE RzSearchHit *hit); | ||
|
||
RZ_API RZ_OWN RzList /*<RzSearchHit *>*/ *rz_search_run(RZ_NONNULL RzSearchOpt *opt, RZ_NONNULL RzSearchCollection *col, RZ_NONNULL RzIO *io, RZ_NONNULL RzList /*<RzIOMap *>*/ *search_in); |
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.
Maybe changing the search_in
parameter to void *
and infer the type based on some flag in opt
. This way we can use this function later to search other things then IO.
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.
Not so sure about this, but maybe.
2123d77
to
9b1253f
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.
This is great work!
// SPDX-FileCopyrightText: 2008 J. Alex Halderman | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
// Originally from RSAKeyFinder 1.0 (2008-07-18) By Nadia Heninger and J. Alex Halderman |
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.
Same, please convert into \file
{ 0x02, 0x01, 0x00, 0x30 }, | ||
}; | ||
|
||
/*Baby BER parser, just good enough for private keys. |
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.
Since there is comment already for this function , maybe convert to Doxygen?
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 comment is actually wrong. the code is looking for DER encoding, but i will fix this once it will be "ready"
return start + 2 + lensize; | ||
} | ||
|
||
/* Check if `start` points to an ensemble of BER fields |
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.
Same
return true; | ||
} | ||
|
||
// Finds and return index of a private key based on the asn1 bytes |
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.
Same
|
||
#include <rz_search.h> | ||
#include <rz_util.h> | ||
|
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 \file
to note that it searches not only ANSI/ASCII but also Unicode and some other encodings
9b1253f
to
03c4c7b
Compare
Your checklist for this pull request
Detailed description
This is a complete rewrite of the legacy code which is too complicated to import into new-shell.
The goal is to refactor
rz_search
and implement the search command properly using pre-existing code like search of strings via rz_utils and more.closes #1909