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
data/lib/ronin/target.rb
CHANGED
data/lib/ronin/version.rb
CHANGED
data/spec/arch_spec.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'ronin/arch'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Arch do
|
6
|
+
it "should require a name, endian and address_length attributes" do
|
7
|
+
@arch = Arch.new
|
8
|
+
@arch.should_not be_valid
|
9
|
+
|
10
|
+
@arch.name = 'future'
|
11
|
+
@arch.should_not be_valid
|
12
|
+
|
13
|
+
@arch.endian = 'little'
|
14
|
+
@arch.should_not be_valid
|
15
|
+
|
16
|
+
@arch.address_length = 4
|
17
|
+
@arch.should be_valid
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should require a unique name" do
|
21
|
+
@first_arch = Arch.create(:name => 'cats',
|
22
|
+
:endian => 'little',
|
23
|
+
:address_length => 4)
|
24
|
+
@first_arch.should be_valid
|
25
|
+
|
26
|
+
@second_arch = Arch.new(:name => 'cats',
|
27
|
+
:endian => 'big',
|
28
|
+
:address_length => 4)
|
29
|
+
@second_arch.should_not be_valid
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should require either 'little' or 'big' for the endian attribute" do
|
33
|
+
@arch = Arch.new(:name => 'test',
|
34
|
+
:endian => 'lol',
|
35
|
+
:address_length => 4)
|
36
|
+
@arch.should_not be_valid
|
37
|
+
|
38
|
+
@arch.endian = 'little'
|
39
|
+
@arch.should be_valid
|
40
|
+
|
41
|
+
@arch.endian = 'big'
|
42
|
+
@arch.should be_valid
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should require a numeric valid for the address_length attribute" do
|
46
|
+
@arch = Arch.new(:name => 'test2',
|
47
|
+
:endian => 'big',
|
48
|
+
:address_length => 'x')
|
49
|
+
@arch.should_not be_valid
|
50
|
+
|
51
|
+
@arch.address_length = '4'
|
52
|
+
@arch.should be_valid
|
53
|
+
|
54
|
+
@arch.address_length = 4
|
55
|
+
@arch.should be_valid
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should provide built-in archs" do
|
59
|
+
Arch.i386.should_not be_nil
|
60
|
+
end
|
61
|
+
end
|
data/spec/author_spec.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'ronin/chars/chars'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Ronin do
|
6
|
+
describe Chars do
|
7
|
+
before(:all) do
|
8
|
+
@numeric_string = Chars.numeric.random_string(10)
|
9
|
+
@octal_string = Chars.octal.random_string(10)
|
10
|
+
@uppercase_hex_string = Chars.uppercase_hexadecimal.random_string(10)
|
11
|
+
@lowercase_hex_string = Chars.lowercase_hexadecimal.random_string(10)
|
12
|
+
@hex_string = Chars.hexadecimal.random_string(10)
|
13
|
+
@uppercase_alpha_string = Chars.uppercase_alpha.random_string(10)
|
14
|
+
@lowercase_alpha_string = Chars.lowercase_alpha.random_string(10)
|
15
|
+
@alpha_string = Chars.alpha.random_string(10)
|
16
|
+
@alpha_numeric = Chars.alpha_numeric.random_string(10)
|
17
|
+
@space_string = Chars.space.random_string(10)
|
18
|
+
@punctuation_string = Chars.punctuation.random_string(10)
|
19
|
+
@symbols_string = Chars.symbols.random_string(10)
|
20
|
+
@control_string = Chars.control.random_string(10)
|
21
|
+
@ascii_string = Chars.ascii.random_string(10)
|
22
|
+
@all_string = Chars.all.random_string(10)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should provide a numeric CharSet" do
|
26
|
+
(@numeric_string =~ /[0-9]{10}/).should_not be_nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should provide an octal CharSet" do
|
30
|
+
(@octal_string =~ /[0-7]{10}/).should_not be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should provide an upper-case hexadecimal CharSet" do
|
34
|
+
(@uppercase_hex_string =~ /[0-9A-F]{10}/).should_not be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should provide a lower-case hexadecimal CharSet" do
|
38
|
+
(@lowercase_hex_string =~ /[0-9a-f]{10}/).should_not be_nil
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should provide a hexadecimal CharSet" do
|
42
|
+
(@hex_string =~ /[0-9A-Fa-f]{10}/).should_not be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should provide an upper-case alpha CharSet" do
|
46
|
+
(@uppercase_alpha_string =~ /[A-Z]{10}/).should_not be_nil
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should provide a lower-case alpha CharSet" do
|
50
|
+
(@lowercase_alpha_string =~ /[a-z]{10}/).should_not be_nil
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should provide an alpha CharSet" do
|
54
|
+
(@alpha_string =~ /[A-Za-z]{10}/).should_not be_nil
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should provide an alpha-numeric CharSet" do
|
58
|
+
(@alpha_numeric_string =~ /[A-Za-z0-9]{10}/).should_not be_nil
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should provide a space CharSet" do
|
62
|
+
(@space_string =~ /[ \f\n\r\t\v]{10}/).should_not be_nil
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should provide a punctuation CharSet" do
|
66
|
+
(@punctuation_string =~ /[ \'\"\`\,\;\:\~\-\(\)\[\]\{\}\.\?\!]{10}/).should_not be_nil
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should provide a symbols CharSet" do
|
70
|
+
#(@symbols_string =~ /[\@\#\$\%\^\&\*\_\+\=\|\\\<\>\/]{10}/).should_not be_nil
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should provide a control CharSet" do
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should provide an ascii CharSet" do
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should provide an 'all' CharSet" do
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'ronin/context'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Ronin do
|
6
|
+
describe Context do
|
7
|
+
before(:all) do
|
8
|
+
require 'context/helpers/book_context'
|
9
|
+
require 'context/helpers/book_review_context'
|
10
|
+
|
11
|
+
@contexts_dir = File.expand_path(File.join(File.dirname(__FILE__),'helpers','contexts'))
|
12
|
+
@snow_crash_path = File.join(@contexts_dir,'snow_crash.rb')
|
13
|
+
@neuromancer_path = File.join(@contexts_dir,'neuromancer_review.rb')
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should contain defined contexts" do
|
17
|
+
Context.is_context?(:book).should == true
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should create a class-level context name" do
|
21
|
+
Book.context_name.should == :book
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should raise an UnknownContext exception when loading unknwon-contexts" do
|
25
|
+
lambda {
|
26
|
+
Context.load_context(:nothing, 'some_path.rb')
|
27
|
+
}.should raise_error(UnknownContext)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should raise a ContextNotFound exception when loading from non-existant files" do
|
31
|
+
lambda {
|
32
|
+
Context.load_context(:book, 'not_here.rb')
|
33
|
+
}.should raise_error(ContextNotFound)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should load contexts by context-name from a file" do
|
37
|
+
@book = Context.load_context(:book, @snow_crash_path)
|
38
|
+
@book.should_not be_nil
|
39
|
+
@book.class.should == Book
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should load a specific context from a file with multiple contexts" do
|
43
|
+
@book = Context.load_context(:book, @neuromancer_path)
|
44
|
+
@book.should_not be_nil
|
45
|
+
@book.class.should == Book
|
46
|
+
|
47
|
+
@review = Context.load_context(:book_review, @neuromancer_path)
|
48
|
+
@review.should_not be_nil
|
49
|
+
@review.class.should == BookReview
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should provide class-level methods for loading a context" do
|
53
|
+
@book = Book.load_context(@snow_crash_path)
|
54
|
+
@book.should_not be_nil
|
55
|
+
@book.class.should == Book
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should provide top-level ronin methods for loading a context" do
|
59
|
+
@book = ronin_load_book(@snow_crash_path)
|
60
|
+
@book.should_not be_nil
|
61
|
+
@book.class.should == Book
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "loaded contexts" do
|
65
|
+
before(:all) do
|
66
|
+
@book = Book.load_context(@snow_crash_path)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should have a context name" do
|
70
|
+
@book.context_name.should == :book
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should have attributes" do
|
74
|
+
@book.title.should == 'Snow Crash'
|
75
|
+
@book.author.should == 'Neal Stephenson'
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should have instance methods" do
|
79
|
+
@book.methods.include?('rating').should == true
|
80
|
+
@book.rating.should == 10
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'ronin/context'
|
2
|
+
|
3
|
+
class BookReview
|
4
|
+
|
5
|
+
include Context
|
6
|
+
|
7
|
+
contextify :book_review
|
8
|
+
|
9
|
+
# Title of the book
|
10
|
+
attr_accessor :book_title
|
11
|
+
|
12
|
+
# Author of the book
|
13
|
+
attr_accessor :book_author
|
14
|
+
|
15
|
+
# Author of this review
|
16
|
+
attr_accessor :author
|
17
|
+
|
18
|
+
# Summary
|
19
|
+
attr_accessor :summary
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
ronin_book do
|
2
|
+
@title = 'Neuromancer'
|
3
|
+
@author = 'William Gibson'
|
4
|
+
end
|
5
|
+
|
6
|
+
ronin_book_review do
|
7
|
+
@book_title = 'Neuromancer'
|
8
|
+
@book_author = 'William Gibson'
|
9
|
+
|
10
|
+
@author = 'postmodern'
|
11
|
+
@summary = %{
|
12
|
+
Classic cyber-punk book. Provides you with a very realistic and gritty
|
13
|
+
vision of the future and the characters that inhabit it.
|
14
|
+
}
|
15
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'ronin/extensions/hash'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Hash do
|
6
|
+
before(:all) do
|
7
|
+
@hash = {:a => 1, :b => 2, :c => 3}
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be able to be exploded" do
|
11
|
+
@exploded = @hash.explode(:x)
|
12
|
+
@exploded.length.should == 3
|
13
|
+
|
14
|
+
@exploded.each do |key,new_hash|
|
15
|
+
new_hash[key].should == :x
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should explode only with specific keys" do
|
20
|
+
@keys = [:a, :c]
|
21
|
+
@exploded = @hash.explode(:x, :included => @keys)
|
22
|
+
|
23
|
+
@exploded.each do |key,new_hash|
|
24
|
+
@keys.include?(key).should == true
|
25
|
+
new_hash[key].should == :x
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should not explode on specified keys" do
|
30
|
+
@keys = [:b]
|
31
|
+
@exploded = @hash.explode(:x, :excluded => @keys)
|
32
|
+
|
33
|
+
@exploded.each do |key,new_hash|
|
34
|
+
@keys.include?(key).should == false
|
35
|
+
new_hash[key].should == :x
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'ronin/extensions/string'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe String do
|
6
|
+
it "should be able to convert proper names to method names" do
|
7
|
+
"Proper Name".to_method_name.should == 'proper_name'
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be able to convert Class names to method names" do
|
11
|
+
"Namespace::Test".to_method_name.should == 'namespace_test'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'ronin/extensions/uri'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe URI::HTTP do
|
6
|
+
it "should include QueryParams" do
|
7
|
+
URI::HTTP.include?(URI::QueryParams).should == true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should have explodable query params" do
|
11
|
+
@url = URI('http://search.dhgate.com/search.do?dkp=1&searchkey=yarn&catalog=')
|
12
|
+
|
13
|
+
@urls = @url.explode_query_params('x')
|
14
|
+
@urls.each do |param,new_url|
|
15
|
+
new_url.query_params[param].should == 'x'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should only explode query params with specified params" do
|
20
|
+
@params = ['dkp', 'catalog']
|
21
|
+
@url = URI('http://search.dhgate.com/search.do?dkp=1&searchkey=yarn&catalog=')
|
22
|
+
|
23
|
+
@urls = @url.explode_query_params('x', :included => @params)
|
24
|
+
@urls.each do |param,new_url|
|
25
|
+
@params.include?(param).should == true
|
26
|
+
new_url.query_params[param].should == 'x'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should not explode query params with certain params" do
|
31
|
+
@params = ['searchkey']
|
32
|
+
@url = URI('http://search.dhgate.com/search.do?dkp=1&searchkey=yarn&catalog=')
|
33
|
+
|
34
|
+
@urls = @url.explode_query_params('x', :excluded => @params)
|
35
|
+
@urls.each do |param,new_url|
|
36
|
+
@params.include?(param).should == false
|
37
|
+
new_url.query_params[param].should == 'x'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'ronin/extensions/uri'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe URI::QueryParams do
|
6
|
+
before(:each) do
|
7
|
+
@uri = URI('http://www.test.com/page.php?x=1&y=one%20two&z')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should provide #query_params" do
|
11
|
+
@uri.should respond_to(:query_params)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "#query_params should be a Hash" do
|
15
|
+
@uri.query_params.class.should == Hash
|
16
|
+
end
|
17
|
+
|
18
|
+
it "#query_params should contain params" do
|
19
|
+
@uri.query_params.empty?.should == false
|
20
|
+
end
|
21
|
+
|
22
|
+
it "#query_params can contain single-word params" do
|
23
|
+
@uri.query_params['x'].should == '1'
|
24
|
+
end
|
25
|
+
|
26
|
+
it "#query_params can contain multi-word params" do
|
27
|
+
@uri.query_params['y'].should == 'one two'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "#query_params can contain empty params" do
|
31
|
+
@uri.query_params['z'].should be_nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should update #query_params along with #query=" do
|
35
|
+
@uri.query = 'u=3'
|
36
|
+
@uri.query_params['u'].should == '3'
|
37
|
+
end
|
38
|
+
end
|