ronin 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.editorconfig +11 -0
- data/.github/workflows/ruby.yml +32 -0
- data/.gitignore +7 -7
- data/.ruby-version +1 -0
- data/COPYING.txt +3 -3
- data/ChangeLog.md +25 -11
- data/Gemfile +21 -20
- data/README.md +102 -81
- data/Rakefile +4 -5
- data/bin/ronin +7 -12
- data/bin/ronin-campaigns +7 -12
- data/bin/ronin-console +7 -12
- data/bin/ronin-creds +7 -12
- data/bin/ronin-database +7 -12
- data/bin/ronin-emails +7 -12
- data/bin/ronin-exec +7 -12
- data/bin/ronin-fuzzer +7 -12
- data/bin/ronin-help +7 -12
- data/bin/ronin-hosts +7 -12
- data/bin/ronin-install +7 -12
- data/bin/ronin-ips +7 -12
- data/bin/ronin-net-proxy +7 -12
- data/bin/ronin-repos +7 -12
- data/bin/ronin-uninstall +7 -12
- data/bin/ronin-update +7 -12
- data/bin/ronin-urls +7 -12
- data/bin/ronin-wordlist +7 -12
- data/gemspec.yml +8 -8
- data/lib/bond/completions/ronin.rb +23 -23
- data/lib/ronin.rb +3 -3
- data/lib/ronin/address.rb +6 -7
- data/lib/ronin/arch.rb +3 -3
- data/lib/ronin/author.rb +5 -7
- data/lib/ronin/auto_load.rb +5 -5
- data/lib/ronin/bootstrap.rb +3 -3
- data/lib/ronin/campaign.rb +3 -3
- data/lib/ronin/config.rb +5 -7
- data/lib/ronin/credential.rb +3 -3
- data/lib/ronin/database.rb +3 -3
- data/lib/ronin/database/database.rb +8 -12
- data/lib/ronin/database/exceptions.rb +3 -3
- data/lib/ronin/database/exceptions/invalid_config.rb +3 -3
- data/lib/ronin/database/exceptions/unknown_repository.rb +3 -3
- data/lib/ronin/database/migrations.rb +3 -3
- data/lib/ronin/database/migrations/1.0.0.rb +3 -3
- data/lib/ronin/database/migrations/1.1.0.rb +3 -3
- data/lib/ronin/database/migrations/exceptions.rb +3 -3
- data/lib/ronin/database/migrations/exceptions/duplicate_migration.rb +3 -3
- data/lib/ronin/database/migrations/exceptions/unknown_migration.rb +3 -3
- data/lib/ronin/database/migrations/graph.rb +3 -3
- data/lib/ronin/database/migrations/migration.rb +3 -3
- data/lib/ronin/database/migrations/migrations.rb +3 -3
- data/lib/ronin/email_address.rb +5 -7
- data/lib/ronin/environment.rb +3 -3
- data/lib/ronin/exceptions.rb +3 -3
- data/lib/ronin/exceptions/duplicate_repository.rb +3 -3
- data/lib/ronin/exceptions/repository_not_found.rb +3 -3
- data/lib/ronin/host_name.rb +3 -3
- data/lib/ronin/host_name_ip_address.rb +3 -3
- data/lib/ronin/installation.rb +5 -7
- data/lib/ronin/ip_address.rb +6 -8
- data/lib/ronin/ip_address_mac_address.rb +3 -3
- data/lib/ronin/license.rb +6 -6
- data/lib/ronin/mac_address.rb +3 -3
- data/lib/ronin/model.rb +3 -3
- data/lib/ronin/model/has_authors.rb +3 -3
- data/lib/ronin/model/has_description.rb +3 -3
- data/lib/ronin/model/has_license.rb +3 -3
- data/lib/ronin/model/has_name.rb +3 -3
- data/lib/ronin/model/has_title.rb +3 -3
- data/lib/ronin/model/has_unique_name.rb +5 -7
- data/lib/ronin/model/has_version.rb +3 -3
- data/lib/ronin/model/importable.rb +3 -3
- data/lib/ronin/model/model.rb +7 -8
- data/lib/ronin/model/types.rb +3 -3
- data/lib/ronin/model/types/description.rb +9 -12
- data/lib/ronin/open_port.rb +5 -7
- data/lib/ronin/organization.rb +3 -3
- data/lib/ronin/os.rb +5 -7
- data/lib/ronin/os_guess.rb +3 -3
- data/lib/ronin/password.rb +3 -3
- data/lib/ronin/port.rb +3 -3
- data/lib/ronin/repositories.rb +3 -3
- data/lib/ronin/repository.rb +3 -3
- data/lib/ronin/ronin.rb +3 -3
- data/lib/ronin/script.rb +3 -3
- data/lib/ronin/script/buildable.rb +3 -3
- data/lib/ronin/script/deployable.rb +3 -3
- data/lib/ronin/script/exceptions.rb +3 -3
- data/lib/ronin/script/exceptions/build_failed.rb +3 -3
- data/lib/ronin/script/exceptions/deploy_failed.rb +3 -3
- data/lib/ronin/script/exceptions/exception.rb +3 -3
- data/lib/ronin/script/exceptions/not_built.rb +3 -3
- data/lib/ronin/script/exceptions/test_failed.rb +3 -3
- data/lib/ronin/script/path.rb +3 -3
- data/lib/ronin/script/script.rb +3 -3
- data/lib/ronin/script/testable.rb +3 -3
- data/lib/ronin/service.rb +3 -3
- data/lib/ronin/service_credential.rb +3 -3
- data/lib/ronin/software.rb +3 -3
- data/lib/ronin/spec/database.rb +27 -21
- data/lib/ronin/target.rb +3 -3
- data/lib/ronin/tcp_port.rb +3 -3
- data/lib/ronin/udp_port.rb +3 -3
- data/lib/ronin/ui.rb +3 -3
- data/lib/ronin/ui/cli.rb +3 -3
- data/lib/ronin/ui/cli/class_command.rb +14 -7
- data/lib/ronin/ui/cli/cli.rb +5 -5
- data/lib/ronin/ui/cli/command.rb +5 -7
- data/lib/ronin/ui/cli/commands.rb +3 -3
- data/lib/ronin/ui/cli/commands/campaigns.rb +5 -7
- data/lib/ronin/ui/cli/commands/console.rb +3 -3
- data/lib/ronin/ui/cli/commands/creds.rb +3 -3
- data/lib/ronin/ui/cli/commands/database.rb +3 -3
- data/lib/ronin/ui/cli/commands/emails.rb +3 -3
- data/lib/ronin/ui/cli/commands/exec.rb +3 -3
- data/lib/ronin/ui/cli/commands/fuzzer.rb +16 -16
- data/lib/ronin/ui/cli/commands/help.rb +3 -3
- data/lib/ronin/ui/cli/commands/hosts.rb +5 -7
- data/lib/ronin/ui/cli/commands/install.rb +7 -11
- data/lib/ronin/ui/cli/commands/ips.rb +5 -7
- data/lib/ronin/ui/cli/commands/net/proxy.rb +19 -12
- data/lib/ronin/ui/cli/commands/repos.rb +3 -3
- data/lib/ronin/ui/cli/commands/uninstall.rb +3 -3
- data/lib/ronin/ui/cli/commands/update.rb +3 -3
- data/lib/ronin/ui/cli/commands/urls.rb +3 -3
- data/lib/ronin/ui/cli/commands/wordlist.rb +3 -3
- data/lib/ronin/ui/cli/exceptions.rb +3 -3
- data/lib/ronin/ui/cli/exceptions/unknown_command.rb +3 -3
- data/lib/ronin/ui/cli/model_command.rb +6 -9
- data/lib/ronin/ui/cli/printing.rb +3 -3
- data/lib/ronin/ui/cli/resources_command.rb +7 -11
- data/lib/ronin/ui/cli/script_command.rb +5 -10
- data/lib/ronin/ui/console.rb +3 -3
- data/lib/ronin/ui/console/commands.rb +3 -3
- data/lib/ronin/ui/console/console.rb +3 -3
- data/lib/ronin/ui/console/context.rb +3 -3
- data/lib/ronin/ui/console/shell.rb +3 -3
- data/lib/ronin/url.rb +5 -7
- data/lib/ronin/url_query_param.rb +3 -3
- data/lib/ronin/url_query_param_name.rb +6 -6
- data/lib/ronin/url_scheme.rb +4 -4
- data/lib/ronin/user_name.rb +3 -3
- data/lib/ronin/vendor.rb +3 -3
- data/lib/ronin/version.rb +5 -5
- data/lib/ronin/web_credential.rb +5 -7
- data/man/ronin-campaigns.1.md +20 -20
- data/man/ronin-console.1.md +17 -17
- data/man/ronin-creds.1.md +16 -16
- data/man/ronin-database.1.md +23 -23
- data/man/ronin-emails.1.md +18 -18
- data/man/ronin-exec.1.md +11 -11
- data/man/ronin-fuzzer.1.md +23 -23
- data/man/ronin-help.1.md +5 -5
- data/man/ronin-hosts.1.md +20 -20
- data/man/ronin-install.1.md +18 -18
- data/man/ronin-ips.1.md +21 -21
- data/man/ronin-net-proxy.1.md +24 -24
- data/man/ronin-repos.1.md +18 -18
- data/man/ronin-uninstall.1.md +14 -14
- data/man/ronin-update.1.md +14 -14
- data/man/ronin-urls.1.md +22 -22
- data/man/ronin-wordlist.1.md +14 -13
- data/man/ronin.1.md +1 -1
- data/spec/arch_spec.rb +59 -46
- data/spec/author_spec.rb +14 -14
- data/spec/campaign_spec.rb +8 -0
- data/spec/credential_spec.rb +11 -8
- data/spec/database_spec.rb +6 -6
- data/spec/email_address_spec.rb +23 -20
- data/spec/host_name_spec.rb +24 -22
- data/spec/installation_spec.rb +6 -6
- data/spec/ip_address_spec.rb +31 -26
- data/spec/license_spec.rb +15 -9
- data/spec/mac_address_spec.rb +17 -8
- data/spec/model/has_authors_spec.rb +56 -37
- data/spec/model/has_description_spec.rb +36 -23
- data/spec/model/has_license_spec.rb +38 -28
- data/spec/model/has_name_spec.rb +36 -19
- data/spec/model/has_title_spec.rb +27 -14
- data/spec/model/has_version_spec.rb +64 -35
- data/spec/model/model_spec.rb +57 -33
- data/spec/model/models/{basic_model.rb → base_model.rb} +1 -1
- data/spec/model/models/{custom_model.rb → inherited_model.rb} +2 -3
- data/spec/os_spec.rb +24 -20
- data/spec/password_spec.rb +17 -9
- data/spec/port_spec.rb +30 -22
- data/spec/repository_spec.rb +59 -60
- data/spec/ronin_spec.rb +4 -4
- data/spec/script/buildable_spec.rb +8 -8
- data/spec/script/deployable_spec.rb +7 -7
- data/spec/script/path_spec.rb +42 -40
- data/spec/script/script_spec.rb +23 -23
- data/spec/script/testable_spec.rb +20 -20
- data/spec/service_spec.rb +14 -8
- data/spec/software_spec.rb +30 -17
- data/spec/spec_helper.rb +4 -4
- data/spec/ui/cli/classes/test_command.rb +2 -4
- data/spec/ui/cli/cli_spec.rb +5 -5
- data/spec/ui/cli/command_spec.rb +34 -30
- data/spec/url_query_param_spec.rb +23 -14
- data/spec/url_scheme_spec.rb +12 -9
- data/spec/url_spec.rb +64 -61
- data/spec/vendor_spec.rb +15 -8
- metadata +122 -150
- data/.gemtest +0 -0
data/spec/service_spec.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
|
2
3
|
require 'ronin/service'
|
3
4
|
|
4
5
|
describe Service do
|
5
|
-
|
6
|
+
let(:name) { 'Apache' }
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
subject { described_class.new(:name => name) }
|
9
|
+
before { subject.save }
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
describe "validations" do
|
12
|
+
it "should require a name" do
|
13
|
+
service = described_class.new
|
14
|
+
|
15
|
+
expect(service).not_to be_valid
|
16
|
+
end
|
12
17
|
|
13
|
-
|
14
|
-
|
18
|
+
it "should require a unique name" do
|
19
|
+
service = described_class.new(:name => name)
|
15
20
|
|
16
|
-
|
21
|
+
expect(service).not_to be_valid
|
22
|
+
end
|
17
23
|
end
|
18
24
|
end
|
data/spec/software_spec.rb
CHANGED
@@ -1,33 +1,46 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
|
2
3
|
require 'ronin/software'
|
3
4
|
|
4
5
|
describe Software do
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
let(:name) { 'Test' }
|
7
|
+
let(:version) { '0.1.0' }
|
8
|
+
let(:vendor) { 'TestCo' }
|
9
|
+
|
10
|
+
subject do
|
11
|
+
described_class.new(
|
12
|
+
:name => name,
|
13
|
+
:version => version,
|
14
|
+
:vendor => {:name => vendor}
|
15
|
+
)
|
16
|
+
end
|
8
17
|
|
9
|
-
|
10
|
-
|
18
|
+
describe "validations" do
|
19
|
+
it "should require name and version attributes" do
|
20
|
+
software = described_class.new
|
21
|
+
expect(software).not_to be_valid
|
11
22
|
|
12
|
-
|
13
|
-
|
23
|
+
software.name = name
|
24
|
+
expect(software).not_to be_valid
|
25
|
+
|
26
|
+
software.version = version
|
27
|
+
expect(software).to be_valid
|
28
|
+
end
|
14
29
|
end
|
15
30
|
|
16
31
|
describe "#to_s" do
|
17
32
|
it "should be convertable to a String" do
|
18
|
-
|
19
|
-
:name => 'Test',
|
20
|
-
:version => '0.1.0',
|
21
|
-
:vendor => {:name => 'TestCo'}
|
22
|
-
)
|
23
|
-
|
24
|
-
software.to_s.should == 'TestCo Test 0.1.0'
|
33
|
+
expect(subject.to_s).to eq("#{vendor} #{name} #{version}")
|
25
34
|
end
|
26
35
|
|
27
|
-
|
28
|
-
|
36
|
+
context "without a vendor" do
|
37
|
+
subject do
|
38
|
+
described_class.new(:name => name, :version => version)
|
39
|
+
end
|
29
40
|
|
30
|
-
|
41
|
+
it "should ignore the missing vendor information" do
|
42
|
+
expect(subject.to_s).to eq("#{name} #{version}")
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
33
46
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rspec'
|
2
|
-
require 'model/models/
|
3
|
-
require 'model/models/
|
2
|
+
require 'model/models/base_model'
|
3
|
+
require 'model/models/inherited_model'
|
4
4
|
require 'model/models/authored_model'
|
5
5
|
require 'model/models/described_model'
|
6
6
|
require 'model/models/licensed_model'
|
@@ -17,8 +17,8 @@ include Ronin
|
|
17
17
|
RSpec.configure do |spec|
|
18
18
|
spec.before(:suite) do
|
19
19
|
[
|
20
|
-
|
21
|
-
|
20
|
+
BaseModel,
|
21
|
+
InheritedModel,
|
22
22
|
AuthoredModel,
|
23
23
|
DescribedModel,
|
24
24
|
LicensedModel,
|
data/spec/ui/cli/cli_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe UI::CLI do
|
|
8
8
|
it { should_not be_empty }
|
9
9
|
|
10
10
|
it "should replace '/' characters with a ':'" do
|
11
|
-
subject.all? { |command| command.include?('/') }.
|
11
|
+
expect(subject.all? { |command| command.include?('/') }).to be(false)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -16,19 +16,19 @@ describe UI::CLI do
|
|
16
16
|
it "should load classes from 'ronin/ui/cli/commands/'" do
|
17
17
|
command = subject.command('help')
|
18
18
|
|
19
|
-
command.name.
|
19
|
+
expect(command.name).to eq('Ronin::UI::CLI::Commands::Help')
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should load classes from namespaces within 'ronin/ui/cli/commands/'" do
|
23
23
|
command = subject.command('net:proxy')
|
24
24
|
|
25
|
-
command.name.
|
25
|
+
expect(command.name).to eq('Ronin::UI::CLI::Commands::Net::Proxy')
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should raise UnknownCommand for unknown commands" do
|
29
|
-
|
29
|
+
expect {
|
30
30
|
subject.command('foo')
|
31
|
-
}.
|
31
|
+
}.to raise_error(described_class::UnknownCommand)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/spec/ui/cli/command_spec.rb
CHANGED
@@ -8,14 +8,14 @@ describe UI::CLI::Command do
|
|
8
8
|
|
9
9
|
describe "command_name" do
|
10
10
|
it "should be derived from the Class name" do
|
11
|
-
subject.command_name.
|
11
|
+
expect(subject.command_name).to eq('test_command')
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "usage" do
|
16
16
|
context "without an argument" do
|
17
17
|
it "should return the set usage" do
|
18
|
-
subject.usage.
|
18
|
+
expect(subject.usage).to eq('[options] PATH FILE [..]')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -26,7 +26,7 @@ describe UI::CLI::Command do
|
|
26
26
|
before { subject.usage expected }
|
27
27
|
|
28
28
|
it "should set the usage" do
|
29
|
-
subject.usage.
|
29
|
+
expect(subject.usage).to eq(expected)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -42,7 +42,7 @@ describe UI::CLI::Command do
|
|
42
42
|
subject { Class.new(superclass).usage }
|
43
43
|
|
44
44
|
it "should default to the usage of the superclass" do
|
45
|
-
subject.
|
45
|
+
expect(subject).to eq(superclass.usage)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -50,7 +50,7 @@ describe UI::CLI::Command do
|
|
50
50
|
describe "summary" do
|
51
51
|
context "without an argument" do
|
52
52
|
it "should return the set summary" do
|
53
|
-
subject.summary.
|
53
|
+
expect(subject.summary).to eq('Tests the default task')
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -61,7 +61,7 @@ describe UI::CLI::Command do
|
|
61
61
|
before { subject.summary expected }
|
62
62
|
|
63
63
|
it "should set the usage" do
|
64
|
-
subject.summary.
|
64
|
+
expect(subject.summary).to eq(expected)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -77,7 +77,7 @@ describe UI::CLI::Command do
|
|
77
77
|
subject { Class.new(superclass).summary }
|
78
78
|
|
79
79
|
it "should default to the summary of the superclass" do
|
80
|
-
subject.
|
80
|
+
expect(subject).to eq(superclass.summary)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -98,7 +98,7 @@ describe UI::CLI::Command do
|
|
98
98
|
before { subject.examples expected }
|
99
99
|
|
100
100
|
it "should set the usage" do
|
101
|
-
subject.examples.
|
101
|
+
expect(subject.examples).to eq(expected)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -114,7 +114,7 @@ describe UI::CLI::Command do
|
|
114
114
|
subject { Class.new(superclass).examples }
|
115
115
|
|
116
116
|
it "should default to the examples of the superclass" do
|
117
|
-
subject.
|
117
|
+
expect(subject).to eq(superclass.examples)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -124,7 +124,7 @@ describe UI::CLI::Command do
|
|
124
124
|
|
125
125
|
context "inherited" do
|
126
126
|
it "should be {} by default" do
|
127
|
-
subject.
|
127
|
+
expect(subject).to eq({})
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
@@ -132,26 +132,30 @@ describe UI::CLI::Command do
|
|
132
132
|
subject { described_class.options }
|
133
133
|
|
134
134
|
it "should have a :verbose option" do
|
135
|
-
subject.
|
135
|
+
expect(subject).to have_key(:verbose)
|
136
136
|
end
|
137
137
|
|
138
138
|
it "should have a :quiet option" do
|
139
|
-
subject.
|
139
|
+
expect(subject).to have_key(:quiet)
|
140
140
|
end
|
141
141
|
|
142
142
|
it "should have a :silent option" do
|
143
|
-
subject.
|
143
|
+
expect(subject).to have_key(:silent)
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should have a :color option" do
|
147
|
-
subject.
|
147
|
+
expect(subject).to have_key(:color)
|
148
148
|
end
|
149
149
|
|
150
150
|
describe "color option" do
|
151
151
|
subject { described_class.new.color }
|
152
152
|
|
153
153
|
context "when $stdout is a TTY" do
|
154
|
-
it
|
154
|
+
it do
|
155
|
+
skip "$stdout is not a TTY" unless $stdout.tty?
|
156
|
+
|
157
|
+
expect(subject).to be(true)
|
158
|
+
end
|
155
159
|
end
|
156
160
|
|
157
161
|
context "when $stdout is not a TTY" do
|
@@ -160,7 +164,7 @@ describe UI::CLI::Command do
|
|
160
164
|
$stdout = StringIO.new
|
161
165
|
end
|
162
166
|
|
163
|
-
it {
|
167
|
+
it { expect(subject).to be(false) }
|
164
168
|
|
165
169
|
after do
|
166
170
|
$stdout = @old_stdout
|
@@ -174,11 +178,11 @@ describe UI::CLI::Command do
|
|
174
178
|
let(:name) { :foo }
|
175
179
|
|
176
180
|
it "should define an option" do
|
177
|
-
subject.options[name].
|
181
|
+
expect(subject.options[name]).to be_kind_of(Hash)
|
178
182
|
end
|
179
183
|
|
180
184
|
it "should define a parameter" do
|
181
|
-
subject.
|
185
|
+
expect(subject).to have_param(name)
|
182
186
|
end
|
183
187
|
end
|
184
188
|
|
@@ -192,13 +196,13 @@ describe UI::CLI::Command do
|
|
192
196
|
names << name
|
193
197
|
end
|
194
198
|
|
195
|
-
names.
|
199
|
+
expect(names).to match_array(expected)
|
196
200
|
end
|
197
201
|
end
|
198
202
|
|
199
203
|
describe "options?" do
|
200
204
|
it "should test if there are any defined options" do
|
201
|
-
subject.options
|
205
|
+
expect(subject.options?).to be(true)
|
202
206
|
end
|
203
207
|
end
|
204
208
|
|
@@ -217,11 +221,11 @@ describe UI::CLI::Command do
|
|
217
221
|
before { subject.argument name }
|
218
222
|
|
219
223
|
it "should add to arguments" do
|
220
|
-
subject.arguments.
|
224
|
+
expect(subject.arguments).to include(name)
|
221
225
|
end
|
222
226
|
|
223
227
|
it "should define a parameter" do
|
224
|
-
subject.
|
228
|
+
expect(subject).to have_param(name)
|
225
229
|
end
|
226
230
|
end
|
227
231
|
|
@@ -233,13 +237,13 @@ describe UI::CLI::Command do
|
|
233
237
|
|
234
238
|
subject.each_argument { |name| names << name }
|
235
239
|
|
236
|
-
names.
|
240
|
+
expect(names).to match_array(expected)
|
237
241
|
end
|
238
242
|
end
|
239
243
|
|
240
244
|
describe "arguments?" do
|
241
245
|
it "should test if there are any defined arguments" do
|
242
|
-
subject.arguments
|
246
|
+
expect(subject.arguments?).to be(true)
|
243
247
|
end
|
244
248
|
end
|
245
249
|
|
@@ -250,7 +254,7 @@ describe UI::CLI::Command do
|
|
250
254
|
|
251
255
|
command.run(:foo => value)
|
252
256
|
|
253
|
-
command.foo.
|
257
|
+
expect(command.foo).to eq(value)
|
254
258
|
end
|
255
259
|
end
|
256
260
|
|
@@ -261,7 +265,7 @@ describe UI::CLI::Command do
|
|
261
265
|
value = 'baz'
|
262
266
|
subject.start(['--foo', value])
|
263
267
|
|
264
|
-
subject.foo.
|
268
|
+
expect(subject.foo).to eq(value)
|
265
269
|
end
|
266
270
|
|
267
271
|
it "should parse additional arguments" do
|
@@ -269,7 +273,7 @@ describe UI::CLI::Command do
|
|
269
273
|
|
270
274
|
subject.start([path])
|
271
275
|
|
272
|
-
subject.path.
|
276
|
+
expect(subject.path).to eq(path)
|
273
277
|
end
|
274
278
|
|
275
279
|
it "should parse additional arguments into an Array/Set argument" do
|
@@ -279,9 +283,9 @@ describe UI::CLI::Command do
|
|
279
283
|
|
280
284
|
subject.start(['--foo', value, path, *files])
|
281
285
|
|
282
|
-
subject.foo.
|
283
|
-
subject.path.
|
284
|
-
subject.files.
|
286
|
+
expect(subject.foo).to eq(value)
|
287
|
+
expect(subject.path).to eq(path)
|
288
|
+
expect(subject.files).to eq(files)
|
285
289
|
end
|
286
290
|
end
|
287
291
|
end
|
@@ -1,32 +1,41 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
|
2
3
|
require 'ronin/url_query_param'
|
3
4
|
|
4
5
|
describe URLQueryParam do
|
5
|
-
|
6
|
-
|
6
|
+
let(:name) { 'foo' }
|
7
|
+
let(:value) { 'bar' }
|
7
8
|
|
8
|
-
|
9
|
+
subject do
|
10
|
+
described_class.new(:name => {:name => name}, :value => value)
|
9
11
|
end
|
10
12
|
|
11
13
|
describe "#to_s" do
|
12
|
-
let(:name) { URLQueryParamName.new(:name => 'foo') }
|
13
|
-
|
14
14
|
it "should dump a name and a value into a String" do
|
15
|
-
|
16
|
-
|
17
|
-
param.to_s.should == "foo=bar"
|
15
|
+
expect(subject.to_s).to eq("#{name}=#{value}")
|
18
16
|
end
|
19
17
|
|
20
|
-
|
21
|
-
|
18
|
+
context "with empty or nil values" do
|
19
|
+
subject do
|
20
|
+
described_class.new(:name => {:name => name})
|
21
|
+
end
|
22
22
|
|
23
|
-
|
23
|
+
it "should ignore empty or nil values" do
|
24
|
+
expect(subject.to_s).to eq("#{name}=")
|
25
|
+
end
|
24
26
|
end
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
+
context "with special characters" do
|
29
|
+
let(:value) { 'bar baz' }
|
30
|
+
let(:encoded_value) { URI::DEFAULT_PARSER.escape(value) }
|
31
|
+
|
32
|
+
subject do
|
33
|
+
described_class.new(:name => {:name => name}, :value => value)
|
34
|
+
end
|
28
35
|
|
29
|
-
|
36
|
+
it "should escape special characters" do
|
37
|
+
expect(subject.to_s).to eq("#{name}=#{encoded_value}")
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
32
41
|
end
|
data/spec/url_scheme_spec.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
|
2
3
|
require 'ronin/url_scheme'
|
3
4
|
|
4
5
|
describe URLScheme do
|
5
|
-
before(:all) {
|
6
|
-
|
7
|
-
it "should require a name" do
|
8
|
-
scheme = URLScheme.new
|
6
|
+
before(:all) { described_class.create(:name => 'http') }
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
describe "validations" do
|
9
|
+
it "should require a name" do
|
10
|
+
expect(subject).not_to be_valid
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
describe "name" do
|
14
|
+
subject { described_class.new(:name => 'http') }
|
15
15
|
|
16
|
-
|
16
|
+
it "should require a unique name" do
|
17
|
+
expect(subject).not_to be_valid
|
18
|
+
end
|
19
|
+
end
|
17
20
|
end
|
18
21
|
end
|