Use sorted sets extension lists
parent
117cd8bf3a
commit
ac03b7c96a
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: binary -*-
|
||||
require 'set'
|
||||
require 'rex/post/meterpreter'
|
||||
require 'rex/parser/arguments'
|
||||
|
||||
|
@ -416,17 +417,17 @@ class Console::CommandDispatcher::Core
|
|||
@@load_opts.parse(args) { |opt, idx, val|
|
||||
case opt
|
||||
when "-l"
|
||||
exts = []
|
||||
exts = SortedSet.new
|
||||
msf_path = MeterpreterBinaries.metasploit_data_dir
|
||||
gem_path = MeterpreterBinaries.local_dir
|
||||
[msf_path, gem_path].each do |path|
|
||||
::Dir.entries(path).each { |f|
|
||||
if (::File.file?(::File.join(path, f)) && f =~ /ext_server_(.*)\.#{client.binary_suffix}/ )
|
||||
exts.push($1) unless exts.include?($1)
|
||||
exts.add($1)
|
||||
end
|
||||
}
|
||||
end
|
||||
print(exts.sort.join("\n") + "\n")
|
||||
print(exts.to_a.join("\n") + "\n")
|
||||
|
||||
return true
|
||||
when "-h"
|
||||
|
@ -464,19 +465,19 @@ class Console::CommandDispatcher::Core
|
|||
end
|
||||
|
||||
def cmd_load_tabs(str, words)
|
||||
tabs = []
|
||||
tabs = SortedSet.new
|
||||
msf_path = MeterpreterBinaries.metasploit_data_dir
|
||||
gem_path = MeterpreterBinaries.local_dir
|
||||
[msf_path, gem_path].each do |path|
|
||||
::Dir.entries(path).each { |f|
|
||||
if (::File.file?(::File.join(path, f)) && f =~ /ext_server_(.*)\.#{client.binary_suffix}/ )
|
||||
if (not extensions.include?($1))
|
||||
tabs.push($1) unless tabs.include?($1)
|
||||
tabs.add($1)
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
return tabs
|
||||
return tabs.to_a
|
||||
end
|
||||
|
||||
def cmd_use(*args)
|
||||
|
|
Loading…
Reference in New Issue