metasploit-model 0.26.1-java → 0.27.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/metasploit/model/association/reflection.rb +3 -0
- data/app/models/metasploit/model/module/ancestor/spec/template.rb +3 -0
- data/app/models/metasploit/model/module/class/spec/template.rb +4 -0
- data/app/models/metasploit/model/module/instance/spec/template.rb +4 -0
- data/app/models/metasploit/model/search/group/base.rb +3 -0
- data/app/models/metasploit/model/search/group/intersection.rb +2 -0
- data/app/models/metasploit/model/search/group/union.rb +2 -0
- data/app/models/metasploit/model/search/operation/association.rb +2 -0
- data/app/models/metasploit/model/search/operation/base.rb +3 -0
- data/app/models/metasploit/model/search/operation/boolean.rb +2 -0
- data/app/models/metasploit/model/search/operation/date.rb +2 -0
- data/app/models/metasploit/model/search/operation/group/base.rb +2 -0
- data/app/models/metasploit/model/search/operation/group/intersection.rb +2 -0
- data/app/models/metasploit/model/search/operation/group/union.rb +2 -0
- data/app/models/metasploit/model/search/operation/integer.rb +4 -0
- data/app/models/metasploit/model/search/operation/null.rb +2 -0
- data/app/models/metasploit/model/search/operation/set.rb +2 -0
- data/app/models/metasploit/model/search/operation/set/integer.rb +2 -0
- data/app/models/metasploit/model/search/operation/set/string.rb +2 -0
- data/app/models/metasploit/model/search/operation/string.rb +4 -0
- data/app/models/metasploit/model/search/operator/association.rb +2 -0
- data/app/models/metasploit/model/search/operator/attribute.rb +2 -0
- data/app/models/metasploit/model/search/operator/base.rb +4 -0
- data/app/models/metasploit/model/search/operator/delegation.rb +2 -0
- data/app/models/metasploit/model/search/operator/deprecated/app.rb +2 -0
- data/app/models/metasploit/model/search/operator/deprecated/author.rb +2 -0
- data/app/models/metasploit/model/search/operator/deprecated/authority.rb +2 -0
- data/app/models/metasploit/model/search/operator/deprecated/platform.rb +2 -0
- data/app/models/metasploit/model/search/operator/deprecated/ref.rb +2 -0
- data/app/models/metasploit/model/search/operator/deprecated/text.rb +2 -0
- data/app/models/metasploit/model/search/operator/group/base.rb +2 -0
- data/app/models/metasploit/model/search/operator/group/intersection.rb +2 -0
- data/app/models/metasploit/model/search/operator/group/union.rb +2 -0
- data/app/models/metasploit/model/search/operator/null.rb +2 -0
- data/app/models/metasploit/model/search/operator/single.rb +2 -0
- data/app/models/metasploit/model/search/query.rb +3 -0
- data/app/models/metasploit/model/spec/template.rb +9 -2
- data/app/models/metasploit/model/visitation/visitor.rb +3 -0
- data/lib/metasploit/model.rb +24 -15
- data/lib/metasploit/model/architecture.rb +2 -0
- data/lib/metasploit/model/association.rb +4 -0
- data/lib/metasploit/model/author.rb +2 -0
- data/lib/metasploit/model/authority.rb +14 -0
- data/lib/metasploit/model/authority/bid.rb +2 -0
- data/lib/metasploit/model/authority/cve.rb +2 -0
- data/lib/metasploit/model/authority/msb.rb +2 -0
- data/lib/metasploit/model/authority/osvdb.rb +2 -0
- data/lib/metasploit/model/authority/pmasa.rb +2 -0
- data/lib/metasploit/model/authority/secunia.rb +2 -0
- data/lib/metasploit/model/authority/us_cert_vu.rb +2 -0
- data/lib/metasploit/model/authority/waraxe.rb +2 -0
- data/lib/metasploit/model/authority/zdi.rb +2 -0
- data/lib/metasploit/model/base.rb +2 -0
- data/lib/metasploit/model/derivation.rb +4 -1
- data/lib/metasploit/model/email_address.rb +2 -0
- data/lib/metasploit/model/engine.rb +21 -27
- data/lib/metasploit/model/invalid.rb +2 -0
- data/lib/metasploit/model/login.rb +10 -0
- data/lib/metasploit/model/login/status.rb +2 -0
- data/lib/metasploit/model/module.rb +16 -0
- data/lib/metasploit/model/module/action.rb +2 -0
- data/lib/metasploit/model/module/ancestor.rb +6 -0
- data/lib/metasploit/model/module/ancestor/spec.rb +5 -0
- data/lib/metasploit/model/module/architecture.rb +2 -0
- data/lib/metasploit/model/module/author.rb +2 -0
- data/lib/metasploit/model/module/class.rb +5 -0
- data/lib/metasploit/model/module/class/spec.rb +5 -0
- data/lib/metasploit/model/module/instance.rb +6 -0
- data/lib/metasploit/model/module/instance/spec.rb +5 -0
- data/lib/metasploit/model/module/path.rb +3 -0
- data/lib/metasploit/model/module/platform.rb +2 -0
- data/lib/metasploit/model/module/rank.rb +2 -0
- data/lib/metasploit/model/module/reference.rb +2 -0
- data/lib/metasploit/model/module/target.rb +6 -0
- data/lib/metasploit/model/module/target/architecture.rb +2 -0
- data/lib/metasploit/model/module/target/platform.rb +2 -0
- data/lib/metasploit/model/platform.rb +2 -0
- data/lib/metasploit/model/real_pathname.rb +2 -0
- data/lib/metasploit/model/realm.rb +9 -0
- data/lib/metasploit/model/realm/key.rb +2 -0
- data/lib/metasploit/model/reference.rb +2 -0
- data/lib/metasploit/model/search.rb +9 -0
- data/lib/metasploit/model/search/attribute.rb +2 -0
- data/lib/metasploit/model/search/group.rb +6 -0
- data/lib/metasploit/model/search/operation.rb +4 -0
- data/lib/metasploit/model/search/operation/group.rb +5 -0
- data/lib/metasploit/model/search/operator.rb +4 -0
- data/lib/metasploit/model/search/operator/deprecated.rb +6 -0
- data/lib/metasploit/model/search/operator/group.rb +5 -0
- data/lib/metasploit/model/spec.rb +7 -0
- data/lib/metasploit/model/spec/i18n_exception_handler.rb +2 -0
- data/lib/metasploit/model/spec/pathname_collision.rb +2 -0
- data/lib/metasploit/model/spec/template/write.rb +2 -0
- data/lib/metasploit/model/spec/temporary_pathname.rb +3 -0
- data/lib/metasploit/model/translation.rb +2 -0
- data/lib/metasploit/model/version.rb +2 -2
- data/lib/metasploit/model/visitation.rb +2 -0
- data/metasploit-model.gemspec +1 -0
- data/spec/app/models/metasploit/model/module/ancestor/spec/template_spec.rb +1 -1
- data/spec/lib/metasploit/model/engine_spec.rb +1 -1
- data/spec/lib/metasploit/model/login/status_spec.rb +83 -0
- data/spec/lib/metasploit/model/spec_spec.rb +3 -3
- data/spec/spec_helper.rb +4 -6
- metadata +28 -28
- data/lib/metasploit/model/configuration.rb +0 -72
- data/lib/metasploit/model/configuration/autoload.rb +0 -109
- data/lib/metasploit/model/configuration/child.rb +0 -12
- data/lib/metasploit/model/configuration/error.rb +0 -4
- data/lib/metasploit/model/configuration/i18n.rb +0 -54
- data/lib/metasploit/model/configuration/parent.rb +0 -50
- data/lib/metasploit/model/configured.rb +0 -46
- data/spec/lib/metasploit/model/configuration/autoload_spec.rb +0 -165
- data/spec/lib/metasploit/model/configuration/child_spec.rb +0 -24
- data/spec/lib/metasploit/model/configuration/error_spec.rb +0 -5
- data/spec/lib/metasploit/model/configuration/i18n_spec.rb +0 -103
- data/spec/lib/metasploit/model/configuration_spec.rb +0 -106
- data/spec/lib/metasploit/model/configured_spec.rb +0 -41
- data/spec/lib/metasploit/model_spec.rb +0 -68
- data/spec/support/shared/contexts/metasploit/model/configuration.rb +0 -11
- data/spec/support/shared/examples/metasploit/model/configuration/parent/child.rb +0 -60
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Metasploit::Model::Configuration::Child do
|
4
|
-
subject(:child) do
|
5
|
-
described_class.new
|
6
|
-
end
|
7
|
-
|
8
|
-
context '#configuration' do
|
9
|
-
subject(:configuration) do
|
10
|
-
child.configuration
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'default' do
|
14
|
-
it { should be_nil }
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should be settable' do
|
18
|
-
expected_configuration = double('Configuration')
|
19
|
-
child.configuration = expected_configuration
|
20
|
-
|
21
|
-
expect(child.configuration).to eq expected_configuration
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Metasploit::Model::Configuration::I18n do
|
4
|
-
include_context 'Metasploit::Model::Configuration'
|
5
|
-
|
6
|
-
let(:i18n) do
|
7
|
-
described_class.new.tap { |i18n|
|
8
|
-
i18n.configuration = configuration
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
context '#directories' do
|
13
|
-
subject(:directories) do
|
14
|
-
i18n.directories
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should use configuration.root to convert #relative_directories to absolute paths' do
|
18
|
-
relative_directories = [
|
19
|
-
'foo/bar'
|
20
|
-
]
|
21
|
-
|
22
|
-
i18n.stub(relative_directories: relative_directories)
|
23
|
-
|
24
|
-
directories.should == [Metasploit::Model.root.join('spec', 'dummy', 'foo', 'bar').to_path]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context '#paths' do
|
29
|
-
subject(:paths) do
|
30
|
-
i18n.paths
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should be a flat Array' do
|
34
|
-
nested_array = ['a', 'b']
|
35
|
-
Dir.stub(:glob).and_return(nested_array)
|
36
|
-
i18n.stub(directories: ['d1', 'd2'])
|
37
|
-
|
38
|
-
expect(paths).to match_array(nested_array + nested_array)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should look for yml files' do
|
42
|
-
Dir.should_receive(:glob) do |glob|
|
43
|
-
glob.should end_with('*.yml')
|
44
|
-
end
|
45
|
-
|
46
|
-
paths
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context '#relative_directories' do
|
51
|
-
subject(:relative_directories) do
|
52
|
-
i18n.relative_directories
|
53
|
-
end
|
54
|
-
|
55
|
-
it { should include('config/locales') }
|
56
|
-
end
|
57
|
-
|
58
|
-
context '#setup' do
|
59
|
-
subject(:setup) do
|
60
|
-
i18n.setup
|
61
|
-
end
|
62
|
-
|
63
|
-
let(:path) do
|
64
|
-
Metasploit::Model.root.join('spec', 'dummy', 'config', 'locales', 'en.yml').to_path
|
65
|
-
end
|
66
|
-
|
67
|
-
let(:paths) do
|
68
|
-
[
|
69
|
-
path
|
70
|
-
]
|
71
|
-
end
|
72
|
-
|
73
|
-
before(:each) do
|
74
|
-
@before_i18n_load_path = ::I18n.load_path
|
75
|
-
|
76
|
-
i18n.stub(paths: paths)
|
77
|
-
end
|
78
|
-
|
79
|
-
after(:each) do
|
80
|
-
::I18n.load_path = @before_i18n_load_path
|
81
|
-
end
|
82
|
-
|
83
|
-
context 'with in I18n.load_path already' do
|
84
|
-
before(:each) do
|
85
|
-
::I18n.load_path << path
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'should not add path to I18n.load_path' do
|
89
|
-
expect {
|
90
|
-
setup
|
91
|
-
}.to_not change(::I18n, :load_path)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context 'without in I18n.load_path already' do
|
96
|
-
it 'should add path to I18n.load_path' do
|
97
|
-
setup
|
98
|
-
|
99
|
-
::I18n.load_path.should include(path)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Metasploit::Model::Configuration do
|
4
|
-
include_context 'Metasploit::Model::Configuration'
|
5
|
-
|
6
|
-
subject do
|
7
|
-
configuration
|
8
|
-
end
|
9
|
-
|
10
|
-
it_should_behave_like 'Metasploit::Model::Configuration::Parent#child',
|
11
|
-
:autoload,
|
12
|
-
class: Metasploit::Model::Configuration::Autoload
|
13
|
-
|
14
|
-
it_should_behave_like 'Metasploit::Model::Configuration::Parent#child',
|
15
|
-
:i18n,
|
16
|
-
class: Metasploit::Model::Configuration::I18n
|
17
|
-
|
18
|
-
context '#root' do
|
19
|
-
subject(:root) do
|
20
|
-
configuration.root
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:configuration) do
|
24
|
-
described_class.new
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'with setting first' do
|
28
|
-
#
|
29
|
-
# lets
|
30
|
-
#
|
31
|
-
|
32
|
-
let(:expected_root_pathname) do
|
33
|
-
Metasploit::Model.root.join('spec', 'dummy')
|
34
|
-
end
|
35
|
-
|
36
|
-
#
|
37
|
-
# Callbacks
|
38
|
-
#
|
39
|
-
|
40
|
-
before(:each) do
|
41
|
-
configuration.root = expected_root
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with Pathname' do
|
45
|
-
let(:expected_root) do
|
46
|
-
expected_root_pathname
|
47
|
-
end
|
48
|
-
|
49
|
-
it { should be_a Pathname }
|
50
|
-
|
51
|
-
it 'should return set Pathname' do
|
52
|
-
root.should == expected_root
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'with String' do
|
57
|
-
let(:expected_root) do
|
58
|
-
expected_root_pathname.to_s
|
59
|
-
end
|
60
|
-
|
61
|
-
it { should be_a Pathname }
|
62
|
-
|
63
|
-
it 'should return String as Pathname' do
|
64
|
-
root.should == expected_root_pathname
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'without setting first' do
|
70
|
-
specify {
|
71
|
-
expect {
|
72
|
-
root
|
73
|
-
}.to raise_error Metasploit::Model::Configuration::Error
|
74
|
-
}
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
context '#setup' do
|
79
|
-
subject(:setup) do
|
80
|
-
configuration.setup
|
81
|
-
end
|
82
|
-
|
83
|
-
before(:each) do
|
84
|
-
@before_autoload_paths = ActiveSupport::Dependencies.autoload_paths.dup
|
85
|
-
ActiveSupport::Dependencies.autoload_paths.clear
|
86
|
-
|
87
|
-
@before_autoload_once_paths = ActiveSupport::Dependencies.autoload_once_paths.dup
|
88
|
-
ActiveSupport::Dependencies.autoload_once_paths.clear
|
89
|
-
|
90
|
-
@before_i18n_load_path = ::I18n.load_path
|
91
|
-
end
|
92
|
-
|
93
|
-
after(:each) do
|
94
|
-
ActiveSupport::Dependencies.autoload_paths = @before_autoload_paths
|
95
|
-
ActiveSupport::Dependencies.autoload_once_paths = @before_autoload_once_paths
|
96
|
-
|
97
|
-
::I18n.load_path = @before_i18n_load_path
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'should setup autoload' do
|
101
|
-
configuration.autoload.should_receive(:setup)
|
102
|
-
|
103
|
-
setup
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Metasploit::Model::Configured do
|
4
|
-
subject(:configured) do
|
5
|
-
Module.new.tap { |m|
|
6
|
-
m.extend described_class
|
7
|
-
}
|
8
|
-
end
|
9
|
-
|
10
|
-
context 'configuration' do
|
11
|
-
subject(:configuration) do
|
12
|
-
configured.configuration
|
13
|
-
end
|
14
|
-
|
15
|
-
it { should be_a Metasploit::Model::Configuration }
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'root' do
|
19
|
-
subject(:root) do
|
20
|
-
configured.root
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should delegate to configuration' do
|
24
|
-
configured.configuration.should_receive(:root)
|
25
|
-
|
26
|
-
root
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'setup' do
|
31
|
-
subject(:setup) do
|
32
|
-
configured.setup
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should delegate to configuration' do
|
36
|
-
configured.configuration.should_receive(:setup)
|
37
|
-
|
38
|
-
setup
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Metasploit::Model do
|
4
|
-
let(:root_pathname) do
|
5
|
-
spec_lib_metasploit_pathname = Pathname.new(__FILE__).parent
|
6
|
-
spec_lib_pathname = spec_lib_metasploit_pathname.parent
|
7
|
-
spec_pathname = spec_lib_pathname.parent
|
8
|
-
|
9
|
-
spec_pathname.parent
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should extend Metasploit::Model::Configured' do
|
13
|
-
described_class.singleton_class.should include Metasploit::Model::Configured
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'configuration' do
|
17
|
-
subject(:configuration) do
|
18
|
-
described_class.configuration
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'autoload' do
|
22
|
-
subject(:autoload) do
|
23
|
-
configuration.autoload
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'once_paths' do
|
27
|
-
subject(:once_paths) do
|
28
|
-
autoload.once_paths
|
29
|
-
end
|
30
|
-
|
31
|
-
it { should include root_pathname.join('lib').to_path }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'paths' do
|
35
|
-
subject(:paths) do
|
36
|
-
autoload.paths
|
37
|
-
end
|
38
|
-
|
39
|
-
it { should include root_pathname.join('app', 'models').to_path }
|
40
|
-
it { should include root_pathname.join('app', 'validators').to_path }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'i18n' do
|
45
|
-
subject(:i18n) do
|
46
|
-
configuration.i18n
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'paths' do
|
50
|
-
subject(:paths) do
|
51
|
-
i18n.paths
|
52
|
-
end
|
53
|
-
|
54
|
-
it { should include root_pathname.join('config', 'locales', 'en.yml').to_path }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'root' do
|
60
|
-
subject(:root) do
|
61
|
-
described_class.root
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should be top-level directory of metasploit-model project' do
|
65
|
-
root.should == root_pathname
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
shared_examples_for 'Metasploit::Model::Configuration::Parent#child' do |name, options={}|
|
2
|
-
options.assert_valid_keys(:class)
|
3
|
-
|
4
|
-
klass = options.fetch(:class)
|
5
|
-
class_attribute_name = "#{name}_class"
|
6
|
-
|
7
|
-
context "##{name}" do
|
8
|
-
subject(:child) do
|
9
|
-
configuration.send(name)
|
10
|
-
end
|
11
|
-
|
12
|
-
context "with default ##{class_attribute_name}" do
|
13
|
-
it { should be_a klass }
|
14
|
-
end
|
15
|
-
|
16
|
-
context "without default ##{class_attribute_name}" do
|
17
|
-
#
|
18
|
-
# lets
|
19
|
-
#
|
20
|
-
|
21
|
-
let(:non_default_class) do
|
22
|
-
Class.new do
|
23
|
-
attr_accessor :configuration
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
#
|
28
|
-
# Callbacks
|
29
|
-
#
|
30
|
-
|
31
|
-
before(:each) do
|
32
|
-
configuration.send("#{class_attribute_name}=", non_default_class)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "is instance of ##{class_attribute_name}" do
|
36
|
-
expect(child).to be_a non_default_class
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context '#configuration' do
|
41
|
-
subject(:child_configuration) do
|
42
|
-
child.configuration
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'is this configuration' do
|
46
|
-
expect(child_configuration).to eq(configuration)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "#{class_attribute_name}" do
|
52
|
-
subject(:child_class) do
|
53
|
-
configuration.send(class_attribute_name)
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'default' do
|
57
|
-
it { should be klass }
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|