rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
32.92k stars 13.72k forks source link

Undocumented parameter in "notes" command #19128

Closed pwndad closed 3 weeks ago

pwndad commented 3 weeks ago

Summary

notes -h states that we can use this example command notes -S 'nmap.nse.(http|rtsp)' Example documentation

But this flag is neither documented here missing documentation for search parameter nor is it working correctly when used like this.

Acutally there seems to be code handling the -S parameter: existing code for handling undocumented parameter

Motivation

To be consistent between parameter documentation, examples and code behind.

Steps to resolve this issue

EITHER

Draft the doc

-S, --search <filter> Search string to filter by

Open a pull request

Sorry for not proposing a PR but I could not figure out why the undocumented parameter is not working as expected.

nrathaus commented 3 weeks ago

@pwndad it doesn't "work" because:

@@notes_opts = Rex::Parser::Arguments.new(
    [ '-a', '--add' ] => [ false, 'Add a note to the list of addresses, instead of listing.' ],
    [ '-d', '--delete' ] => [ false, 'Delete the notes instead of searching.' ],
    [ '-n', '--note' ] => [ true, 'Set the data for a new note (only with -a).', '<note>' ],
    [ '-t', '--type' ] => [ true, 'Search for a list of types, or set single type for add.', '<type1,type2>' ],
    [ '-h', '--help' ] => [ false, 'Show this help information.' ],
    [ '-R', '--rhosts' ] => [ false, 'Set RHOSTS from the results of the search.' ],
    [ '-o', '--output' ] => [ true, 'Save the notes to a csv file.', '<filename>' ],
    [ '-O', '--order' ] => [ true, 'Order rows by specified column number.', '<column id>' ],
    [ '-u', '--update' ] => [ false, 'Update a note. Not officially supported.' ]
  )

Doesn't list '-S' as an option

If you add (at line 1240):

    [ '-S', '--search' ] => [ true, 'Search string to filter by.', '<filter>' ],

The code will get triggered - and the notes (appears) to be filtered - I am saying appears as I don't have nmap results that match your data

smcintyre-r7 commented 3 weeks ago

Fixed in #19129 which will be included in the next regularly scheduled release, 6.4.6 which should be posted tomorrow.