ronin 1.0.0 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +0 -1
- data/ChangeLog.md +67 -3
- data/Gemfile +20 -12
- data/README.md +3 -5
- data/gemspec.yml +5 -5
- data/lib/ronin/address.rb +8 -3
- data/lib/ronin/arch.rb +39 -14
- data/lib/ronin/author.rb +2 -0
- data/lib/ronin/auto_load.rb +67 -0
- data/lib/ronin/campaign.rb +15 -2
- data/lib/ronin/class_methods.rb +7 -1
- data/lib/ronin/config.rb +5 -0
- data/lib/ronin/credential.rb +14 -3
- data/lib/ronin/database/database.rb +38 -12
- data/lib/ronin/database/migrations.rb +3 -1
- data/lib/ronin/database/migrations/add_created_at_column_to_targets_table.rb +48 -0
- data/lib/ronin/database/migrations/add_updated_at_column_to_campaigns_table.rb +47 -0
- data/lib/ronin/database/migrations/create_licenses_table.rb +1 -1
- data/lib/ronin/database/migrations/create_passwords_table.rb +1 -1
- data/lib/ronin/database/migrations/{create_cached_files_table.rb → create_script_paths_table.rb} +4 -4
- data/lib/ronin/database/migrations/migration.rb +3 -6
- data/lib/ronin/database/migrations/migrations.rb +3 -3
- data/lib/ronin/email_address.rb +20 -3
- data/lib/ronin/environment.rb +0 -3
- data/lib/ronin/host_name.rb +20 -6
- data/lib/ronin/host_name_ip_address.rb +2 -3
- data/lib/ronin/installation.rb +92 -23
- data/lib/ronin/ip_address.rb +31 -8
- data/lib/ronin/ip_address_mac_address.rb +2 -3
- data/lib/ronin/license.rb +1 -1
- data/lib/ronin/mac_address.rb +6 -4
- data/lib/ronin/model/class_methods.rb +4 -0
- data/lib/ronin/model/has_authors/class_methods.rb +4 -0
- data/lib/ronin/model/has_authors/has_authors.rb +4 -0
- data/lib/ronin/model/has_description/class_methods.rb +2 -0
- data/lib/ronin/model/has_description/has_description.rb +2 -0
- data/lib/ronin/model/has_license/class_methods.rb +2 -0
- data/lib/ronin/model/has_license/has_license.rb +4 -0
- data/lib/ronin/model/has_name/class_methods.rb +2 -0
- data/lib/ronin/model/has_name/has_name.rb +4 -0
- data/lib/ronin/model/has_title/class_methods.rb +2 -0
- data/lib/ronin/model/has_title/has_title.rb +2 -0
- data/lib/ronin/model/has_unique_name/class_methods.rb +2 -0
- data/lib/ronin/model/has_unique_name/has_unique_name.rb +7 -1
- data/lib/ronin/model/has_version/class_methods.rb +4 -0
- data/lib/ronin/model/has_version/has_version.rb +2 -0
- data/lib/ronin/model/model.rb +2 -0
- data/lib/ronin/model/types.rb +1 -7
- data/lib/ronin/model/types/description.rb +2 -0
- data/lib/ronin/network/mixins/esmtp.rb +40 -25
- data/lib/ronin/network/mixins/http.rb +336 -73
- data/lib/ronin/network/mixins/imap.rb +38 -25
- data/lib/ronin/network/mixins/pop3.rb +34 -21
- data/lib/ronin/network/mixins/smtp.rb +40 -25
- data/lib/ronin/network/mixins/tcp.rb +66 -41
- data/lib/ronin/network/mixins/telnet.rb +43 -30
- data/lib/ronin/network/mixins/udp.rb +59 -40
- data/lib/ronin/open_port.rb +12 -5
- data/lib/ronin/organization.rb +1 -2
- data/lib/ronin/os.rb +10 -3
- data/lib/ronin/os_guess.rb +2 -3
- data/lib/ronin/password.rb +11 -3
- data/lib/ronin/port.rb +7 -2
- data/lib/ronin/{engine/exceptions/deploy_failed.rb → repositories.rb} +4 -6
- data/lib/ronin/repository.rb +110 -37
- data/lib/ronin/ronin.rb +4 -3
- data/lib/ronin/{engine.rb → script.rb} +2 -1
- data/lib/ronin/{engine → script}/buildable.rb +43 -29
- data/lib/ronin/script/class_methods.rb +84 -0
- data/lib/ronin/{engine → script}/deployable.rb +61 -40
- data/lib/ronin/{engine → script}/exceptions.rb +4 -3
- data/lib/ronin/script/exceptions/deploy_failed.rb +27 -0
- data/lib/ronin/{engine/exceptions/not_built.rb → script/exceptions/exception.rb} +2 -2
- data/lib/ronin/{engine/exceptions/verification_failed.rb → script/exceptions/not_built.rb} +4 -2
- data/lib/ronin/script/exceptions/test_failed.rb +27 -0
- data/lib/ronin/script/instance_methods.rb +217 -0
- data/lib/ronin/script/path.rb +277 -0
- data/lib/ronin/{engine/engine.rb → script/script.rb} +52 -15
- data/lib/ronin/{engine/verifiable.rb → script/testable.rb} +97 -68
- data/lib/ronin/service.rb +1 -2
- data/lib/ronin/service_credential.rb +1 -2
- data/lib/ronin/software.rb +3 -2
- data/lib/ronin/spec/database.rb +0 -4
- data/lib/ronin/target.rb +11 -3
- data/lib/ronin/tcp_port.rb +3 -2
- data/lib/ronin/udp_port.rb +2 -0
- data/lib/ronin/ui/cli/cli.rb +6 -0
- data/lib/ronin/ui/cli/command.rb +48 -12
- data/lib/ronin/ui/cli/commands/campaigns.rb +3 -3
- data/lib/ronin/ui/cli/commands/console.rb +2 -1
- data/lib/ronin/ui/cli/commands/creds.rb +3 -3
- data/lib/ronin/ui/cli/commands/database.rb +1 -17
- data/lib/ronin/ui/cli/commands/emails.rb +3 -3
- data/lib/ronin/ui/cli/commands/hosts.rb +3 -7
- data/lib/ronin/ui/cli/commands/ips.rb +3 -7
- data/lib/ronin/ui/cli/commands/repos.rb +5 -17
- data/lib/ronin/ui/cli/commands/urls.rb +3 -3
- data/lib/ronin/ui/cli/model_command.rb +82 -97
- data/lib/ronin/ui/cli/resources_command.rb +89 -0
- data/lib/ronin/ui/cli/script_command.rb +115 -0
- data/lib/ronin/ui/console.rb +17 -3
- data/lib/ronin/ui/output/helpers.rb +18 -0
- data/lib/ronin/ui/output/output.rb +20 -1
- data/lib/ronin/ui/output/terminal/color.rb +10 -0
- data/lib/ronin/ui/output/terminal/raw.rb +10 -0
- data/lib/ronin/ui/shell.rb +2 -0
- data/lib/ronin/url.rb +47 -12
- data/lib/ronin/url_query_param.rb +4 -0
- data/lib/ronin/url_scheme.rb +3 -3
- data/lib/ronin/user_name.rb +2 -0
- data/lib/ronin/version.rb +1 -1
- data/lib/ronin/web_credential.rb +6 -3
- data/spec/arch_spec.rb +3 -3
- data/spec/classes/my_script.rb +21 -0
- data/spec/helpers/repos/{test1 → installed}/ronin.yml +1 -1
- data/spec/helpers/repos/{hello/cache → installed/scripts}/.keep +0 -0
- data/spec/helpers/repos/local/lib/init.rb +1 -0
- data/spec/helpers/repos/{hello → local}/lib/stuff/another_test.rb +0 -0
- data/spec/helpers/repos/{hello → local}/lib/stuff/test.rb +0 -0
- data/spec/helpers/repos/{random → local}/ronin.yml +1 -1
- data/spec/helpers/repos/{random/cache → local/scripts}/.keep +0 -0
- data/spec/helpers/repos/{hello → remote}/ronin.yml +1 -1
- data/spec/helpers/repos/remote/scripts/.keep +0 -0
- data/spec/helpers/repos/{test2 → scripts}/ronin.yml +0 -0
- data/spec/helpers/repos/scripts/scripts/cached/cached.rb +10 -0
- data/spec/helpers/repos/scripts/scripts/cached/missing.rb +10 -0
- data/spec/helpers/repos/scripts/scripts/cached/modified.rb +10 -0
- data/spec/helpers/repos/scripts/scripts/cached/unmodified.rb +10 -0
- data/spec/helpers/repos/scripts/scripts/failures/exceptions.rb +11 -0
- data/spec/helpers/repos/{test2/cache/cacheable_model → scripts/scripts/failures}/load_errors.rb +3 -1
- data/spec/helpers/repos/{test2/cache/cacheable_model → scripts/scripts/failures}/name_errors.rb +1 -0
- data/spec/helpers/repos/scripts/scripts/failures/no_method_errors.rb +10 -0
- data/spec/helpers/repos/scripts/scripts/failures/syntax_errors.rb +11 -0
- data/spec/helpers/repos/scripts/scripts/failures/validation_errors.rb +11 -0
- data/spec/helpers/repos/scripts/scripts/my_scripts/test.rb +16 -0
- data/spec/model/spec_helper.rb +0 -2
- data/spec/repository_spec.rb +61 -81
- data/spec/ronin_spec.rb +2 -2
- data/spec/{engine → script}/buildable_spec.rb +9 -9
- data/spec/script/classes/buildable_class.rb +15 -0
- data/spec/script/classes/deployable_class.rb +13 -0
- data/spec/{engine/classes/engine_class.rb → script/classes/script_class.rb} +3 -3
- data/spec/{engine/classes/verifiable_class.rb → script/classes/testable_class.rb} +5 -5
- data/spec/{engine → script}/deployable_spec.rb +10 -10
- data/spec/{cached_file_spec.rb → script/path_spec.rb} +33 -72
- data/spec/script/script_spec.rb +130 -0
- data/spec/script/testable_spec.rb +117 -0
- data/spec/spec_helper.rb +15 -13
- metadata +114 -139
- data/lib/ronin/cached_file.rb +0 -247
- data/lib/ronin/engine/class_methods.rb +0 -135
- data/lib/ronin/engine/instance_methods.rb +0 -97
- data/lib/ronin/model/cacheable.rb +0 -21
- data/lib/ronin/model/cacheable/cacheable.rb +0 -273
- data/lib/ronin/model/cacheable/class_methods.rb +0 -60
- data/lib/ronin/ui/cli/engine_command.rb +0 -106
- data/spec/engine/classes/buildable_class.rb +0 -15
- data/spec/engine/classes/deployable_class.rb +0 -13
- data/spec/engine/engine_spec.rb +0 -55
- data/spec/engine/verifiable_spec.rb +0 -117
- data/spec/helpers/repos/hello/lib/init.rb +0 -1
- data/spec/helpers/repos/test1/cache/cacheable_model/one.rb +0 -15
- data/spec/helpers/repos/test2/cache/cacheable_model/exceptions.rb +0 -7
- data/spec/helpers/repos/test2/cache/cacheable_model/no_method_errors.rb +0 -9
- data/spec/helpers/repos/test2/cache/cacheable_model/syntax_errors.rb +0 -7
- data/spec/helpers/repos/test2/cache/cacheable_model/two.rb +0 -15
- data/spec/helpers/repos/test2/cache/cacheable_model/validation_errors.rb +0 -9
- data/spec/model/cacheable_spec.rb +0 -96
- data/spec/model/models/cacheable_model.rb +0 -13
data/spec/engine/engine_spec.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/engine'
|
3
|
-
require 'engine/classes/engine_class'
|
4
|
-
|
5
|
-
describe Engine do
|
6
|
-
subject { EngineClass }
|
7
|
-
|
8
|
-
it "should be a Model" do
|
9
|
-
subject.included_modules.should include(Model)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should have a name" do
|
13
|
-
subject.included_modules.should include(Model::HasName)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should have a description" do
|
17
|
-
subject.included_modules.should include(Model::HasDescription)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should have a version" do
|
21
|
-
subject.included_modules.should include(Model::HasVersion)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should include Model::Cacheable" do
|
25
|
-
subject.included_modules.should include(Model::Cacheable)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should include Parameters" do
|
29
|
-
subject.included_modules.should include(Parameters)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should initialize attributes" do
|
33
|
-
resource = subject.new(:name => 'test')
|
34
|
-
|
35
|
-
resource.name.should == 'test'
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should initialize parameters" do
|
39
|
-
resource = subject.new(:x => 5)
|
40
|
-
|
41
|
-
resource.x.should == 5
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should allow custom initialize methods" do
|
45
|
-
resource = subject.new
|
46
|
-
|
47
|
-
resource.y.should == 2
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should have an engine-name" do
|
51
|
-
resource = subject.new
|
52
|
-
|
53
|
-
resource.engine_name.should == 'EngineClass'
|
54
|
-
end
|
55
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/engine/verifiable'
|
3
|
-
require 'engine/classes/verifiable_class'
|
4
|
-
|
5
|
-
describe Engine::Verifiable do
|
6
|
-
subject { VerifiableClass }
|
7
|
-
|
8
|
-
it "should allow for custom verifications" do
|
9
|
-
obj = subject.new do
|
10
|
-
verify do
|
11
|
-
flunk('var must be greater than 2') unless self.var > 2
|
12
|
-
end
|
13
|
-
|
14
|
-
verify do
|
15
|
-
flunk('var must be less than 10') unless self.var < 10
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
obj.var = 20
|
20
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
21
|
-
|
22
|
-
obj.var = 4
|
23
|
-
obj.verify!.should == true
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should verify an expression is true" do
|
27
|
-
obj = subject.new do
|
28
|
-
verify? 'var + 2 must equal 4' do
|
29
|
-
(self.var + 2) == 4
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
obj.var = 1
|
34
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
35
|
-
|
36
|
-
obj.var = 2
|
37
|
-
obj.verify!.should == true
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should verify a method returns an expected value" do
|
41
|
-
obj = subject.new { verify_equal :var, 5 }
|
42
|
-
|
43
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
44
|
-
|
45
|
-
obj.var = 5
|
46
|
-
obj.verify!.should == true
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should verify a method does not return an expected value" do
|
50
|
-
obj = subject.new { verify_not_equal :var, 5 }
|
51
|
-
|
52
|
-
obj.var = 5
|
53
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
54
|
-
|
55
|
-
obj.var = 2
|
56
|
-
obj.verify!.should == true
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should verify a method returns a non-nil value" do
|
60
|
-
obj = subject.new { verify_set :var }
|
61
|
-
|
62
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
63
|
-
|
64
|
-
obj.var = 2
|
65
|
-
obj.verify!.should == true
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should verify a method returns a non-empty value" do
|
69
|
-
obj = subject.new { verify_set :var }
|
70
|
-
|
71
|
-
obj.var = ''
|
72
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
73
|
-
|
74
|
-
obj.var = 'hello'
|
75
|
-
obj.verify!.should == true
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should verify a method matches a pattern" do
|
79
|
-
obj = subject.new { verify_match :var, /lo/ }
|
80
|
-
|
81
|
-
obj.var = 'goodbye'
|
82
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
83
|
-
|
84
|
-
obj.var = 'hello'
|
85
|
-
obj.verify!.should == true
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should verify a method does not match a pattern" do
|
89
|
-
obj = subject.new { verify_no_match :var, /lo/ }
|
90
|
-
|
91
|
-
obj.var = 'hello'
|
92
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
93
|
-
|
94
|
-
obj.var = 'goodbye'
|
95
|
-
obj.verify!.should == true
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should verify a method returns a value in a set of values" do
|
99
|
-
obj = subject.new { verify_in :var, [0, 2, 4, 8] }
|
100
|
-
|
101
|
-
obj.var = 3
|
102
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
103
|
-
|
104
|
-
obj.var = 2
|
105
|
-
obj.verify!.should == true
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should verify a method returns a value not in a set of values" do
|
109
|
-
obj = subject.new { verify_not_in :var, [0, 2, 4, 8] }
|
110
|
-
|
111
|
-
obj.var = 2
|
112
|
-
lambda { obj.verify! }.should raise_error(Engine::VerificationFailed)
|
113
|
-
|
114
|
-
obj.var = 3
|
115
|
-
obj.verify!.should == true
|
116
|
-
end
|
117
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
$hello_repo_loaded = true
|
@@ -1,96 +0,0 @@
|
|
1
|
-
require 'model/spec_helper'
|
2
|
-
require 'model/models/cacheable_model'
|
3
|
-
require 'helpers/repositories'
|
4
|
-
|
5
|
-
require 'ronin/model/cacheable'
|
6
|
-
|
7
|
-
describe Model::Cacheable do
|
8
|
-
include Helpers::Repositories
|
9
|
-
|
10
|
-
let(:repo) { repository('test1') }
|
11
|
-
|
12
|
-
subject { CacheableModel }
|
13
|
-
|
14
|
-
before(:all) { repo.cache_files! }
|
15
|
-
|
16
|
-
it "should include Ronin::Model" do
|
17
|
-
subject.ancestors.should include(Model)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should add the type property to the model" do
|
21
|
-
subject.properties.should be_named(:type)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should add a relation between CachedFile and the model" do
|
25
|
-
subject.relationships.should be_named(:cached_file)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should add the class to Cacheable.models" do
|
29
|
-
Model::Cacheable.models.should include(subject)
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "load_from" do
|
33
|
-
let(:path) { repo.cached_files.first.path }
|
34
|
-
|
35
|
-
subject { Model::Cacheable.load_from(path) }
|
36
|
-
|
37
|
-
it "should have a cached_file resource" do
|
38
|
-
subject.cached_file.should_not be_nil
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should have a cache_path" do
|
42
|
-
subject.cache_path.should == path
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should prepare the object to be cached" do
|
46
|
-
subject.content.should == 'this is test one'
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should preserve instance variables" do
|
50
|
-
subject.var.should == 1
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should preserve instance methods" do
|
54
|
-
subject.greeting.should == 'hello'
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should load the original code" do
|
58
|
-
subject.should be_original_loaded
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "previously cached" do
|
63
|
-
subject { CacheableModel.first }
|
64
|
-
|
65
|
-
it "should have a cached_file resource" do
|
66
|
-
subject.cached_file.should_not be_nil
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should have a cache_path" do
|
70
|
-
subject.cache_path.should be_file
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should load the context block" do
|
74
|
-
subject.class.load_context_block(subject.cache_path).should_not be_nil
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should be able to load the original object" do
|
78
|
-
subject.load_original!
|
79
|
-
|
80
|
-
subject.greeting.should == 'hello'
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should load the original object on demand" do
|
84
|
-
subject.greeting.should == 'hello'
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should only load the original object once" do
|
88
|
-
subject.load_original!
|
89
|
-
|
90
|
-
subject.var = false
|
91
|
-
subject.load_original!
|
92
|
-
|
93
|
-
subject.var.should == false
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|