Land #10334, Add grep -C

4.x
Adam Cammack 2018-07-18 14:45:06 -05:00 committed by Metasploit
parent 691d8f2c41
commit 9a72d0cbe7
No known key found for this signature in database
GPG Key ID: CDFB5FA52007B954
1 changed files with 10 additions and 3 deletions

View File

@ -83,8 +83,9 @@ class Core
"-i" => [ false, "Ignore case." ], "-i" => [ false, "Ignore case." ],
"-m" => [ true, "Stop after arg matches." ], "-m" => [ true, "Stop after arg matches." ],
"-v" => [ false, "Invert match." ], "-v" => [ false, "Invert match." ],
"-A" => [ true, "Show arg lines of output After a match." ], "-A" => [ true, "Show arg lines of output after a match." ],
"-B" => [ true, "Show arg lines of output Before a match." ], "-B" => [ true, "Show arg lines of output before a match." ],
"-C" => [ true, "Show arg lines of output around a match." ],
"-s" => [ true, "Skip arg lines of output before attempting match."], "-s" => [ true, "Skip arg lines of output before attempting match."],
"-k" => [ true, "Keep (include) arg lines at start of output." ], "-k" => [ true, "Keep (include) arg lines at start of output." ],
"-c" => [ false, "Only print a count of matching lines." ]) "-c" => [ false, "Only print a count of matching lines." ])
@ -2010,6 +2011,12 @@ class Core
output_mods[:before] = val.to_i output_mods[:before] = val.to_i
# delete opt and val from args list # delete opt and val from args list
args.shift(2) args.shift(2)
when "-C"
# also return arg lines around a match
output_mods[:before] = val.to_i
output_mods[:after] = val.to_i
# delete opt and val from args list
args.shift(2)
when "-v" when "-v"
# invert match # invert match
match_mods[:invert] = true match_mods[:invert] = true
@ -2063,7 +2070,7 @@ class Core
prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar
mod = active_module mod = active_module
if mod # if there is an active module, give them the fanciness they have come to expect if mod # if there is an active module, give them the fanciness they have come to expect
driver.update_prompt("#{prompt} #{mod.type}(%bld%red#{mod.shortname}%clr) ", prompt_char, true) driver.update_prompt("#{prompt} #{mod.type}(%bld%red#{mod.promptname}%clr) ", prompt_char, true)
else else
driver.update_prompt("#{prompt} ", prompt_char, true) driver.update_prompt("#{prompt} ", prompt_char, true)
end end