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 display previous search results #12023

Merged
merged 7 commits into from Jun 29, 2019

Conversation

Projects
None yet
3 participants
@wvu-r7
Copy link
Contributor

commented Jun 28, 2019

This may be helpful if you want to use a module from your previous search, but the results have scrolled off the screen already
Helpful when using by index
I didn't want to change the behavior of search by itself, which displays its help
Which is probably helpful to newbies, since there is a lot of development around that kind of code
You can also up-arrow or ^R and rerun your previous search, but...
Open to renaming the option or another implementation
I thought about -l, too
Or we could redefine argument-less invocation
Happy to change it, but lately I've kind of hated having to rerun searches

msf5 > search ssh_login

Matching Modules
================

   #  Name                                    Disclosure Date  Rank    Check  Description
   -  ----                                    ---------------  ----    -----  -----------
   0  auxiliary/scanner/ssh/ssh_login                          normal  Yes    SSH Login Check Scanner
   1  auxiliary/scanner/ssh/ssh_login_pubkey                   normal  Yes    SSH Public Key Login Scanner


msf5 > use 0
msf5 auxiliary(scanner/ssh/ssh_login) > set rhosts 172.28.128.3
rhosts => 172.28.128.3
msf5 auxiliary(scanner/ssh/ssh_login) > set username vagrant
username => vagrant
msf5 auxiliary(scanner/ssh/ssh_login) > set password vagrant
password => vagrant
msf5 auxiliary(scanner/ssh/ssh_login) > run

[+] 172.28.128.3:22 - Success: 'vagrant:vagrant' 'uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant) Linux ubuntu-xenial 4.4.0-141-generic #167-Ubuntu SMP Wed Dec 5 10:40:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux '
[*] Command shell session 1 opened (172.28.128.1:64308 -> 172.28.128.3:22) at 2019-06-27 21:28:23 -0500
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/ssh/ssh_login) > search
[*] Displaying cached results

Matching Modules
================

   #  Name                                    Disclosure Date  Rank    Check  Description
   -  ----                                    ---------------  ----    -----  -----------
   0  auxiliary/scanner/ssh/ssh_login                          normal  Yes    SSH Login Check Scanner
   1  auxiliary/scanner/ssh/ssh_login_pubkey                   normal  Yes    SSH Public Key Login Scanner


msf5 auxiliary(scanner/ssh/ssh_login) > use 1
msf5 auxiliary(scanner/ssh/ssh_login_pubkey) >

Updates #11724 and #11819.

@busterb

This comment has been minimized.

Copy link
Member

commented Jun 28, 2019

If I execute search -c monkey, should that error out, display cached, or display search results for monkey? If this cached behavior came from 'search' with no arguments if there was a previous search, I think it would be reasonable intuitive, even if it means the current default of always displaying 'help' is changed.

@wvu-r7

This comment has been minimized.

Copy link
Contributor Author

commented Jun 28, 2019

I'm totally fine with that! I was leaning toward that, personally, but I didn't want to change newbie-friendly behavior. The argument felt kinda cheap.

wvu-r7 added some commits Jun 28, 2019

@wvu-r7

This comment has been minimized.

Copy link
Contributor Author

commented Jun 28, 2019

Ready for testing!

@ccondon-r7
Copy link
Contributor

left a comment

Good description of the use case you're looking to solve for. Logic makes sense, appreciate Brent's point.

@busterb busterb self-assigned this Jun 29, 2019

@busterb busterb merged commit b8165e8 into rapid7:master Jun 29, 2019

3 checks passed

Metasploit Automation - Sanity Test Execution Successfully completed all tests.
Details
Metasploit Automation - Test Execution Successfully completed all tests.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

busterb added a commit that referenced this pull request Jun 29, 2019

@busterb

This comment has been minimized.

Copy link
Member

commented Jun 29, 2019

Release Notes

This modifies the search command to return the results of any previous search by default, returning nothing if there was no previous search.

@wvu-r7 wvu-r7 deleted the wvu-r7:feature/search branch Jun 29, 2019

jmartin-r7 added a commit to jmartin-r7/metasploit-framework that referenced this pull request Jul 16, 2019

jmartin-r7 added a commit to jmartin-r7/metasploit-framework that referenced this pull request Jul 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.