From 09b4e2cde91a9fed8156989c69f594626226be39 Mon Sep 17 00:00:00 2001 From: cgranleese-r7 Date: Tue, 6 Feb 2024 15:06:25 +0000 Subject: [PATCH] Move CreateSession from advanced into basic options --- lib/msf/base/sessions/command_shell_options.rb | 7 ++++++- modules/auxiliary/scanner/mssql/mssql_login.rb | 3 ++- modules/auxiliary/scanner/mysql/mysql_login.rb | 3 ++- modules/auxiliary/scanner/postgres/postgres_login.rb | 1 + modules/auxiliary/scanner/smb/smb_login.rb | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/msf/base/sessions/command_shell_options.rb b/lib/msf/base/sessions/command_shell_options.rb index 440f938ce8b2f..f5a48336f036b 100644 --- a/lib/msf/base/sessions/command_shell_options.rb +++ b/lib/msf/base/sessions/command_shell_options.rb @@ -15,9 +15,14 @@ module CommandShellOptions def initialize(info = {}) super(info) + register_options( + [ + OptBool.new('CreateSession', [false, 'Create a new session for every successful login', true]) + ] + ) + register_advanced_options( [ - OptBool.new('CreateSession', [false, 'Create a new session for every successful login', true]), OptString.new('InitialAutoRunScript', "An initial script to run on session creation (before AutoRunScript)"), OptString.new('AutoRunScript', "A script to run automatically on session creation."), OptString.new('CommandShellCleanupCommand', "A command to run before the session is closed"), diff --git a/modules/auxiliary/scanner/mssql/mssql_login.rb b/modules/auxiliary/scanner/mssql/mssql_login.rb index 4ba590d2ea000..008b5b1f9aa31 100644 --- a/modules/auxiliary/scanner/mssql/mssql_login.rb +++ b/modules/auxiliary/scanner/mssql/mssql_login.rb @@ -11,7 +11,7 @@ class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::MSSQL include Msf::Auxiliary::Report include Msf::Auxiliary::AuthBrute - + include Msf::Auxiliary::CommandShell include Msf::Auxiliary::Scanner def initialize @@ -33,6 +33,7 @@ def initialize ) register_options([ OptBool.new('TDSENCRYPTION', [ true, 'Use TLS/SSL for TDS data "Force Encryption"', true]), + OptBool.new('CreateSession', [false, 'Create a new session for every successful login', false]) ]) deregister_options('PASSWORD_SPRAY') diff --git a/modules/auxiliary/scanner/mysql/mysql_login.rb b/modules/auxiliary/scanner/mysql/mysql_login.rb index 1f599cc6a2f35..0801d13a0a299 100644 --- a/modules/auxiliary/scanner/mysql/mysql_login.rb +++ b/modules/auxiliary/scanner/mysql/mysql_login.rb @@ -33,7 +33,8 @@ def initialize(info = {}) register_options( [ - Opt::Proxies + Opt::Proxies, + OptBool.new('CreateSession', [false, 'Create a new session for every successful login', false]) ]) options_to_deregister = %w[PASSWORD_SPRAY] diff --git a/modules/auxiliary/scanner/postgres/postgres_login.rb b/modules/auxiliary/scanner/postgres/postgres_login.rb index 3936347f90bd6..60f6dc0050815 100644 --- a/modules/auxiliary/scanner/postgres/postgres_login.rb +++ b/modules/auxiliary/scanner/postgres/postgres_login.rb @@ -37,6 +37,7 @@ def initialize(info = {}) register_options( [ Opt::Proxies, + OptBool.new('CreateSession', [false, 'Create a new session for every successful login', false]), OptPath.new('USERPASS_FILE', [ false, "File containing (space-separated) users and passwords, one pair per line", File.join(Msf::Config.data_directory, "wordlists", "postgres_default_userpass.txt") ]), OptPath.new('USER_FILE', [ false, "File containing users, one per line", diff --git a/modules/auxiliary/scanner/smb/smb_login.rb b/modules/auxiliary/scanner/smb/smb_login.rb index 0242568230a16..64c9adc34cf56 100644 --- a/modules/auxiliary/scanner/smb/smb_login.rb +++ b/modules/auxiliary/scanner/smb/smb_login.rb @@ -55,6 +55,7 @@ def initialize register_options( [ Opt::Proxies, + OptBool.new('CreateSession', [false, 'Create a new session for every successful login', false]), OptBool.new('ABORT_ON_LOCKOUT', [ true, 'Abort the run when an account lockout is detected', false ]), OptBool.new('PRESERVE_DOMAINS', [ false, 'Respect a username that contains a domain name.', true ]), OptBool.new('RECORD_GUEST', [ false, 'Record guest-privileged random logins to the database', false ]),