Revert history -u deduplication on print

GSoC/Meterpreter_Web_Console
William Vu 2018-08-05 14:28:15 -05:00
parent a0962855bd
commit f6d9cde7c4
1 changed files with 2 additions and 8 deletions

View File

@ -87,8 +87,7 @@ class Core
@@history_opts = Rex::Parser::Arguments.new(
"-h" => [ false, "Help banner." ],
"-a" => [ false, "Show all commands in history." ],
"-n" => [ true, "Show the last n commands." ],
"-u" => [ false, "Show only unique commands." ])
"-n" => [ true, "Show the last n commands." ])
@@irb_opts = Rex::Parser::Arguments.new(
"-h" => [ false, "Help banner." ],
@ -470,7 +469,6 @@ class Core
def cmd_history(*args)
length = Readline::HISTORY.length
uniq = false
if length < @history_limit
limit = length
@ -489,8 +487,6 @@ class Core
else
limit = val.to_i
end
when "-u"
uniq = true
when "-h"
cmd_history_help
return false
@ -501,9 +497,6 @@ class Core
pad_len = length.to_s.length
(start..length-1).each do |pos|
if uniq && Readline::HISTORY[pos] == Readline::HISTORY[pos-1]
next unless pos == 0
end
cmd_num = (pos + 1).to_s
print_line "#{cmd_num.ljust(pad_len)} #{Readline::HISTORY[pos]}"
end
@ -514,6 +507,7 @@ class Core
print_line
print_line "Shows the command history."
print_line "If -n is not set, only the last #{@history_limit} commands will be shown."
print_line
print @@history_opts.usage
end