Skip to content
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 the ability to use numerics with info command #14053

Merged

Conversation

cgranleese-r7
Copy link
Contributor

Before

Before you were not able to use numerics with the info command
image

After

Now if you use a numeric with the info command it will display the corresponding modules info
image

Verification

List the steps needed to make sure this thing works

  • Start msfconsole
  • search winrm
  • info 0
  • Verify the info command displays the corresponding modules information
  • Verify info 9999999 returns [-] Invalid module: 9999999

Comment on lines +660 to +663
unless mod && mod.respond_to?(:fullname)
print_error("Invalid module index: #{mod_name}")
return false
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before

Before when an invalid number was used with the use command it didn't return anything
image

After

Now when an invalid number is used with the use command it will return [-] Invalid module index: 99999
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if you do info on an invalid number/multiple invalid numbers?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwelch-r7, you beat me on this: #14053 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry forgot to add this in!

When an invalid number is used with the info command it will return [-] Invalid module index: 9999
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great usability change!

@@ -110,6 +110,22 @@ def cmd_info_help
print_line
end

def print_module(mod, dump_json: false, show_doc: false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think I'd prefer this to be called something like print_info thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what to call it as I'm not used to naming conventions yet, so If you think print_info would be better I can change that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print_module_info

🥇

Copy link
Contributor

@cdelafuente-r7 cdelafuente-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It a great feature! Thanks for adding this. I just left one comment, but otherwise, it looks good to me.

args.each { |name|
# Use a module by search index
index_from_list(@module_search_results, mod_name) do |mod|
next unless mod && mod.respond_to?(:fullname)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering if we could have the same error message that has been added to the use command when an index is invalid?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, I didn't see it happens later, when checking the return value of framework.modules.create(name).

@cgranleese-r7 cgranleese-r7 force-pushed the accepting-numerics-for-info-command branch from 769977c to e094a55 Compare August 28, 2020 09:29
@adfoster-r7 adfoster-r7 merged commit 763448c into rapid7:master Aug 28, 2020
@adfoster-r7
Copy link
Contributor

adfoster-r7 commented Aug 28, 2020

Release Notes

Improved the info command such that, following a module search, it is now possible to use info <search_index_number> to view a specific module's information.

@adfoster-r7 adfoster-r7 added the rn-enhancement release notes enhancement label Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants