Skip to content

Commit

Permalink
allow a Wildcard Realm Type
Browse files Browse the repository at this point in the history
  • Loading branch information
David Maloney authored and David Maloney committed Sep 18, 2014
1 parent 0eb1525 commit ea3f879
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
21 changes: 13 additions & 8 deletions lib/metasploit/model/realm/key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,25 @@ module Metasploit::Model::Realm::Key
# database and does not allow authenticating to just a server (which would be an `Mdm::Service`).
POSTGRESQL_DATABASE = 'PostgreSQL Database'

# This is a Wildcard Realm Type which indicates we don't know or care what type of Realm it is.
WILDCARD = '*'

# All values that are valid for {Metasploit::Credential::Realm#key}.
ALL = [
ACTIVE_DIRECTORY_DOMAIN,
DB2_DATABASE,
ORACLE_SYSTEM_IDENTIFIER,
POSTGRESQL_DATABASE
ACTIVE_DIRECTORY_DOMAIN,
DB2_DATABASE,
ORACLE_SYSTEM_IDENTIFIER,
POSTGRESQL_DATABASE,
WILDCARD
]

# A map of short names, suitable for use on the command line, to the
# full human-readable constants above.
SHORT_NAMES = {
'domain' => ACTIVE_DIRECTORY_DOMAIN,
'db2db' => DB2_DATABASE,
'sid' => ORACLE_SYSTEM_IDENTIFIER,
'pgdb' => POSTGRESQL_DATABASE,
'domain' => ACTIVE_DIRECTORY_DOMAIN,
'db2db' => DB2_DATABASE,
'sid' => ORACLE_SYSTEM_IDENTIFIER,
'pgdb' => POSTGRESQL_DATABASE,
'wildcard' => WILDCARD
}
end
4 changes: 3 additions & 1 deletion lib/metasploit/model/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ module Version
# The minor version number, scoped to the {MAJOR} version number.
MINOR = 27
# The patch number, scoped to the {MINOR} version number.
PATCH = 1
PATCH = 2

PRERELEASE = 'wildcard-realm-type'

# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
Expand Down
10 changes: 10 additions & 0 deletions spec/lib/metasploit/model/realm/key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
it { should include described_class::ACTIVE_DIRECTORY_DOMAIN }
it { should include described_class::ORACLE_SYSTEM_IDENTIFIER }
it { should include described_class::POSTGRESQL_DATABASE }
it { should include described_class::WILDCARD }
end

context 'ORACLE_SYSTEM_IDENTIFIER' do
Expand All @@ -39,6 +40,15 @@
it { should be_in described_class::ALL }
end

context 'WILDCARD' do
subject(:wildcard) do
described_class::WILDCARD
end

it { should == '*' }
it { should be_in described_class::ALL }
end

context 'SHORT_NAMES' do
subject { described_class::SHORT_NAMES }
it 'should have String keys' do
Expand Down

0 comments on commit ea3f879

Please sign in to comment.