-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ldap modules to support an ldap session
- Loading branch information
Showing
15 changed files
with
317 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Msf | ||
module Exploit | ||
module Remote | ||
module LDAP | ||
class Error < ::StandardError | ||
module Msf::Exploit::Remote::LDAP | ||
|
||
attr_reader :error_code | ||
attr_reader :operation_result | ||
def initialize(message: nil, error_code: nil, operation_result: nil) | ||
super(message || 'LDAP Error') | ||
@error_code = error_code | ||
@operation_result = operation_result | ||
end | ||
end | ||
end | ||
class Error < ::StandardError | ||
|
||
attr_reader :error_code | ||
attr_reader :operation_result | ||
def initialize(message: nil, error_code: nil, operation_result: nil) | ||
super(message || 'LDAP Error') | ||
@error_code = error_code | ||
@operation_result = operation_result | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# frozen_string_literal: true | ||
|
||
module Msf | ||
module OptionalSession | ||
module LDAP | ||
include Msf::OptionalSession | ||
|
||
RHOST_GROUP_OPTIONS = %w[RHOSTS RPORT DOMAIN USERNAME PASSWORD THREADS] | ||
REQUIRED_OPTIONS = %w[RHOSTS RPORT USERNAME PASSWORD THREADS] | ||
|
||
def initialize(info = {}) | ||
super( | ||
update_info( | ||
info, | ||
'SessionTypes' => %w[ldap] | ||
) | ||
) | ||
|
||
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: REQUIRED_OPTIONS) | ||
|
||
register_options( | ||
[ | ||
Msf::OptInt.new('SESSION', [ false, 'The session to run this module on' ]), | ||
Msf::Opt::RHOST(nil, false), | ||
Msf::Opt::RPORT(389, false) | ||
] | ||
) | ||
|
||
add_info('New in Metasploit 6.4 - This module can target a %grnSESSION%clr or an %grnRHOST%clr') | ||
else | ||
register_options( | ||
[ | ||
Msf::Opt::RHOST, | ||
Msf::Opt::RPORT(389), | ||
] | ||
) | ||
end | ||
end | ||
|
||
def optional_session_enabled? | ||
framework.features.enabled?(Msf::FeatureManager::LDAP_SESSION_TYPE) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.