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

show search help when args and module_search_results are empty #12909

Merged
merged 2 commits into from Feb 4, 2020

Conversation

@Auxilus
Copy link
Contributor

Auxilus commented Feb 4, 2020

This avoids case where method assumes that module_search_results is not empty and outputs

msf5 > search
[*] Displaying cached results
[-] No results from search
msf5 >

Verification

check if search displays help when there are no cached search results and no arguments are provided

#12023

@wvu-r7 wvu-r7 self-assigned this Feb 4, 2020
return false
end

cached = true

This comment has been minimized.

Copy link
@wvu-r7

wvu-r7 Feb 4, 2020

Member

I removed the redundant else in this nested conditional, since you're using early return.

@wvu-r7

This comment has been minimized.

Copy link
Member

wvu-r7 commented Feb 4, 2020

msf5 > search
Usage: search [<options>] [<keywords>]

If no options or keywords are provided, cached results are displayed.

OPTIONS:
  -h                Show this help information
  -o <file>         Send output to a file in csv format
  -S <string>       Search string for row filter
  -u                Use module if there is one result

Keywords:
  aka         :  Modules with a matching AKA (also-known-as) name
  author      :  Modules written by this author
  arch        :  Modules affecting this architecture
  bid         :  Modules with a matching Bugtraq ID
  cve         :  Modules with a matching CVE ID
  edb         :  Modules with a matching Exploit-DB ID
  check       :  Modules that support the 'check' method
  date        :  Modules with a matching disclosure date
  description :  Modules with a matching description
  fullname    :  Modules with a matching full name
  mod_time    :  Modules with a matching modification date
  name        :  Modules with a matching descriptive name
  path        :  Modules with a matching path
  platform    :  Modules affecting this platform
  port        :  Modules with a matching port
  rank        :  Modules with a matching rank (Can be descriptive (ex: 'good') or numeric with comparison operators (ex: 'gte400'))
  ref         :  Modules with a matching ref
  reference   :  Modules with a matching reference
  target      :  Modules affecting this target
  type        :  Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)

Examples:
  search cve:2009 type:exploit

msf5 > search auxilus

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

   #  Name                             Disclosure Date  Rank    Check  Description
   -  ----                             ---------------  ----    -----  -----------
   0  post/android/gather/sub_info                      normal  No     extracts subscriber info from target device
   1  post/android/gather/wireless_ap                   normal  No     Displays wireless SSIDs and PSKs


msf5 > search
[*] Displaying cached results

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

   #  Name                             Disclosure Date  Rank    Check  Description
   -  ----                             ---------------  ----    -----  -----------
   0  post/android/gather/sub_info                      normal  No     extracts subscriber info from target device
   1  post/android/gather/wireless_ap                   normal  No     Displays wireless SSIDs and PSKs


msf5 >
wvu-r7 added a commit that referenced this pull request Feb 4, 2020
@wvu-r7 wvu-r7 merged commit 593e391 into rapid7:master Feb 4, 2020
1 of 3 checks passed
1 of 3 checks passed
Metasploit Automation - Sanity Test Execution Running automation sanity tests. Details available on completion.
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Metasploit Automation - Test Execution Successfully completed all tests.
Details
@wvu-r7

This comment has been minimized.

Copy link
Member

wvu-r7 commented Feb 4, 2020

Release Notes

This displays the help for the search command if no arguments were specified and there are no cached search results to display.

@wvu-r7

This comment has been minimized.

Copy link
Member

wvu-r7 commented Feb 4, 2020

Love it, @Auxilus! Thanks for this.

@Auxilus Auxilus deleted the Auxilus:patch-5 branch Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.