ronin 0.2.2 → 0.2.3
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.
- data/History.txt +53 -0
- data/Manifest.txt +26 -18
- data/README.txt +12 -19
- data/Rakefile +9 -9
- data/TODO.txt +5 -5
- data/lib/ronin/cacheable.rb +246 -0
- data/lib/ronin/database/database.rb +21 -3
- data/lib/ronin/database/exceptions/invalid_config.rb +1 -1
- data/lib/ronin/environment.rb +5 -2
- data/lib/ronin/extensions.rb +2 -0
- data/lib/ronin/{models.rb → extensions/array.rb} +19 -6
- data/lib/ronin/extensions/ip_addr.rb +127 -0
- data/lib/ronin/{objectify/exceptions/object_context_not_found.rb → extensions/kernel.rb} +14 -3
- data/lib/ronin/extensions/uri/query_params.rb +4 -2
- data/lib/ronin/formatting/extensions/binary/integer.rb +6 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +14 -12
- data/lib/ronin/formatting/extensions/text/string.rb +37 -19
- data/lib/ronin/has_license.rb +4 -2
- data/lib/ronin/model.rb +0 -1
- data/lib/ronin/network/extensions/http/net.rb +30 -3
- data/lib/ronin/network/extensions/telnet/net.rb +0 -18
- data/lib/ronin/network/http/exceptions/unknown_request.rb +1 -1
- data/lib/ronin/platform/exceptions/extension_not_found.rb +1 -1
- data/lib/ronin/platform/exceptions/overlay_cached.rb +1 -1
- data/lib/ronin/platform/exceptions/overlay_not_found.rb +1 -1
- data/lib/ronin/platform/extension.rb +18 -3
- data/lib/ronin/platform/extension_cache.rb +7 -1
- data/lib/ronin/platform/object_cache.rb +13 -12
- data/lib/ronin/platform/overlay.rb +14 -6
- data/lib/ronin/platform/overlay_cache.rb +11 -5
- data/lib/ronin/product.rb +20 -3
- data/lib/ronin/ronin.rb +0 -15
- data/lib/ronin/rpc/exceptions/response_missing.rb +1 -1
- data/lib/ronin/sessions/esmtp.rb +1 -10
- data/lib/ronin/{objectify.rb → sessions/exceptions.rb} +3 -3
- data/lib/ronin/{objectify/exceptions/unknown_object_context.rb → sessions/exceptions/variable_missing.rb} +4 -4
- data/lib/ronin/sessions/http.rb +3 -10
- data/lib/ronin/sessions/imap.rb +1 -10
- data/lib/ronin/sessions/pop3.rb +1 -9
- data/lib/ronin/sessions/session.rb +11 -21
- data/lib/ronin/sessions/smtp.rb +1 -10
- data/lib/ronin/sessions/tcp.rb +10 -13
- data/lib/ronin/sessions/telnet.rb +2 -17
- data/lib/ronin/sessions/udp.rb +6 -11
- data/lib/ronin/static/finders.rb +24 -0
- data/lib/ronin/ui/command_line/command_line.rb +41 -21
- data/lib/ronin/ui/command_line/commands/help.rb +7 -3
- data/lib/ronin/ui/command_line/commands/ls.rb +1 -1
- data/lib/ronin/ui/command_line/commands/rm.rb +1 -1
- data/lib/ronin/ui/command_line/exceptions/unknown_command.rb +1 -1
- data/lib/ronin/ui/diagnostics.rb +12 -5
- data/lib/ronin/ui/hexdump/extensions/file.rb +3 -1
- data/lib/ronin/ui/hexdump/hexdump.rb +1 -1
- data/lib/ronin/ui/verbose.rb +14 -0
- data/lib/ronin/version.rb +1 -1
- data/spec/cacheable_spec.rb +150 -0
- data/spec/classes/cacheable_model.rb +15 -0
- data/spec/classes/licensed_model.rb +12 -0
- data/spec/code/classes/thing.rb +13 -0
- data/spec/code/reference_spec.rb +1 -14
- data/spec/extensions/array_spec.rb +34 -0
- data/spec/extensions/ip_addr_spec.rb +44 -0
- data/spec/extensions/kernel_spec.rb +19 -0
- data/spec/extensions/uri/query_params_spec.rb +8 -0
- data/spec/formatting/binary/string_spec.rb +1 -1
- data/spec/formatting/digest/string_spec.rb +84 -0
- data/spec/formatting/http/string_spec.rb +84 -0
- data/spec/formatting/text/string_spec.rb +51 -0
- data/spec/has_license_spec.rb +29 -0
- data/spec/helpers/cacheable.rb +7 -0
- data/spec/helpers/contexts/ronin_cacheable_model.rb +13 -0
- data/spec/helpers/database.rb +5 -0
- data/spec/platform/helpers/overlays/hello/lib/init.rb +1 -0
- data/spec/platform/helpers/overlays/hello/lib/stuff/another_test.rb +6 -0
- data/spec/platform/helpers/overlays/hello/lib/stuff/test.rb +4 -0
- data/spec/platform/overlay_cache_spec.rb +1 -1
- data/spec/platform/overlay_spec.rb +28 -0
- data/spec/product_spec.rb +7 -0
- data/spec/sessions/classes/test_session.rb +11 -0
- data/spec/sessions/classes/uses_test_session.rb +10 -0
- data/spec/sessions/session_spec.rb +13 -44
- data/spec/spec_helper.rb +0 -5
- data/spec/static/{helpers → classes}/static_class.rb +0 -0
- data/spec/static/helpers/static.rb +0 -1
- data/spec/static/static_spec.rb +1 -0
- metadata +44 -35
- data/lib/ronin/objectify/exceptions.rb +0 -25
- data/lib/ronin/objectify/objectify.rb +0 -240
- data/lib/ronin/target.rb +0 -44
- data/lib/ronin/ui/command_line/param_parser.rb +0 -93
- data/spec/formatting/digest_spec.rb +0 -54
- data/spec/formatting/http_spec.rb +0 -53
- data/spec/formatting/text_spec.rb +0 -40
- data/spec/helpers.rb +0 -0
- data/spec/objectify/objectify_spec.rb +0 -31
- data/spec/target_spec.rb +0 -16
- data/spec/ui/command_line/helpers/example_command.rb +0 -21
- data/spec/ui/command_line/param_parser_spec.rb +0 -49
data/lib/ronin/target.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Ronin - A Ruby platform designed for information security and data
|
|
3
|
-
# exploration tasks.
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2007-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
6
|
-
#
|
|
7
|
-
# This program is free software; you can redistribute it and/or modify
|
|
8
|
-
# it under the terms of the GNU General Public License as published by
|
|
9
|
-
# the Free Software Foundation; either version 2 of the License, or
|
|
10
|
-
# (at your option) any later version.
|
|
11
|
-
#
|
|
12
|
-
# This program is distributed in the hope that it will be useful,
|
|
13
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
# GNU General Public License for more details.
|
|
16
|
-
#
|
|
17
|
-
# You should have received a copy of the GNU General Public License
|
|
18
|
-
# along with this program; if not, write to the Free Software
|
|
19
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
require 'ronin/model'
|
|
23
|
-
require 'ronin/os'
|
|
24
|
-
require 'ronin/arch'
|
|
25
|
-
|
|
26
|
-
module Ronin
|
|
27
|
-
class Target
|
|
28
|
-
|
|
29
|
-
include Model
|
|
30
|
-
|
|
31
|
-
# Primary key
|
|
32
|
-
property :id, Serial
|
|
33
|
-
|
|
34
|
-
# Targeted architecture
|
|
35
|
-
belongs_to :arch
|
|
36
|
-
|
|
37
|
-
# Targeted OS
|
|
38
|
-
belongs_to :os, :class_name => 'OS'
|
|
39
|
-
|
|
40
|
-
# Validates
|
|
41
|
-
validates_present :arch, :os
|
|
42
|
-
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
#--
|
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
-
# exploration tasks.
|
|
5
|
-
#
|
|
6
|
-
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
-
#
|
|
8
|
-
# This program is free software; you can redistribute it and/or modify
|
|
9
|
-
# it under the terms of the GNU General Public License as published by
|
|
10
|
-
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
-
# (at your option) any later version.
|
|
12
|
-
#
|
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
# GNU General Public License for more details.
|
|
17
|
-
#
|
|
18
|
-
# You should have received a copy of the GNU General Public License
|
|
19
|
-
# along with this program; if not, write to the Free Software
|
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
-
#++
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
require 'uri'
|
|
25
|
-
|
|
26
|
-
module Ronin
|
|
27
|
-
module UI
|
|
28
|
-
module CommandLine
|
|
29
|
-
module ParamParser
|
|
30
|
-
# The params Hash
|
|
31
|
-
attr_reader :params
|
|
32
|
-
|
|
33
|
-
#
|
|
34
|
-
# The Array of parameter patterns and their parsers.
|
|
35
|
-
#
|
|
36
|
-
def ParamParser.formats
|
|
37
|
-
@@ronin_param_formats ||= []
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
#
|
|
41
|
-
# Itereates over each parameter pattern and parser, passing them to the
|
|
42
|
-
# specified _block_.
|
|
43
|
-
#
|
|
44
|
-
def ParamParser.each_format(&block)
|
|
45
|
-
ParamParser.formats.each do |format|
|
|
46
|
-
block.call(format[:pattern],format[:parser])
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
#
|
|
51
|
-
# Adds a new parameter _pattern_ using the specified _block_ as the parser.
|
|
52
|
-
#
|
|
53
|
-
def ParamParser.recognize(pattern,&block)
|
|
54
|
-
ParamParser.formats.unshift({
|
|
55
|
-
:pattern => pattern,
|
|
56
|
-
:parser => block
|
|
57
|
-
})
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
protected
|
|
61
|
-
|
|
62
|
-
#
|
|
63
|
-
# Parses the specified _name_and_value_ string of the form
|
|
64
|
-
# "name=value" and extracts both the _name_ and the _value_, saving
|
|
65
|
-
# both the _name_ and _value_ within the +params+ Hash. If the
|
|
66
|
-
# extracted _value_ matches one of the patterns within +FORMATS+,
|
|
67
|
-
# then the associated parser will first parse the _value_.
|
|
68
|
-
#
|
|
69
|
-
def parse_param(name_and_value)
|
|
70
|
-
name, value = name_and_value.split('=',2)
|
|
71
|
-
|
|
72
|
-
if value
|
|
73
|
-
ParamParser.each_format do |pattern,parser|
|
|
74
|
-
if value.match(pattern)
|
|
75
|
-
value = parser.call(value)
|
|
76
|
-
break
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
return {name.to_sym => value}
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
ParamParser.recognize(/^[a-zA-Z][a-zA-Z0-9]*:\/\//) { |value| URI(value) }
|
|
85
|
-
ParamParser.recognize('false') { |value| false }
|
|
86
|
-
ParamParser.recognize('true') { |value| true }
|
|
87
|
-
ParamParser.recognize(/^0x[0-9a-fA-F]+$/) { |value| value.hex }
|
|
88
|
-
ParamParser.recognize(/^[0-9]+$/) { |value| value.to_i }
|
|
89
|
-
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
require 'ronin/formatting/digest'
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
describe String do
|
|
6
|
-
before(:all) do
|
|
7
|
-
@digest_plain_text = "test"
|
|
8
|
-
@digest_md5 = "098f6bcd4621d373cade4e832627b4f6"
|
|
9
|
-
@digest_sha1 = "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
|
|
10
|
-
@digest_sha2 = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
|
|
11
|
-
@digest_sha256 = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
|
|
12
|
-
@digest_sha512 = "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "should provide String#md5" do
|
|
16
|
-
@digest_plain_text.respond_to?('md5').should == true
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "String#md5 should return the MD5 digest of itself" do
|
|
20
|
-
@digest_plain_text.md5.should == @digest_md5
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "should provide String#sha1" do
|
|
24
|
-
@digest_plain_text.respond_to?('sha1').should == true
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it "String#sha1 should return the SHA1 digest of itself" do
|
|
28
|
-
@digest_plain_text.sha1.should == @digest_sha1
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "should provide String#sha2" do
|
|
32
|
-
@digest_plain_text.respond_to?('sha2').should == true
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "String#sha2 should return the SHA2 digest of itself" do
|
|
36
|
-
@digest_plain_text.sha2.should == @digest_sha2
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "should provide String#sha256" do
|
|
40
|
-
@digest_plain_text.respond_to?('sha256').should == true
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "String#sha256 should return the SHA256 digest of itself" do
|
|
44
|
-
@digest_plain_text.sha256.should == @digest_sha256
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "should provide String#sha512" do
|
|
48
|
-
@digest_plain_text.respond_to?('sha512').should == true
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
it "String#sha512 should return the SHA512 digest of itself" do
|
|
52
|
-
@digest_plain_text.sha512.should == @digest_sha512
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require 'ronin/formatting/http'
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
describe String do
|
|
6
|
-
before(:all) do
|
|
7
|
-
@uri_unencoded = "mod % 3"
|
|
8
|
-
@uri_encoded = "mod%20%25%203"
|
|
9
|
-
@uri_http_encoded = "%6d%6f%64%20%25%20%33"
|
|
10
|
-
@uri_unescaped = "x + y"
|
|
11
|
-
@uri_escaped = "x+%2B+y"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "should provide String#uri_encode" do
|
|
15
|
-
@uri_unencoded.respond_to?('uri_encode').should == true
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "String#uri_encode should URI encode itself" do
|
|
19
|
-
@uri_unencoded.uri_encode.should == @uri_encoded
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "should provide String#uri_decode" do
|
|
23
|
-
@uri_encoded.respond_to?('uri_decode').should == true
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "String#uri_decode should URI decode itself" do
|
|
27
|
-
@uri_encoded.uri_decode.should == @uri_unencoded
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "should provide String#uri_escape" do
|
|
31
|
-
@uri_unescaped.respond_to?('uri_escape').should == true
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "String#uri_escape should URI escape itself" do
|
|
35
|
-
@uri_unescaped.uri_escape.should == @uri_escaped
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "should provide String#uri_unescape" do
|
|
39
|
-
@uri_escaped.respond_to?('uri_unescape').should == true
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "String#uri_unescape should URI unescape itself" do
|
|
43
|
-
@uri_escaped.uri_unescape.should == @uri_unescaped
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "should provide String#format_http" do
|
|
47
|
-
@uri_unencoded.respond_to?('format_http').should == true
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it "String#format_http should format each byte of the String" do
|
|
51
|
-
@uri_unencoded.format_http.should == @uri_http_encoded
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require 'ronin/formatting/text'
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
describe String do
|
|
6
|
-
before(:all) do
|
|
7
|
-
@string = "hello"
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "should provide String#format_chars" do
|
|
11
|
-
@string.respond_to?('format_chars').should == true
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "String#format_chars should format each character in the String" do
|
|
15
|
-
@string.format_chars { |c|
|
|
16
|
-
"_#{c}"
|
|
17
|
-
}.should == "_h_e_l_l_o"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should provide String#format_bytes" do
|
|
21
|
-
@string.respond_to?('format_bytes').should == true
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "String#format_bytes should format each byte in the String" do
|
|
25
|
-
@string.format_bytes { |b|
|
|
26
|
-
sprintf("%%%x",b)
|
|
27
|
-
}.should == "%68%65%6c%6c%6f"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "should provide String#random_case" do
|
|
31
|
-
@string.respond_to?('random_case').should == true
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "String#random_case should randomly capitalize each character" do
|
|
35
|
-
new_string = @string.random_case
|
|
36
|
-
|
|
37
|
-
new_string.should_not == @string
|
|
38
|
-
new_string.downcase.should == @string
|
|
39
|
-
end
|
|
40
|
-
end
|
data/spec/helpers.rb
DELETED
|
File without changes
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require 'ronin/objectify'
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
describe Objectify do
|
|
6
|
-
before(:all) do
|
|
7
|
-
class TestObject
|
|
8
|
-
|
|
9
|
-
include Objectify
|
|
10
|
-
|
|
11
|
-
objectify :test
|
|
12
|
-
|
|
13
|
-
property :id, Serial
|
|
14
|
-
|
|
15
|
-
property :mesg, String
|
|
16
|
-
|
|
17
|
-
parameter :x
|
|
18
|
-
|
|
19
|
-
parameter :y
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "should create an object with a Hash of attributes and params" do
|
|
25
|
-
test = TestObject.new(:mesg => 'hello', :x => 3, :y => 9)
|
|
26
|
-
|
|
27
|
-
test.mesg.should == 'hello'
|
|
28
|
-
test.x.should == 3
|
|
29
|
-
test.y.should == 9
|
|
30
|
-
end
|
|
31
|
-
end
|
data/spec/target_spec.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require 'ronin/target'
|
|
2
|
-
|
|
3
|
-
require 'helpers/database'
|
|
4
|
-
|
|
5
|
-
describe Target do
|
|
6
|
-
it "should require an arch and a platform" do
|
|
7
|
-
@target = Target.new
|
|
8
|
-
@target.should_not be_valid
|
|
9
|
-
|
|
10
|
-
@target.arch = Arch.i386
|
|
11
|
-
@target.should_not be_valid
|
|
12
|
-
|
|
13
|
-
@target.os = OS.linux_version('2.6.11')
|
|
14
|
-
@target.should be_valid
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require 'ronin/ui/command_line/command'
|
|
2
|
-
|
|
3
|
-
class ExampleCommand < UI::CommandLine::Command
|
|
4
|
-
|
|
5
|
-
include UI::CommandLine::ParamParser
|
|
6
|
-
|
|
7
|
-
attr_reader :params
|
|
8
|
-
|
|
9
|
-
def initialize(name)
|
|
10
|
-
@params = {}
|
|
11
|
-
|
|
12
|
-
super(name)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def param_parser(name_and_value)
|
|
16
|
-
@params.merge!(parse_param(name_and_value))
|
|
17
|
-
|
|
18
|
-
return @params
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
require 'ronin/ui/command_line/param_parser'
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
require 'ui/command_line/helpers/example_command'
|
|
5
|
-
|
|
6
|
-
describe UI::CommandLine::ParamParser do
|
|
7
|
-
before(:all) do
|
|
8
|
-
@command = ExampleCommand.new('example')
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "should parse params of the form 'name'" do
|
|
12
|
-
@command.param_parser('var')
|
|
13
|
-
|
|
14
|
-
@command.params.has_key?(:var).should == true
|
|
15
|
-
@command.params[:var].should be_nil
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should parse params of the form 'name=value'" do
|
|
19
|
-
@command.param_parser('var1=test')
|
|
20
|
-
@command.params[:var1].should == 'test'
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "should parse params which have numeric values" do
|
|
24
|
-
@command.param_parser('var2=100')
|
|
25
|
-
@command.params[:var2].should == 100
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "should parse params with hexadecimal values" do
|
|
29
|
-
@command.param_parser('var3=0x2a')
|
|
30
|
-
@command.params[:var3].should == 0x2a
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it "should parse params with URI values" do
|
|
34
|
-
url = 'http://example.com/'
|
|
35
|
-
|
|
36
|
-
@command.param_parser("var4=#{url}")
|
|
37
|
-
@command.params[:var4].should == URI(url)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it "should parse params with true boolean values" do
|
|
41
|
-
@command.param_parser('var5=true')
|
|
42
|
-
@command.params[:var5].should == true
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it "should parse params with false boolean values" do
|
|
46
|
-
@command.param_parser('var6=false')
|
|
47
|
-
@command.params[:var6].should == false
|
|
48
|
-
end
|
|
49
|
-
end
|