plugins: Resolve rubocop violations
This commit is contained in:
+5
-12
@@ -1,14 +1,7 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# This plugin provides management and interaction with an external session aggregator.
|
||||
#
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
Aggregator_yaml = "#{Msf::Config.config_directory}/aggregator.yaml".freeze # location of the aggregator.yml containing saved aggregator creds
|
||||
|
||||
# This plugin provides management and interaction with an external session aggregator.
|
||||
class Plugin::Aggregator < Msf::Plugin
|
||||
class AggregatorCommandDispatcher
|
||||
include Msf::Ui::Console::CommandDispatcher
|
||||
@@ -165,13 +158,13 @@ module Msf
|
||||
def cmd_aggregator_sessions(*args)
|
||||
case args.length
|
||||
when 0
|
||||
isDetailed = false
|
||||
is_detailed = false
|
||||
when 1
|
||||
unless args[0] == '-v'
|
||||
usage_sessions
|
||||
return
|
||||
end
|
||||
isDetailed = true
|
||||
is_detailed = true
|
||||
else
|
||||
usage_sessions
|
||||
return
|
||||
@@ -205,13 +198,13 @@ module Msf
|
||||
if session_map.empty?
|
||||
print_status('No remote sessions.')
|
||||
else
|
||||
unless isDetailed
|
||||
unless is_detailed
|
||||
print_status(' Id Remote Id Type Information Connection')
|
||||
print_status(' -- --------- ---- ----------- ----------')
|
||||
end
|
||||
session_map.keys.sort.each do |key|
|
||||
details, target, local_id = session_map[key]
|
||||
if isDetailed
|
||||
if is_detailed
|
||||
show_session_detailed(details, target, local_id)
|
||||
else
|
||||
show_session(details, target, local_id)
|
||||
|
||||
+8
-14
@@ -118,8 +118,8 @@ module Msf
|
||||
end
|
||||
end
|
||||
|
||||
is_valid_alias = is_valid_alias?(name, value)
|
||||
# print_good "Alias validity = #{is_valid_alias.to_s}"
|
||||
is_valid_alias = valid_alias?(name, value)
|
||||
# print_good "Alias validity = #{is_valid_alias}"
|
||||
is_sys_cmd = Rex::FileUtils.find_full_path(name)
|
||||
is_already_alias = @aliases.keys.include?(name)
|
||||
if is_valid_alias && !is_sys_cmd && !is_already_alias
|
||||
@@ -135,7 +135,7 @@ module Msf
|
||||
print_error("#{name} already exists as a system command, use -f to force override") if is_sys_cmd
|
||||
print_error("#{name} is already an alias, use -f to force override") if is_already_alias
|
||||
if !is_valid_alias && !force
|
||||
print_error("\'#{name}\' is not a permitted name or \'#{value}\' is not valid/permitted")
|
||||
print_error("'#{name}' is not a permitted name or '#{value}' is not valid/permitted")
|
||||
print_error("It's possible the responding dispatcher isn't loaded yet, try changing to the proper context or using -f to force")
|
||||
end
|
||||
end
|
||||
@@ -218,7 +218,7 @@ module Msf
|
||||
#
|
||||
# Validate a proposed alias with the +name+ and having the value +value+
|
||||
#
|
||||
def is_valid_alias?(name, value)
|
||||
def valid_alias?(name, value)
|
||||
# print_good "Assessing validay for #{name} and #{value}"
|
||||
# we validate two things, the name and the value
|
||||
|
||||
@@ -246,14 +246,10 @@ module Msf
|
||||
|
||||
# we're only gonna validate the first part of the cmd, e.g. just ls from "ls -lh"
|
||||
value = value.split(' ').first
|
||||
if @aliases.keys.include?(value)
|
||||
return true
|
||||
else
|
||||
return true if @aliases.keys.include?(value)
|
||||
|
||||
[value, value + '.exe'].each do |cmd|
|
||||
if Rex::FileUtils.find_full_path(cmd)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return true if Rex::FileUtils.find_full_path(cmd)
|
||||
end
|
||||
|
||||
# gather all the current commands the driver's dispatcher's have & check 'em
|
||||
@@ -265,12 +261,10 @@ module Msf
|
||||
if dispatcher.respond_to?("cmd_#{value.split(' ').first}")
|
||||
# print_status "Dispatcher (#{dispatcher.name}) responds to cmd_#{value.split(" ").first}"
|
||||
return true
|
||||
else
|
||||
# print_status "Dispatcher (#{dispatcher.name}) does not respond to cmd_#{value.split(" ").first}"
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
false
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
class Plugin::AutoAddRoute < Msf::Plugin
|
||||
include Msf::SessionEvent
|
||||
|
||||
+6
-6
@@ -119,7 +119,7 @@ module Msf
|
||||
end
|
||||
|
||||
def cmd_besecure_version
|
||||
req = Net::HTTP::Post.new('/json.cgi', initheader = { 'Host' => @hostname })
|
||||
req = Net::HTTP::Post.new('/json.cgi', initheader: { 'Host' => @hostname })
|
||||
req.set_form_data({ 'apikey' => @apikey, 'primary' => 'interface' })
|
||||
|
||||
if @debug
|
||||
@@ -136,7 +136,7 @@ module Msf
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
end
|
||||
|
||||
res = http.start { |http| http.request(req) }
|
||||
res = http.start { |h| h.request(req) }
|
||||
|
||||
unless res
|
||||
print_error("#{@hostname} - Connection timed out")
|
||||
@@ -174,7 +174,7 @@ module Msf
|
||||
return ''
|
||||
end
|
||||
|
||||
req = Net::HTTP::Post.new('/json.cgi', initheader = { 'Host' => @hostname })
|
||||
req = Net::HTTP::Post.new('/json.cgi', initheader: { 'Host' => @hostname })
|
||||
req.set_form_data({ 'apikey' => @apikey, 'primary' => 'admin', 'secondary' => 'networks', 'action' => 'returnnetworks', 'search_limit' => 10000 })
|
||||
|
||||
if @debug
|
||||
@@ -191,7 +191,7 @@ module Msf
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
end
|
||||
|
||||
res = http.start { |http| http.request(req) }
|
||||
res = http.start { |h| h.request(req) }
|
||||
|
||||
unless res
|
||||
print_error("#{@hostname} - Connection timed out")
|
||||
@@ -227,7 +227,7 @@ module Msf
|
||||
|
||||
def cmd_besecure_report_download(*args)
|
||||
if args?(args, 4)
|
||||
req = Net::HTTP::Post.new('/json.cgi', initheader = { 'Host' => @hostname })
|
||||
req = Net::HTTP::Post.new('/json.cgi', initheader: { 'Host' => @hostname })
|
||||
format_file = args[1]
|
||||
req.set_form_data({ 'apikey' => @apikey, 'primary' => 'vulnerabilities', 'secondary' => 'report', 'action' => 'getreport', 'network' => args[0], 'format' => format_file })
|
||||
|
||||
@@ -241,7 +241,7 @@ module Msf
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
end
|
||||
|
||||
res = http.start { |http| http.request(req) }
|
||||
res = http.start { |h| h.request(req) }
|
||||
|
||||
unless res
|
||||
print_error("#{@hostname} - Connection timed out")
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# credcollect - tebo[at]attackresearch.com
|
||||
#
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
class Plugin::CredCollect < Msf::Plugin
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
###
|
||||
#
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
class Plugin::EventTester < Msf::Plugin
|
||||
class Subscriber
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#
|
||||
# $Id: $
|
||||
# $Revision: $
|
||||
#
|
||||
|
||||
module Msf
|
||||
###
|
||||
#
|
||||
@@ -54,15 +49,12 @@ module Msf
|
||||
|
||||
last = mt
|
||||
|
||||
omod = active_module
|
||||
nmod = framework.modules.reload_module(active_module)
|
||||
if !nmod
|
||||
print_line('Error: Failed to reload module, trying again on next change...')
|
||||
next
|
||||
end
|
||||
|
||||
active_module = nmod
|
||||
|
||||
jobify = false
|
||||
payload = nmod.datastore['PAYLOAD']
|
||||
encoder = nmod.datastore['ENCODER']
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
###
|
||||
#
|
||||
@@ -78,8 +73,8 @@ module IPSFilter
|
||||
end
|
||||
|
||||
def ips_match(data)
|
||||
lp = localport
|
||||
rp = peerport
|
||||
# lp = localport
|
||||
# rp = peerport
|
||||
|
||||
SIGS.each do |s|
|
||||
r = Regexp.new(s[1])
|
||||
@@ -87,7 +82,7 @@ module IPSFilter
|
||||
print_error "Matched IPS signature #{s[0]}"
|
||||
return true
|
||||
end
|
||||
rescue ::Exception => e
|
||||
rescue ::Exception
|
||||
print_error "Compiled error: #{s[1]}"
|
||||
end
|
||||
|
||||
|
||||
+1
-17
@@ -172,22 +172,6 @@ module Msf
|
||||
end
|
||||
end
|
||||
|
||||
def cmd_lab_load_dir(*args)
|
||||
return lab_usage unless args.count == 2
|
||||
|
||||
@controller.build_from_dir(args[0], args[1], true)
|
||||
end
|
||||
|
||||
def cmd_lab_clear(*_args)
|
||||
@controller.clear!
|
||||
end
|
||||
|
||||
def cmd_lab_save(*args)
|
||||
return lab_usage if args.empty?
|
||||
|
||||
@controller.to_file(args[0])
|
||||
end
|
||||
|
||||
##
|
||||
## Commands for dealing with a currently-loaded lab
|
||||
##
|
||||
@@ -460,7 +444,7 @@ module Msf
|
||||
# Map for usages
|
||||
def lab_usage
|
||||
caller[0][/`cmd_(.*)'/]
|
||||
cmd = ::Regexp.last_match(1)
|
||||
cmd = Regexp.last_match(1)
|
||||
if extended_help[cmd] || commands[cmd]
|
||||
cmd_lab_help cmd
|
||||
else # Should never really get here...
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# This plugin provides an msf daemon interface that spawns a listener on a
|
||||
# defined port (default 55554) and gives each connecting client its own
|
||||
# console interface. These consoles all share the same framework instance.
|
||||
# Be aware that the console instance that spawns on the port is entirely
|
||||
# unauthenticated, so realize that you have been warned.
|
||||
#
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
###
|
||||
|
||||
@@ -100,7 +100,6 @@ module Msf
|
||||
def create_xindex
|
||||
start = Time.now
|
||||
print_status("Creating Exploit Search Index - (#{xindex}) - this won't take long.")
|
||||
count = 0
|
||||
# Use Msf::Config.config_directory as the location.
|
||||
File.open(xindex.to_s, 'w+') do |f|
|
||||
# need to add version line.
|
||||
|
||||
+8
-15
@@ -1,16 +1,10 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# This plugin provides integration with Rapid7 Nexpose
|
||||
#
|
||||
# $Revision$
|
||||
#
|
||||
require 'English'
|
||||
require 'nexpose'
|
||||
|
||||
module Msf
|
||||
Nexpose_yaml = "#{Msf::Config.config_directory}/nexpose.yaml".freeze # location of the nexpose.yml containing saved nexpose creds
|
||||
|
||||
# This plugin provides integration with Rapid7 Nexpose
|
||||
class Plugin::Nexpose < Msf::Plugin
|
||||
class NexposeCommandDispatcher
|
||||
include Msf::Ui::Console::CommandDispatcher
|
||||
@@ -39,7 +33,7 @@ module Msf
|
||||
'nexpose_command' => 'Execute a console command on the Nexpose instance',
|
||||
'nexpose_sysinfo' => 'Display detailed system information about the Nexpose instance'
|
||||
|
||||
# TODO:
|
||||
# @TODO:
|
||||
# nexpose_stop_scan
|
||||
}
|
||||
end
|
||||
@@ -368,7 +362,6 @@ module Msf
|
||||
|
||||
opt_template = 'pentest-audit'
|
||||
opt_maxaddrs = 32
|
||||
opt_monitor = false
|
||||
opt_verbose = false
|
||||
opt_savexml = nil
|
||||
opt_preserve = false
|
||||
@@ -394,9 +387,9 @@ module Msf
|
||||
opt_savexml = val
|
||||
when '-c'
|
||||
if (val =~ /^([^:]+):([^:]+):(.+)/)
|
||||
type = ::Regexp.last_match(1)
|
||||
user = ::Regexp.last_match(2)
|
||||
pass = ::Regexp.last_match(3)
|
||||
type = Regexp.last_match(1)
|
||||
user = Regexp.last_match(2)
|
||||
pass = Regexp.last_match(3)
|
||||
msfid = Time.now.to_i
|
||||
newcreds = Nexpose::SiteCredentials.for_service("Metasploit Site Credential #{msfid}", nil, nil, nil, nil, type)
|
||||
newcreds.user_name = user
|
||||
@@ -622,9 +615,9 @@ module Msf
|
||||
def nexpose_vuln_lookup(doc, vid, refs, host, serv = nil)
|
||||
doc.elements.each("/NexposeReport/VulnerabilityDefinitions/vulnerability[@id = '#{vid}']]") do |vulndef|
|
||||
title = vulndef.attributes['title']
|
||||
pciSeverity = vulndef.attributes['pciSeverity']
|
||||
cvss_score = vulndef.attributes['cvssScore']
|
||||
cvss_vector = vulndef.attributes['cvssVector']
|
||||
# pci_severity = vulndef.attributes['pciSeverity']
|
||||
# cvss_score = vulndef.attributes['cvssScore']
|
||||
# cvss_vector = vulndef.attributes['cvssVector']
|
||||
|
||||
vulndef.elements['references'].elements.each('reference') do |ref|
|
||||
if ref.attributes['source'] == 'BID'
|
||||
|
||||
+2
-7
@@ -1,13 +1,8 @@
|
||||
#
|
||||
# This plugin provides integration with OpenVAS. Written by kost and
|
||||
# averagesecurityguy.
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
# This plugin provides integration with OpenVAS.
|
||||
# Written by kost and averagesecurityguy.
|
||||
#
|
||||
# Distributed under MIT license:
|
||||
# http://www.opensource.org/licenses/mit-license.php
|
||||
#
|
||||
|
||||
require 'openvas-omp'
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
##
|
||||
# $Id$
|
||||
##
|
||||
|
||||
##
|
||||
# This file is part of the Metasploit Framework and may be subject to
|
||||
# redistribution and commercial restrictions. Please see the Metasploit
|
||||
@@ -9,8 +5,6 @@
|
||||
# https://metasploit.com/framework/
|
||||
##
|
||||
|
||||
# $Revision$
|
||||
|
||||
module Msf
|
||||
class Plugin::PcapLog < Msf::Plugin
|
||||
|
||||
@@ -36,7 +30,6 @@ module Msf
|
||||
'pcap_iface' => 'Set/Get an interface to capture from',
|
||||
'pcap_start' => 'Start a capture',
|
||||
'pcap_stop' => 'Stop a running capture',
|
||||
|
||||
'pcap_show_config' => 'Show the current PcapLog configuration'
|
||||
}
|
||||
end
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ module Msf
|
||||
response = http_client.send_recv(req)
|
||||
rescue ::OpenSSL::SSL::SSLError
|
||||
print_error('Encountered an SSL error')
|
||||
rescue ::Errno::ECONNRESET => e
|
||||
rescue ::Errno::ECONNRESET
|
||||
print_error('The connection was reset by the peer')
|
||||
rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error
|
||||
print_error('Encountered an error')
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
module Msf
|
||||
###
|
||||
#
|
||||
@@ -10,7 +6,6 @@ module Msf
|
||||
# through any other arbitrary means. They are designed to have a very loose
|
||||
# definition in order to make them as useful as possible.
|
||||
#
|
||||
# $Revision$
|
||||
###
|
||||
class Plugin::Sample < Msf::Plugin
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
###
|
||||
#
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
###
|
||||
#
|
||||
|
||||
@@ -1,37 +1,12 @@
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
#
|
||||
|
||||
module Msf
|
||||
###
|
||||
#
|
||||
# This class illustrates a sample plugin. Plugins can change the behavior of
|
||||
# the framework by adding new features, new user interface commands, or
|
||||
# through any other arbitrary means. They are designed to have a very loose
|
||||
# definition in order to make them as useful as possible.
|
||||
#
|
||||
###
|
||||
class Plugin::ThreadTest < Msf::Plugin
|
||||
|
||||
###
|
||||
#
|
||||
# This class implements a sample console command dispatcher.
|
||||
#
|
||||
###
|
||||
class ConsoleCommandDispatcher
|
||||
include Msf::Ui::Console::CommandDispatcher
|
||||
|
||||
#
|
||||
# The dispatcher's name.
|
||||
#
|
||||
def name
|
||||
'ThreadTest'
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the hash of commands supported by this dispatcher.
|
||||
#
|
||||
def commands
|
||||
{
|
||||
'start_thread' => 'Start a background thread that writes to the console',
|
||||
|
||||
@@ -59,9 +59,6 @@ module Msf
|
||||
username = opt_user_pass[0]
|
||||
password = opt_user_pass[1]
|
||||
|
||||
tokens_del = {}
|
||||
tokens_imp = {}
|
||||
|
||||
framework.sessions.each_key do |sid|
|
||||
session = framework.sessions[sid]
|
||||
next unless session.type == 'meterpreter'
|
||||
|
||||
@@ -89,7 +89,7 @@ module Msf
|
||||
next
|
||||
end
|
||||
|
||||
fdom, fusr = user.split('\\')
|
||||
_fdom, fusr = user.split('\\')
|
||||
|
||||
if (!fusr.nil? && !ndom && (fusr.strip.downcase == nusr.strip.downcase))
|
||||
print_status("FOUND: #{session.sid} - #{session.session_host} - #{user} (delegation)")
|
||||
@@ -113,7 +113,7 @@ module Msf
|
||||
next
|
||||
end
|
||||
|
||||
fdom, fusr = user.split('\\')
|
||||
_fdom, fusr = user.split('\\')
|
||||
if (!fusr.nil? && !ndom && (fusr.strip.downcase == nusr.strip.downcase))
|
||||
print_status(">> Found #{session.sid} - #{session.session_host} - #{user} (impersonation)")
|
||||
end
|
||||
|
||||
@@ -135,9 +135,6 @@ module Msf
|
||||
end
|
||||
end
|
||||
|
||||
# Create an Array to hold a list of tables that we want to show
|
||||
outputs = []
|
||||
|
||||
# Output the table
|
||||
if respond_to? "#{command}_to_table", true
|
||||
table = send "#{command}_to_table", tbl_opts
|
||||
|
||||
+59
-53
@@ -10,7 +10,25 @@ module Msf
|
||||
class Plugin::Wmap < Msf::Plugin
|
||||
class WmapCommandDispatcher
|
||||
|
||||
attr_accessor :wmapmodules, :targets, :lastsites, :rpcarr, :njobs, :nmaxdisplay, :runlocal, :masstop, :killwhenstop # Enabled Wmap modules # Targets # Temp location of previously obtained sites # Array or rpc connections # Max number of jobs # Flag to stop displaying the same mesg # Flag to run local modules only # Flag to stop everything # Kill process when exiting
|
||||
# @!attribute wmapmodules
|
||||
# @return [Array] Enabled WMAP modules
|
||||
# @!attribute targets
|
||||
# @return [Hash] WMAP targets
|
||||
# @!attribute lastsites
|
||||
# @return [Array] Temp location of previously obtained sites
|
||||
# @!attribute rpcarr
|
||||
# @return [Array] Array or rpc connections
|
||||
# @!attribute njobs
|
||||
# @return [Integer] Max number of jobs
|
||||
# @!attribute nmaxdisplay
|
||||
# @return [Boolean] Flag to stop displaying the same message
|
||||
# @!attribute runlocal
|
||||
# @return [Boolean] Flag to run local modules only
|
||||
# @!attribute masstop
|
||||
# @return [Boolean] Flag to stop everything
|
||||
# @!attribute killwhenstop
|
||||
# @return [Boolean] Kill process when exiting
|
||||
attr_accessor :wmapmodules, :targets, :lastsites, :rpcarr, :njobs, :nmaxdisplay, :runlocal, :masstop, :killwhenstop
|
||||
|
||||
include Msf::Ui::Console::CommandDispatcher
|
||||
|
||||
@@ -487,7 +505,6 @@ module Msf
|
||||
matches10 = Hash.new
|
||||
|
||||
# OPTIONS
|
||||
opt_str = nil
|
||||
jobify = false
|
||||
|
||||
# This will be clean later
|
||||
@@ -589,7 +606,7 @@ module Msf
|
||||
|
||||
begin
|
||||
if execmod
|
||||
rpcnode = rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
end
|
||||
rescue ::Exception
|
||||
print_status(" >> Exception during launch from #{xref[0]}: #{$ERROR_INFO}")
|
||||
@@ -653,7 +670,7 @@ module Msf
|
||||
|
||||
begin
|
||||
if execmod
|
||||
rpcnode = rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
end
|
||||
rescue ::Exception
|
||||
print_status(" >> Exception during launch from #{xref[0]}: #{$ERROR_INFO}")
|
||||
@@ -774,7 +791,7 @@ module Msf
|
||||
|
||||
begin
|
||||
if execmod
|
||||
rpcnode = rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
end
|
||||
rescue ::Exception
|
||||
print_status(" >> Exception during launch from #{xref[0]}: #{$ERROR_INFO}")
|
||||
@@ -885,7 +902,7 @@ module Msf
|
||||
# print_status "+++++++++"
|
||||
|
||||
form.params.each do |p|
|
||||
pn, pv, pt = p
|
||||
pn, pv, _pt = p
|
||||
if pn
|
||||
if !pn.empty?
|
||||
if !pv || pv.empty?
|
||||
@@ -921,8 +938,8 @@ module Msf
|
||||
# TODO: Add headers, etc.
|
||||
#
|
||||
if !usinginipath || (usinginipath && form.path.match(inipathname))
|
||||
|
||||
print_status "Path #{form.path}"
|
||||
|
||||
# print_status("Unique PATH #{modopts['PATH']}")
|
||||
# print_status("Unique GET #{modopts['QUERY']}")
|
||||
# print_status("Unique POST #{modopts['DATA']}")
|
||||
@@ -937,8 +954,6 @@ module Msf
|
||||
print_status(" >> Exception during launch from #{xref[0]}: #{$ERROR_INFO}")
|
||||
end
|
||||
end
|
||||
else
|
||||
# print_status("Already tested")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1022,7 +1037,7 @@ module Msf
|
||||
temparr = []
|
||||
|
||||
req.params.each do |p|
|
||||
pn, pv, pt = p
|
||||
pn, pv, _pt = p
|
||||
if pn
|
||||
if !pn.empty?
|
||||
if !pv || pv.empty?
|
||||
@@ -1051,9 +1066,9 @@ module Msf
|
||||
#
|
||||
# TODO: Add method, headers, etc.
|
||||
#
|
||||
next unless !usinginipath || (usinginipath && req.path.match(inipathname))
|
||||
|
||||
if !usinginipath || (usinginipath && req.path.match(inipathname))
|
||||
print_status "Path #{req.path}"
|
||||
|
||||
# print_status("Query PATH #{modopts['PATH']}")
|
||||
# print_status("Query GET #{modopts['QUERY']}")
|
||||
# print_status("Query POST #{modopts['DATA']}")
|
||||
@@ -1061,13 +1076,14 @@ module Msf
|
||||
|
||||
begin
|
||||
if execmod
|
||||
rpcnode = rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
end
|
||||
rescue ::Exception
|
||||
print_status(" >> Exception during launch from #{xref[0]}: #{$ERROR_INFO}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue ::Exception
|
||||
print_status(" >> Exception from #{xref[0]}: #{$ERROR_INFO}")
|
||||
end
|
||||
@@ -1134,7 +1150,7 @@ module Msf
|
||||
|
||||
begin
|
||||
if execmod
|
||||
rpcnode = rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
rpc_round_exec(xref[0], xref[1], modopts, njobs)
|
||||
end
|
||||
rescue ::Exception
|
||||
print_status(" >> Exception during launch from #{xref[0]}: #{$ERROR_INFO}")
|
||||
@@ -1627,16 +1643,12 @@ module Msf
|
||||
end
|
||||
end
|
||||
|
||||
def signature(fpath, fquery)
|
||||
hsig = Hash.new
|
||||
|
||||
hsig = queryparse(fquery)
|
||||
|
||||
#
|
||||
# Signature of the form ',p1,p2,pn' then to be appended to path: path,p1,p2,pn
|
||||
#
|
||||
|
||||
sigstr = fpath + ',' + hsig.map { |p| p[0].to_s }.join(',')
|
||||
def signature(fpath, fquery)
|
||||
hsig = queryparse(fquery)
|
||||
fpath + ',' + hsig.map { |p| p[0].to_s }.join(',')
|
||||
end
|
||||
|
||||
def queryparse(query)
|
||||
@@ -1658,11 +1670,13 @@ module Msf
|
||||
self.rpcarr = Hash.new
|
||||
end
|
||||
|
||||
begin
|
||||
istr = "#{host}|#{port}|#{ssl}|#{user}|#{pass}"
|
||||
|
||||
if rpcarr.key?(istr) && !bypass_exist && !rpcarr[istr].nil?
|
||||
print_error("Connection already exists #{istr}")
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
begin
|
||||
temprpc = ::Msf::RPC::Client.new(
|
||||
host: host,
|
||||
@@ -1680,17 +1694,14 @@ module Msf
|
||||
if !res
|
||||
print_error("Unable to authenticate to #{host}:#{port}.")
|
||||
return
|
||||
else
|
||||
res = temprpc.call('core.version')
|
||||
end
|
||||
|
||||
res = temprpc.call('core.version')
|
||||
print_status("Connected to #{host}:#{port} [#{res['version']}].")
|
||||
rpcarr[istr] = temprpc
|
||||
end
|
||||
rescue StandardError
|
||||
print_error('Unable to connect')
|
||||
end
|
||||
end
|
||||
|
||||
def local_module_exec(mod, mtype, opts, _nmaxjobs)
|
||||
jobify = false
|
||||
@@ -1769,7 +1780,9 @@ module Msf
|
||||
rpcarr.each do |k, rpccon|
|
||||
if !rpccon
|
||||
print_error("Skipping inactive node #{nid} #{k}")
|
||||
else
|
||||
nid += 1
|
||||
end
|
||||
|
||||
begin
|
||||
currentjobs = rpccon.call('job.list').length
|
||||
|
||||
@@ -1796,7 +1809,7 @@ module Msf
|
||||
next
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
nid += 1
|
||||
end
|
||||
|
||||
@@ -1812,10 +1825,10 @@ module Msf
|
||||
print_error("Unable to execute module in node #{k} #{res}")
|
||||
end
|
||||
end
|
||||
else
|
||||
# print_status("Max number of jobs #{nmaxjobs} reached in node #{k}")
|
||||
end
|
||||
|
||||
# print_status("Max number of jobs #{nmaxjobs} reached in node #{k}") if minjobs >= nmaxjobs
|
||||
|
||||
idx += 1
|
||||
end
|
||||
|
||||
@@ -1834,8 +1847,9 @@ module Msf
|
||||
|
||||
rpcarr.each do |k, v|
|
||||
if v
|
||||
res = v.call('db.driver', { driver: 'postgresql' })
|
||||
res = v.call('db.connect', { database: name, host: host, port: port, username: user, password: pass })
|
||||
v.call('db.driver', { driver: 'postgresql' })
|
||||
v.call('db.connect', { database: name, host: host, port: port, username: user, password: pass })
|
||||
|
||||
res = v.call('db.status')
|
||||
|
||||
if res['db'] == name
|
||||
@@ -1858,20 +1872,16 @@ module Msf
|
||||
|
||||
idx = k
|
||||
begin
|
||||
currentjobs = rpccon.call('job.list').length
|
||||
rpccon.call('job.list').length
|
||||
rescue StandardError
|
||||
tarr = k.split('|')
|
||||
rflag = false
|
||||
|
||||
res = rpccon.login(tarr[3], tarr[4])
|
||||
|
||||
if res
|
||||
rflag = true
|
||||
raise ConnectionError unless res
|
||||
|
||||
print_error("Reauth to node #{tarr[0]}:#{tarr[1]}")
|
||||
break
|
||||
else
|
||||
raise ConnectionError
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue StandardError
|
||||
@@ -1880,8 +1890,6 @@ module Msf
|
||||
if active_rpc_nodes == 0
|
||||
print_error('No active nodes')
|
||||
self.masstop = true
|
||||
else
|
||||
# blah
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2011,9 +2019,7 @@ module Msf
|
||||
rpc_reconnect_nodes
|
||||
|
||||
idx = 0
|
||||
rpcarr.each do |k, rpccon|
|
||||
arrk = k.split('|')
|
||||
|
||||
rpcarr.each do |_k, rpccon|
|
||||
v = 'NOCONN'
|
||||
n = 1
|
||||
c = '%red'
|
||||
@@ -2117,17 +2123,16 @@ module Msf
|
||||
end
|
||||
|
||||
def active_rpc_nodes
|
||||
if rpcarr.empty?
|
||||
return 0
|
||||
else
|
||||
return 0 if rpcarr.empty?
|
||||
|
||||
idx = 0
|
||||
rpcarr.each do |_k, conn|
|
||||
if conn
|
||||
idx += 1
|
||||
end
|
||||
end
|
||||
return idx
|
||||
end
|
||||
|
||||
idx
|
||||
end
|
||||
|
||||
def view_modules
|
||||
@@ -2175,19 +2180,20 @@ module Msf
|
||||
end
|
||||
end
|
||||
|
||||
# Sort hash by orderid
|
||||
# Yes sorting hashes dont make sense but actually it does when you are enumerating one. And
|
||||
# sort_by of a hash returns an array so this is the reason for this ugly piece of code
|
||||
def sort_by_orderid(m)
|
||||
def sort_by_orderid(matches)
|
||||
temphash = Hash.new
|
||||
temparr = []
|
||||
|
||||
temparr = m.sort_by do |xref, _v|
|
||||
temparr = matches.sort_by do |xref, _v|
|
||||
xref[3]
|
||||
end
|
||||
|
||||
temparr.each do |b|
|
||||
temphash[b[0]] = b[1]
|
||||
end
|
||||
|
||||
temphash
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user