ronin 0.0.9 → 0.1.0
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/FAQ.txt +103 -0
- data/History.txt +10 -1
- data/Manifest.txt +26 -0
- data/Rakefile +2 -0
- data/TODO.txt +9 -2
- data/lib/ronin/arch.rb +9 -2
- data/lib/ronin/author.rb +9 -10
- data/lib/ronin/chars/chars.rb +1 -1
- data/lib/ronin/console.rb +5 -5
- data/lib/ronin/context.rb +1 -1
- data/lib/ronin/database.rb +8 -3
- data/lib/ronin/extensions/string.rb +1 -1
- data/lib/ronin/extensions/uri/http.rb +1 -1
- data/lib/ronin/license.rb +4 -0
- data/lib/ronin/model.rb +8 -0
- data/lib/ronin/models.rb +1 -8
- data/lib/ronin/network/extensions/telnet/net.rb +11 -6
- data/lib/ronin/network/extensions/udp/net.rb +0 -12
- data/lib/ronin/objects.rb +1 -3
- data/lib/ronin/parameters/parameters.rb +26 -15
- data/lib/ronin/platform.rb +4 -1
- data/lib/ronin/product.rb +3 -0
- data/lib/ronin/runner/program/program.rb +4 -2
- data/lib/ronin/sessions/esmtp.rb +2 -10
- data/lib/ronin/sessions/imap.rb +1 -9
- data/lib/ronin/sessions/pop3.rb +1 -9
- data/lib/ronin/sessions/session.rb +20 -19
- data/lib/ronin/sessions/smtp.rb +1 -9
- data/lib/ronin/sessions/tcp.rb +1 -21
- data/lib/ronin/sessions/telnet.rb +1 -9
- data/lib/ronin/sessions/udp.rb +1 -21
- data/lib/ronin/sessions/web.rb +1 -9
- data/lib/ronin/target.rb +3 -0
- data/lib/ronin/version.rb +1 -1
- data/spec/arch_spec.rb +61 -0
- data/spec/author_spec.rb +10 -0
- data/spec/chars/chars_spec.rb +82 -0
- data/spec/context/context_spec.rb +84 -0
- data/spec/context/helpers/book_context.rb +15 -0
- data/spec/context/helpers/book_review_context.rb +21 -0
- data/spec/context/helpers/contexts/neuromancer_review.rb +15 -0
- data/spec/context/helpers/contexts/snow_crash.rb +8 -0
- data/spec/extensions/hash_spec.rb +38 -0
- data/spec/extensions/string_spec.rb +13 -0
- data/spec/extensions/uri/http_spec.rb +40 -0
- data/spec/extensions/uri/query_params_spec.rb +38 -0
- data/spec/formatting/binary_spec.rb +65 -0
- data/spec/formatting/digest_spec.rb +54 -0
- data/spec/formatting/html_spec.rb +37 -0
- data/spec/formatting/http_spec.rb +44 -0
- data/spec/formatting/text_spec.rb +21 -0
- data/spec/license_spec.rb +20 -0
- data/spec/parameters/parameters_spec.rb +109 -0
- data/spec/path_spec.rb +34 -0
- data/spec/platform_spec.rb +24 -0
- data/spec/product_spec.rb +16 -0
- data/spec/ronin_spec.rb +11 -0
- data/spec/sessions/session_spec.rb +56 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/target_spec.rb +16 -0
- metadata +39 -2
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'ronin/formatting/binary'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Integer do
|
6
|
+
before(:all) do
|
7
|
+
@integer = 0x1337
|
8
|
+
|
9
|
+
@i386_packed_int = "7\023\000\000"
|
10
|
+
@i386_packed_short = "7\023"
|
11
|
+
@i386_packed_long = "7\023\000\000"
|
12
|
+
@i386_packed_quad = "7\023\000\000\000\000\000\000"
|
13
|
+
|
14
|
+
@ppc_packed_int = "\000\000\0237"
|
15
|
+
@ppc_packed_short = "\0237"
|
16
|
+
@ppc_packed_long = "\000\000\0237"
|
17
|
+
@ppc_packed_quad = "\000\000\000\000\000\000\0237"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should provide Integer#pack" do
|
21
|
+
@integer.respond_to?('pack').should == true
|
22
|
+
end
|
23
|
+
|
24
|
+
it "Integer#pack should pack itself for a little-endian architecture" do
|
25
|
+
@integer.pack(Arch.i386).should == @i386_packed_int
|
26
|
+
end
|
27
|
+
|
28
|
+
it "Integer#pack should pack itself as a short for a little-endian architecture" do
|
29
|
+
@integer.pack(Arch.i386,2).should == @i386_packed_short
|
30
|
+
end
|
31
|
+
|
32
|
+
it "Integer#pack should pack itself as a long for a little-endian architecture" do
|
33
|
+
@integer.pack(Arch.i386,4).should == @i386_packed_long
|
34
|
+
end
|
35
|
+
|
36
|
+
it "Integer#pack should pack itself as a quad for a little-endian architecture" do
|
37
|
+
@integer.pack(Arch.i386,8).should == @i386_packed_quad
|
38
|
+
end
|
39
|
+
|
40
|
+
it "Integer#pack should pack itself for a big-endian architecture" do
|
41
|
+
@integer.pack(Arch.ppc).should == @ppc_packed_int
|
42
|
+
end
|
43
|
+
|
44
|
+
it "Integer#pack should pack itself as a short for a big-endian architecture" do
|
45
|
+
@integer.pack(Arch.ppc,2).should == @ppc_packed_short
|
46
|
+
end
|
47
|
+
|
48
|
+
it "Integer#pack should pack itself as a long for a big-endian architecture" do
|
49
|
+
@integer.pack(Arch.ppc,4).should == @ppc_packed_long
|
50
|
+
end
|
51
|
+
|
52
|
+
it "Integer#pack should pack itself as a quad for a big-endian architecture" do
|
53
|
+
@integer.pack(Arch.ppc,8).should == @ppc_packed_quad
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "String" do
|
58
|
+
before(:all) do
|
59
|
+
@packed_integer = ""
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should provide String#depack" do
|
63
|
+
@packed_integer.respond_to?('depack').should == true
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'ronin/formatting/html'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe String do
|
6
|
+
before(:all) do
|
7
|
+
@raw_text = "x > y && y != 0"
|
8
|
+
@html_encoded_text = "x > y && y != 0"
|
9
|
+
|
10
|
+
@raw_html = "<p>Hello <strong>dude</strong></p>"
|
11
|
+
@stripped_text = "Hello dude"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should provide String#html_encode" do
|
15
|
+
@raw_text.respond_to?('html_encode').should == true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "String#html_encode should HTML encode itself" do
|
19
|
+
@raw_text.html_encode.should == @html_encoded_text
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should provide String#html_decode" do
|
23
|
+
@raw_text.respond_to?('html_decode').should == true
|
24
|
+
end
|
25
|
+
|
26
|
+
it "String#html_decode should HTML decode itself" do
|
27
|
+
@html_encoded_text.html_decode.should == @raw_text
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should provide String#strip_html" do
|
31
|
+
@raw_text.respond_to?('strip_html').should == true
|
32
|
+
end
|
33
|
+
|
34
|
+
it "String#strip_html should strip any HTML from itself" do
|
35
|
+
@raw_html.strip_html.should == @stripped_text
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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_unescaped = "x + y"
|
10
|
+
@uri_escaped = "x+%2B+y"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should provide String#uri_encode" do
|
14
|
+
@uri_unencoded.respond_to?('uri_encode').should == true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "String#uri_encode should URI encode itself" do
|
18
|
+
@uri_unencoded.uri_encode.should == @uri_encoded
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should provide String#uri_decode" do
|
22
|
+
@uri_encoded.respond_to?('uri_decode').should == true
|
23
|
+
end
|
24
|
+
|
25
|
+
it "String#uri_decode should URI decode itself" do
|
26
|
+
@uri_encoded.uri_decode.should == @uri_unencoded
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should provide String#uri_escape" do
|
30
|
+
@uri_unescaped.respond_to?('uri_escape').should == true
|
31
|
+
end
|
32
|
+
|
33
|
+
it "String#uri_escape should URI escape itself" do
|
34
|
+
@uri_unescaped.uri_escape.should == @uri_escaped
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should provide String#uri_unescape" do
|
38
|
+
@uri_escaped.respond_to?('uri_unescape').should == true
|
39
|
+
end
|
40
|
+
|
41
|
+
it "String#uri_unescape should URI unescape itself" do
|
42
|
+
@uri_escaped.uri_unescape.should == @uri_unescaped
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'ronin/formatting/text'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe String do
|
6
|
+
before(:all) do
|
7
|
+
@string = ""
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should provide String#format_chars" do
|
11
|
+
@string.respond_to?('format_chars').should == true
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should provide String#format_bytes" do
|
15
|
+
@string.respond_to?('format_bytes').should == true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should provide String#rand_case" do
|
19
|
+
@string.respond_to?('rand_case').should == true
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'ronin/license'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe License do
|
6
|
+
it "should require name and description attributes" do
|
7
|
+
@license = License.new
|
8
|
+
@license.should_not be_valid
|
9
|
+
|
10
|
+
@license.name = 'joke'
|
11
|
+
@license.should_not be_valid
|
12
|
+
|
13
|
+
@license.description = "yep, it's a joke."
|
14
|
+
@license.should be_valid
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should provide built-in licenses"do
|
18
|
+
License.cc_by.should_not be_nil
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'ronin/parameters'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Parameters do
|
6
|
+
before(:all) do
|
7
|
+
class TestParameters
|
8
|
+
include Parameters
|
9
|
+
|
10
|
+
parameter :var, :description => 'Test parameter'
|
11
|
+
|
12
|
+
parameter :var_with_default,
|
13
|
+
:default => 'thing',
|
14
|
+
:description => 'This parameter has a default value'
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class InheritedParameters < TestParameters
|
19
|
+
|
20
|
+
parameter :child_var, :description => 'Child parameter'
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "in a Class" do
|
26
|
+
it "should provide parameters" do
|
27
|
+
TestParameters.params.should_not be_empty
|
28
|
+
end
|
29
|
+
|
30
|
+
it "can have default values for parameters" do
|
31
|
+
TestParameters.param_value(:var_with_default).should == 'thing'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should provide class methods for paremters" do
|
35
|
+
TestParameters.var = 1
|
36
|
+
TestParameters.var.should == 1
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should inherite the super-classes parameters" do
|
40
|
+
InheritedParameters.has_param?(:var).should == true
|
41
|
+
InheritedParameters.has_param?(:child_var).should == true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should provide direct access to the parameter objects" do
|
45
|
+
@param = TestParameters.get_param(:var)
|
46
|
+
|
47
|
+
@param.should_not be_nil
|
48
|
+
@param.name.should == :var
|
49
|
+
end
|
50
|
+
|
51
|
+
it "raise a ParamNotFound exception when directly accessing non-existent parameter objects" do
|
52
|
+
lambda { TestParameters.get_param(:unknown) }.should raise_error(Parameters::ParamNotFound)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should provide descriptions for parameters" do
|
56
|
+
TestParameters.describe_param(:var).should_not be_empty
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "in an Object" do
|
61
|
+
before(:all) do
|
62
|
+
@test = TestParameters.new
|
63
|
+
@test_inherited = InheritedParameters.new
|
64
|
+
end
|
65
|
+
|
66
|
+
it "can have default values for parameters" do
|
67
|
+
@test.param_value(:var_with_default).should == 'thing'
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should provide instance methods for parameters" do
|
71
|
+
@test.var = 2
|
72
|
+
@test.var.should == 2
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should set instance variables for paramters" do
|
76
|
+
@test.instance_variable_get('@var_with_default').should == 'thing'
|
77
|
+
|
78
|
+
@test.var = 3
|
79
|
+
@test.instance_variable_get('@var').should == 3
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should contain the parameters from all ancestors" do
|
83
|
+
@test_inherited.has_param?(:var).should == true
|
84
|
+
@test_inherited.has_param?(:child_var).should == true
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should provide direct access to the parameter objects" do
|
88
|
+
@param = @test.get_param(:var)
|
89
|
+
|
90
|
+
@param.should_not be_nil
|
91
|
+
@param.name.should == :var
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should raise a ParamNotFound exception when directly accessing non-existent parameter objects" do
|
95
|
+
lambda { @test.get_param(:unknown) }.should raise_error(Parameters::ParamNotFound)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should allow for setting parameters en-mass" do
|
99
|
+
@test.set_params(:var => 3, :var_with_default => 7)
|
100
|
+
|
101
|
+
@test.param_value(:var).should == 3
|
102
|
+
@test.param_value(:var_with_default).should == 7
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should provide descriptions for parameters" do
|
106
|
+
@test.describe_param(:var).should_not be_empty
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
data/spec/path_spec.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'ronin/path'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Ronin do
|
6
|
+
describe Path do
|
7
|
+
before(:all) do
|
8
|
+
@n = 7
|
9
|
+
@range = (7..10)
|
10
|
+
@sub_path = File.join('one','two')
|
11
|
+
@sub_directory = 'three'
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should inherit from Pathname" do
|
15
|
+
Path.superclass.should == Pathname
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should create directory-escaping paths" do
|
19
|
+
Path.up(@n).to_s.should == File.join(*(['..'] * @n))
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should create a range of directory-escaping paths" do
|
23
|
+
Path.up(@range).should == @range.map { |i| Path.up(i) }
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should join with sub-paths" do
|
27
|
+
Path.up(@n).join(@sub_path).to_s.should == File.join(Path.up(@n),@sub_path)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should join with a sub-directory" do
|
31
|
+
(Path.up(@n) / @sub_directory).to_s.should == File.join(Path.up(@n),@sub_directory)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'ronin/platform'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Platform do
|
6
|
+
it "should require os and version attributes" do
|
7
|
+
@platform = Platform.new
|
8
|
+
@platform.should_not be_valid
|
9
|
+
|
10
|
+
@platform.os = 'test'
|
11
|
+
@platform.should_not be_valid
|
12
|
+
|
13
|
+
@platform.version = '0.0.1'
|
14
|
+
@platform.should be_valid
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should provide methods for creating platforms for built-in OSes" do
|
18
|
+
Platform.linux.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should provide methods for creating platforms for built-in OSes with versions" do
|
22
|
+
Platform.linux_version('2.6.11').should be_valid
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'ronin/product'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Product do
|
6
|
+
it "should require name and version attributes" do
|
7
|
+
@product = Product.new
|
8
|
+
@product.should_not be_valid
|
9
|
+
|
10
|
+
@product.name = 'test'
|
11
|
+
@product.should_not be_valid
|
12
|
+
|
13
|
+
@product.version = '0.1.0'
|
14
|
+
@product.should be_valid
|
15
|
+
end
|
16
|
+
end
|