Class: Msf::Auxiliary
- Includes:
- HasActions
- Defined in:
- lib/msf/core/auxiliary.rb,
lib/msf/core/auxiliary/login_scanner.rb,
lib/msf/core/auxiliary/report_summary.rb
Overview
The auxiliary class acts as a base class for all modules that perform reconnaissance, retrieve data, brute force logins, or any other action that doesn’t fit our concept of an ‘exploit’ (involving payloads and targets and whatnot).
Defined Under Namespace
Modules: Arista, AuthBrute, Brocade, CNPILOT, CRand, Cisco, CommandShell, DRDoS, Dos, EPMP, Etcd, F5, Fuzzer, HttpCrawler, IAX2, Juniper, Kademlia, LLMNR, Login, LoginScanner, MDNS, MQTT, ManageEngineXnode, Mikrotik, MimeTypes, Mms, NATPMP, NTP, Nfs, Nmap, PII, PasswordCracker, Prometheus, RServices, Redis, Report, ReportSummary, Rocketmq, Scanner, Sms, Timed, UDPScanner, Ubiquiti, VYOS, Web, WmapCrawler, WmapModule, WmapScanDir, WmapScanFile, WmapScanGeneric, WmapScanQuery, WmapScanSSL, WmapScanServer, WmapScanUniqueQuery Classes: Complete, Failed
Constant Summary
Constants inherited from Module
Module::REPLICANT_EXTENSION_DS_KEY
Constants included from Module::ModuleInfo
Module::ModuleInfo::UpdateableOptions
Instance Attribute Summary collapse
-
#passive ⇒ Object
writeonly
protected
Sets the attribute passive.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#sockets ⇒ Object
protected
Returns the value of attribute sockets.
Attributes inherited from Module
#error, #job_id, #license, #platform, #privileged, #references, #user_data
Attributes included from Framework::Offspring
Attributes included from Module::UUID
Attributes included from Rex::Ui::Subscriber::Input
Attributes included from Rex::Ui::Subscriber::Output
Attributes included from Module::Privileged
Attributes included from Module::Options
Attributes included from Module::ModuleStore
Attributes included from Module::ModuleInfo
Attributes included from Module::FullName
Attributes included from Module::DataStore
Attributes included from Module::Author
Attributes included from Module::Arch
Attributes included from Module::Alert
#alerts, #you_have_been_warned
Class Method Summary collapse
-
.create(info = {}) ⇒ Object
Creates a singleton instance of this auxiliary class.
-
.type ⇒ Object
Returns MODULE_AUX to indicate that this is an auxiliary module.
Instance Method Summary collapse
-
#abort_sockets ⇒ Object
This method is called once a new session has been created on behalf of this module instance and all socket connections created by this module should be closed.
-
#add_socket(sock) ⇒ Object
Adds a socket to the list of sockets opened by this exploit.
-
#autofilter ⇒ Object
Performs last-minute sanity checking of auxiliary parameters.
-
#autofilter_ports ⇒ Object
Provides a list of ports that can be used for matching this module against target systems.
-
#autofilter_services ⇒ Object
Provides a list of services that can be used for matching this module against target systems.
- #auxiliary_commands ⇒ Object
-
#cleanup ⇒ Object
Called after ‘run’ returns.
-
#fail_with(reason, msg = nil) ⇒ Object
Override Msf::Module#fail_with for Msf::Simple::Auxiliary::job_run_proc.
-
#initialize(info = {}) ⇒ Auxiliary
constructor
Creates an instance of the auxiliary module.
-
#register_autofilter_ports(ports = []) ⇒ Object
Adds a port into the list of ports.
- #register_autofilter_services(services = []) ⇒ Object
-
#remove_socket(sock) ⇒ Object
Removes a socket from the list of sockets.
- #run ⇒ Object
-
#setup ⇒ Object
Called directly before ‘run’.
-
#type ⇒ Object
Returns MODULE_AUX to indicate that this is an auxiliary module.
Methods inherited from Module
#adapted_refname, #adapter_refname, #black_listed_auth_filenames, cached?, #debugging?, #default_cred?, #default_options, #file_path, #framework, #has_check?, #orig_cls, #owner, #perform_extensions, #platform?, #platform_to_s, #post_auth?, #register_extensions, #register_parent, #replicant, #required_cred_options, #set_defaults, #stage_refname, #stager_refname, #workspace
Methods included from Module::Reliability
#reliability, #reliability_to_s
Methods included from Module::Stability
Methods included from Module::SideEffects
#side_effects, #side_effects_to_s
Methods included from Module::UUID
Methods included from Module::UI
Methods included from Module::UI::Message
#print_error, #print_good, #print_prefix, #print_status, #print_warning
Methods included from Module::UI::Message::Verbose
#vprint_error, #vprint_good, #vprint_status, #vprint_warning
Methods included from Module::UI::Line
#print_line, #print_line_prefix
Methods included from Module::UI::Line::Verbose
Methods included from Rex::Ui::Subscriber
Methods included from Rex::Ui::Subscriber::Input
Methods included from Rex::Ui::Subscriber::Output
#flush, #print, #print_blank_line, #print_error, #print_good, #print_line, #print_status, #print_warning
Methods included from Module::Type
#auxiliary?, #encoder?, #evasion?, #exploit?, #nop?, #payload?, #post?
Methods included from Module::Ranking
Methods included from Module::Privileged
Methods included from Module::Options
#deregister_option_group, #deregister_options, #register_advanced_options, #register_evasion_options, #register_option_group, #register_options, #validate
Methods included from Module::Network
#comm, #support_ipv6?, #target_host, #target_port
Methods included from Module::ModuleStore
Methods included from Module::ModuleInfo
#alias, #description, #disclosure_date, #info_fixups, #merge_check_key, #merge_info, #merge_info_advanced_options, #merge_info_alias, #merge_info_description, #merge_info_evasion_options, #merge_info_name, #merge_info_options, #merge_info_string, #merge_info_version, #name, #notes, #update_info
Methods included from Module::FullName
#aliases, #fullname, #promptname, #realname, #refname, #shortname
Methods included from Module::DataStore
#import_defaults, #import_target_defaults, #share_datastore
Methods included from Module::Compatibility
#compat, #compatible?, #init_compat
Methods included from Module::Author
Methods included from Module::Auth
Methods included from Module::Arch
#arch?, #arch_to_s, #each_arch
Methods included from Module::Alert
#add_alert, #add_error, #add_info, #add_warning, #alert_user, #errors, #get_alerts, included, #infos, #is_usable?, #warnings, #without_prompt
Constructor Details
#initialize(info = {}) ⇒ Auxiliary
Creates an instance of the auxiliary module.
41 42 43 44 45 46 47 48 49 |
# File 'lib/msf/core/auxiliary.rb', line 41 def initialize(info = {}) # Call the parent constructor after making any necessary modifications # to the information hash. super(info) self.sockets = Array.new self.queue = Array.new end |
Instance Attribute Details
#passive=(value) ⇒ Object (writeonly, protected)
Sets the attribute passive
170 171 172 |
# File 'lib/msf/core/auxiliary.rb', line 170 def passive=(value) @passive = value end |
#queue ⇒ Object
Returns the value of attribute queue.
165 166 167 |
# File 'lib/msf/core/auxiliary.rb', line 165 def queue @queue end |
#sockets ⇒ Object (protected)
Returns the value of attribute sockets.
169 170 171 |
# File 'lib/msf/core/auxiliary.rb', line 169 def sockets @sockets end |
Class Method Details
.create(info = {}) ⇒ Object
Creates a singleton instance of this auxiliary class
54 55 56 57 |
# File 'lib/msf/core/auxiliary.rb', line 54 def self.create(info = {}) return @@aux_singleton if @@aux_singleton @@aux_singleton = self.new(info) end |
.type ⇒ Object
Returns MODULE_AUX to indicate that this is an auxiliary module.
27 28 29 |
# File 'lib/msf/core/auxiliary.rb', line 27 def self.type Msf::MODULE_AUX end |
Instance Method Details
#abort_sockets ⇒ Object
This method is called once a new session has been created on behalf of this module instance and all socket connections created by this module should be closed.
149 150 151 152 153 154 155 156 157 158 |
# File 'lib/msf/core/auxiliary.rb', line 149 def abort_sockets sockets.delete_if { |sock| begin sock.close rescue ::Exception end true } end |
#add_socket(sock) ⇒ Object
Adds a socket to the list of sockets opened by this exploit.
133 134 135 |
# File 'lib/msf/core/auxiliary.rb', line 133 def add_socket(sock) self.sockets << sock end |
#autofilter ⇒ Object
Performs last-minute sanity checking of auxiliary parameters. This method is called during automated exploitation attempts and allows an auxiliary module to filter bad attempts, obtain more information, and choose better parameters based on the available data. Returning anything that evaluates to “false” will cause this specific auxiliary attempt to be skipped. This method can and will change datastore values and may interact with the backend database. The default value for auxiliary modules is false, since not all auxiliary modules actually attempt to exploit a vulnerability.
78 79 80 |
# File 'lib/msf/core/auxiliary.rb', line 78 def autofilter false end |
#autofilter_ports ⇒ Object
Provides a list of ports that can be used for matching this module against target systems.
86 87 88 |
# File 'lib/msf/core/auxiliary.rb', line 86 def autofilter_ports @autofilter_ports || [] end |
#autofilter_services ⇒ Object
Provides a list of services that can be used for matching this module against target systems.
94 95 96 |
# File 'lib/msf/core/auxiliary.rb', line 94 def autofilter_services @autofilter_services || [] end |
#auxiliary_commands ⇒ Object
63 64 65 |
# File 'lib/msf/core/auxiliary.rb', line 63 def auxiliary_commands return { } end |
#cleanup ⇒ Object
Called after ‘run’ returns
126 127 128 |
# File 'lib/msf/core/auxiliary.rb', line 126 def cleanup abort_sockets() end |
#fail_with(reason, msg = nil) ⇒ Object
Override Msf::Module#fail_with for Msf::Simple::Auxiliary::job_run_proc
161 162 163 |
# File 'lib/msf/core/auxiliary.rb', line 161 def fail_with(reason, msg = nil) raise Msf::Auxiliary::Failed, "#{reason.to_s}: #{msg}" end |
#register_autofilter_ports(ports = []) ⇒ Object
Adds a port into the list of ports
101 102 103 104 105 106 |
# File 'lib/msf/core/auxiliary.rb', line 101 def register_autofilter_ports(ports=[]) @autofilter_ports ||= [] @autofilter_ports << ports @autofilter_ports.flatten! @autofilter_ports.uniq! end |
#register_autofilter_services(services = []) ⇒ Object
108 109 110 111 112 113 |
# File 'lib/msf/core/auxiliary.rb', line 108 def register_autofilter_services(services=[]) @autofilter_services ||= [] @autofilter_services << services @autofilter_services.flatten! @autofilter_services.uniq! end |
#remove_socket(sock) ⇒ Object
Removes a socket from the list of sockets.
140 141 142 |
# File 'lib/msf/core/auxiliary.rb', line 140 def remove_socket(sock) self.sockets.delete(sock) end |
#run ⇒ Object
59 60 61 |
# File 'lib/msf/core/auxiliary.rb', line 59 def run print_status("Running the default Auxiliary handler") end |
#setup ⇒ Object
Called directly before ‘run’
119 120 121 |
# File 'lib/msf/core/auxiliary.rb', line 119 def setup alert_user end |
#type ⇒ Object
Returns MODULE_AUX to indicate that this is an auxiliary module.
34 35 36 |
# File 'lib/msf/core/auxiliary.rb', line 34 def type Msf::MODULE_AUX end |