-
Notifications
You must be signed in to change notification settings - Fork 656
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
Support enumerating binary suffixs for an extension #485
Support enumerating binary suffixs for an extension #485
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.
Overall this looks very good but I did have some concerns r.e regex used here, a potential nil case that could be avoided, and some function naming concerns. Should all be pretty easy fixes though :)
::Dir.entries(root_dir).each do |f| | ||
if ::File.readable?(::File.join(root_dir, f)) && \ | ||
f =~ /#{EXTENSION_PREFIX}(.*)\.#{binary_suffix}/ |
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.
Correct me if I am wrong here but what happens if we push a nil
entry into exts
? Shouldn't this situation be avoided?
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.
The conditional line is split across two lines, L133 won't be executed unless the conditions on L131 (::File.readable?(::File.join(root_dir, f))
) and L132 (f =~ /#{EXTENSION_PREFIX}(\w+)\.#{binary_suffix}/
) both evaluate to true at which point the group from the regex will be defined.
Tests work as expected:
|
Support enumerating the extension suffixes for which a particular extension is available. This is foundational work that will allow Metasploit to suggest a Meterpreter that provides a particular extension.
Testing Steps
Example