Module: Msf::OptionalSession::SMB

Includes:
Msf::OptionalSession
Defined in:
lib/msf/core/optional_session/smb.rb

Constant Summary collapse

RHOST_GROUP_OPTIONS =
%w[RHOSTS RPORT SMBDomain SMBUser SMBPass THREADS]

Instance Attribute Summary

Attributes included from SessionCompatibility

#passive, #session_types

Attributes included from Module::HasActions

#actions, #default_action, #passive, #passive_actions

Instance Method Summary collapse

Methods included from Msf::OptionalSession

#session, #validate, #validate_group, #validate_rhost, #validate_session

Methods included from SessionCompatibility

#check_for_session_readiness, #cleanup, #command_names_for, #compatible_sessions, #meterpreter_session_incompatibility_reasons, #passive?, #post_commands, #session, #session_changed?, #session_compatible?, #session_display_info, #session_incompatibility_reasons, #setup, #sysinfo

Methods included from Post::Common

#clear_screen, #cmd_exec, #cmd_exec_get_pid, #cmd_exec_with_result, #command_exists?, #create_process, #get_env, #get_envs, #peer, #report_virtualization, #rhost, #rport

Methods included from Module::HasActions

#action, #find_action, #passive?, #passive_action?

Methods included from Auxiliary::Report

#active_db?, #create_cracked_credential, #create_credential, #create_credential_and_login, #create_credential_login, #db, #db_warning_given?, #get_client, #get_host, #inside_workspace_boundary?, #invalidate_login, #mytask, #myworkspace, #myworkspace_id, #report_auth_info, #report_client, #report_exploit, #report_host, #report_loot, #report_note, #report_service, #report_vuln, #report_web_form, #report_web_page, #report_web_site, #report_web_vuln, #store_cred, #store_local, #store_loot

Methods included from Metasploit::Framework::Require

optionally, optionally_active_record_railtie, optionally_include_metasploit_credential_creation, #optionally_include_metasploit_credential_creation, optionally_require_metasploit_db_gem_engines

Instance Method Details

#initialize(info = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/msf/core/optional_session/smb.rb', line 10

def initialize(info = {})
  super(
    update_info(
      info,
      'SessionTypes' => %w[smb]
    )
  )

  if optional_session_enabled?
    register_option_group(name: 'SESSION',
                          description: 'Used when connecting via an existing SESSION',
                          option_names: ['SESSION'])
    register_option_group(name: 'RHOST',
                          description: 'Used when making a new connection via RHOSTS',
                          option_names: RHOST_GROUP_OPTIONS,
                          required_options: RHOST_GROUP_OPTIONS)
    register_options(
      [
        Msf::OptInt.new('SESSION', [ false, 'The session to run this module on' ]),
        Msf::Opt::RHOST(nil, false),
        Msf::Opt::RPORT(445, false)
      ]
    )

    add_info('New in Metasploit 6.4 - This module can target a %grnSESSION%clr or an %grnRHOST%clr')
  end
end

#optional_session_enabled?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/msf/core/optional_session/smb.rb', line 38

def optional_session_enabled?
  framework.features.enabled?(Msf::FeatureManager::SMB_SESSION_TYPE)
end