Minor fixups for `grep`

Use Shellwords to join words that have been shellsplit and will be
shellsplit again, and correctly reference a missing command name.
GSoC/Meterpreter_Web_Console
Adam Cammack 2018-09-11 17:20:34 -05:00
parent 68ca771764
commit 74ae89ac96
No known key found for this signature in database
GPG Key ID: C9378BA088092D66
1 changed files with 3 additions and 3 deletions

View File

@ -1997,8 +1997,8 @@ class Core
end
# OptionParser#order allows us to take the rest of the line for the command
pattern, *cmd = opts.order(args)
cmd = cmd.join(" ")
pattern, *rest = opts.order(args)
cmd = Shellwords.shelljoin(rest)
return print(opts.help) if !pattern || cmd.empty?
rx = Regexp.new(pattern, match_mods[:insensitive])
@ -2034,7 +2034,7 @@ class Core
# Bail if the command failed
if cmd_output =~ /Unknown command:/
print_error("Unknown command: #{args[0]}.")
print_error("Unknown command: '#{rest[0]}'.")
return false
end
# put lines into an array so we can access them more easily and split('\n') doesn't work on the output obj.