ronin 0.1.2 → 0.1.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 +58 -25
- data/Manifest.txt +15 -16
- data/README.txt +16 -11
- data/Rakefile +9 -7
- data/TODO.txt +6 -1
- data/lib/ronin.rb +1 -1
- data/lib/ronin/arch.rb +7 -15
- data/lib/ronin/author.rb +1 -1
- data/lib/ronin/cache.rb +1 -1
- data/lib/ronin/cache/cache.rb +1 -1
- data/lib/ronin/cache/config.rb +1 -1
- data/lib/ronin/cache/exceptions.rb +1 -1
- data/lib/ronin/cache/exceptions/extension_not_found.rb +1 -1
- data/lib/ronin/cache/exceptions/overlay_cached.rb +1 -1
- data/lib/ronin/cache/exceptions/overlay_not_found.rb +1 -1
- data/lib/ronin/cache/extension.rb +15 -190
- data/lib/ronin/cache/extension_cache.rb +2 -2
- data/lib/ronin/cache/maintainer.rb +1 -1
- data/lib/ronin/cache/overlay.rb +8 -7
- data/lib/ronin/cache/overlay_cache.rb +1 -1
- data/lib/ronin/cache/ronin.rb +1 -1
- data/lib/ronin/chars.rb +1 -1
- data/lib/ronin/chars/char_set.rb +1 -1
- data/lib/ronin/chars/chars.rb +1 -1
- data/lib/ronin/code/emittable.rb +1 -1
- data/lib/ronin/code/reference.rb +1 -1
- data/lib/ronin/code/symbol_table.rb +1 -1
- data/lib/ronin/code/token.rb +1 -1
- data/lib/ronin/config.rb +16 -9
- data/lib/ronin/database.rb +2 -113
- data/lib/ronin/database/database.rb +124 -0
- data/lib/ronin/{exceptions/unknown_context.rb → database/exceptions.rb} +2 -5
- data/lib/ronin/{exceptions/context_not_found.rb → database/exceptions/invalid_config.rb} +4 -2
- data/lib/ronin/extensions.rb +1 -1
- data/lib/ronin/extensions/hash.rb +1 -1
- data/lib/ronin/extensions/meta.rb +1 -1
- data/lib/ronin/extensions/string.rb +1 -1
- data/lib/ronin/extensions/uri.rb +1 -1
- data/lib/ronin/extensions/uri/http.rb +1 -1
- data/lib/ronin/extensions/uri/query_params.rb +1 -1
- data/lib/ronin/formatting.rb +1 -1
- data/lib/ronin/formatting/binary.rb +1 -1
- data/lib/ronin/formatting/digest.rb +1 -1
- data/lib/ronin/formatting/extensions.rb +1 -1
- data/lib/ronin/formatting/extensions/binary.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/integer.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/string.rb +1 -1
- data/lib/ronin/formatting/extensions/digest.rb +1 -1
- data/lib/ronin/formatting/extensions/digest/string.rb +1 -1
- data/lib/ronin/formatting/extensions/html.rb +1 -1
- data/lib/ronin/formatting/extensions/html/string.rb +1 -1
- data/lib/ronin/formatting/extensions/http.rb +1 -1
- data/lib/ronin/formatting/extensions/http/string.rb +1 -1
- data/lib/ronin/formatting/extensions/text.rb +1 -1
- data/lib/ronin/formatting/extensions/text/string.rb +1 -1
- data/lib/ronin/formatting/html.rb +1 -1
- data/lib/ronin/formatting/http.rb +1 -1
- data/lib/ronin/formatting/text.rb +1 -1
- data/lib/ronin/{pending_context.rb → has_license.rb} +21 -22
- data/lib/ronin/hexdump.rb +1 -1
- data/lib/ronin/hexdump/extensions.rb +1 -1
- data/lib/ronin/hexdump/extensions/file.rb +1 -1
- data/lib/ronin/hexdump/extensions/kernel.rb +1 -1
- data/lib/ronin/hexdump/hexdump.rb +1 -1
- data/lib/ronin/license.rb +10 -15
- data/lib/ronin/model.rb +14 -12
- data/lib/ronin/models.rb +2 -2
- data/lib/ronin/network.rb +1 -1
- data/lib/ronin/network/esmtp.rb +1 -1
- data/lib/ronin/network/extensions.rb +1 -1
- data/lib/ronin/network/extensions/esmtp.rb +1 -1
- data/lib/ronin/network/extensions/esmtp/net.rb +1 -1
- data/lib/ronin/network/extensions/http.rb +1 -1
- data/lib/ronin/network/extensions/http/net.rb +1 -1
- data/lib/ronin/network/extensions/imap.rb +1 -1
- data/lib/ronin/network/extensions/imap/net.rb +1 -1
- data/lib/ronin/network/extensions/pop3.rb +1 -1
- data/lib/ronin/network/extensions/pop3/net.rb +1 -1
- data/lib/ronin/network/extensions/smtp.rb +1 -1
- data/lib/ronin/network/extensions/smtp/net.rb +1 -1
- data/lib/ronin/network/extensions/tcp.rb +1 -1
- data/lib/ronin/network/extensions/tcp/net.rb +17 -1
- data/lib/ronin/network/extensions/telnet.rb +1 -1
- data/lib/ronin/network/extensions/telnet/net.rb +1 -1
- data/lib/ronin/network/extensions/udp.rb +1 -1
- data/lib/ronin/network/extensions/udp/net.rb +1 -1
- data/lib/ronin/network/http.rb +1 -1
- data/lib/ronin/network/http/exceptions.rb +1 -1
- data/lib/ronin/network/http/exceptions/unknown_request.rb +1 -1
- data/lib/ronin/network/imap.rb +1 -1
- data/lib/ronin/network/pop3.rb +1 -1
- data/lib/ronin/network/smtp.rb +1 -1
- data/lib/ronin/network/smtp/email.rb +1 -1
- data/lib/ronin/network/smtp/smtp.rb +1 -1
- data/lib/ronin/network/tcp.rb +1 -1
- data/lib/ronin/network/telnet.rb +1 -1
- data/lib/ronin/network/udp.rb +1 -1
- data/lib/ronin/objectify.rb +24 -0
- data/lib/ronin/{exceptions/invalid_database_config.rb → objectify/exceptions.rb} +3 -5
- data/lib/ronin/{exceptions → objectify/exceptions}/object_context_not_found.rb +1 -1
- data/lib/ronin/{exceptions → objectify/exceptions}/unknown_object_context.rb +1 -1
- data/lib/ronin/{object_context.rb → objectify/objectify.rb} +54 -45
- data/lib/ronin/path.rb +1 -1
- data/lib/ronin/platform.rb +3 -1
- data/lib/ronin/product.rb +2 -1
- data/lib/ronin/ronin.rb +10 -10
- data/lib/ronin/rpc.rb +1 -1
- data/lib/ronin/rpc/call.rb +1 -1
- data/lib/ronin/rpc/client.rb +1 -1
- data/lib/ronin/rpc/console.rb +1 -1
- data/lib/ronin/rpc/exceptions.rb +1 -1
- data/lib/ronin/rpc/exceptions/not_implemented.rb +1 -1
- data/lib/ronin/rpc/exceptions/response_missing.rb +1 -1
- data/lib/ronin/rpc/response.rb +1 -1
- data/lib/ronin/rpc/service.rb +1 -1
- data/lib/ronin/rpc/shell.rb +1 -1
- data/lib/ronin/sessions.rb +1 -1
- data/lib/ronin/sessions/esmtp.rb +6 -8
- data/lib/ronin/sessions/http.rb +1 -1
- data/lib/ronin/sessions/imap.rb +6 -8
- data/lib/ronin/sessions/pop3.rb +6 -8
- data/lib/ronin/sessions/session.rb +1 -1
- data/lib/ronin/sessions/smtp.rb +6 -8
- data/lib/ronin/sessions/tcp.rb +48 -36
- data/lib/ronin/sessions/telnet.rb +7 -10
- data/lib/ronin/sessions/udp.rb +28 -29
- data/lib/ronin/sessions/web.rb +5 -7
- data/lib/ronin/target.rb +1 -0
- data/lib/ronin/translators/translator.rb +1 -1
- data/lib/ronin/ui/command_line.rb +1 -1
- data/lib/ronin/ui/command_line/command.rb +1 -1
- data/lib/ronin/ui/command_line/command_line.rb +7 -2
- data/lib/ronin/ui/command_line/commands.rb +2 -2
- data/lib/ronin/ui/command_line/commands/add.rb +8 -8
- data/lib/ronin/ui/command_line/commands/default.rb +1 -1
- data/lib/ronin/ui/command_line/commands/extension.rb +13 -26
- data/lib/ronin/ui/command_line/commands/help.rb +1 -1
- data/lib/ronin/ui/command_line/commands/install.rb +7 -7
- data/lib/ronin/ui/command_line/commands/list.rb +13 -7
- data/lib/ronin/ui/command_line/commands/overlay.rb +1 -1
- data/lib/ronin/ui/command_line/commands/remove.rb +4 -4
- data/lib/ronin/ui/command_line/commands/uninstall.rb +4 -4
- data/lib/ronin/ui/command_line/commands/update.rb +3 -3
- data/lib/ronin/ui/command_line/exceptions.rb +1 -1
- data/lib/ronin/ui/command_line/exceptions/unknown_command.rb +1 -1
- data/lib/ronin/ui/command_line/options.rb +1 -1
- data/lib/ronin/ui/command_line/param_parser.rb +73 -0
- data/lib/ronin/ui/console.rb +1 -1
- data/lib/ronin/ui/shell.rb +1 -1
- data/lib/ronin/version.rb +2 -2
- data/lib/ronin/web.rb +1 -1
- data/lib/ronin/web/web.rb +1 -1
- data/spec/chars/char_set_spec.rb +116 -118
- data/spec/chars/chars_spec.rb +54 -63
- data/spec/formatting/{binary_spec.rb → binary/integer_spec.rb} +0 -19
- data/spec/formatting/binary/string_spec.rb +32 -0
- data/spec/{object_context/object_context_spec.rb → objectify/objectify_spec.rb} +5 -3
- data/spec/path_spec.rb +21 -23
- data/spec/translators/translator_spec.rb +38 -40
- data/spec/ui/command_line/param_parser_spec.rb +58 -0
- data/static/extension.rb +9 -0
- metadata +43 -24
- data/lib/ronin/context.rb +0 -236
- data/spec/context/context_spec.rb +0 -84
- data/spec/context/helpers/book_context.rb +0 -15
- data/spec/context/helpers/book_review_context.rb +0 -21
- data/spec/context/helpers/contexts/neuromancer_review.rb +0 -15
- data/spec/context/helpers/contexts/snow_crash.rb +0 -8
- data/static/extension.rb.erb +0 -16
data/lib/ronin/ui/console.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Ronin - A Ruby platform designed for information security and data
|
|
4
4
|
# exploration tasks.
|
|
5
5
|
#
|
|
6
|
-
# Copyright (c) 2006-
|
|
6
|
+
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
7
|
#
|
|
8
8
|
# This program is free software; you can redistribute it and/or modify
|
|
9
9
|
# it under the terms of the GNU General Public License as published by
|
data/lib/ronin/ui/shell.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Ronin - A Ruby platform designed for information security and data
|
|
4
4
|
# exploration tasks.
|
|
5
5
|
#
|
|
6
|
-
# Copyright (c) 2006-
|
|
6
|
+
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
7
|
#
|
|
8
8
|
# This program is free software; you can redistribute it and/or modify
|
|
9
9
|
# it under the terms of the GNU General Public License as published by
|
data/lib/ronin/version.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Ronin - A Ruby platform designed for information security and data
|
|
4
4
|
# exploration tasks.
|
|
5
5
|
#
|
|
6
|
-
# Copyright (c) 2006-
|
|
6
|
+
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
7
|
#
|
|
8
8
|
# This program is free software; you can redistribute it and/or modify
|
|
9
9
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
|
|
24
24
|
module Ronin
|
|
25
25
|
# Ronin version
|
|
26
|
-
VERSION = '0.1.
|
|
26
|
+
VERSION = '0.1.3'
|
|
27
27
|
end
|
data/lib/ronin/web.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Ronin - A Ruby platform designed for information security and data
|
|
4
4
|
# exploration tasks.
|
|
5
5
|
#
|
|
6
|
-
# Copyright (c) 2006-
|
|
6
|
+
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
7
|
#
|
|
8
8
|
# This program is free software; you can redistribute it and/or modify
|
|
9
9
|
# it under the terms of the GNU General Public License as published by
|
data/lib/ronin/web/web.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Ronin - A Ruby platform designed for information security and data
|
|
4
4
|
# exploration tasks.
|
|
5
5
|
#
|
|
6
|
-
# Copyright (c) 2006-
|
|
6
|
+
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
7
|
#
|
|
8
8
|
# This program is free software; you can redistribute it and/or modify
|
|
9
9
|
# it under the terms of the GNU General Public License as published by
|
data/spec/chars/char_set_spec.rb
CHANGED
|
@@ -2,176 +2,174 @@ require 'ronin/chars/chars'
|
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
|
-
describe
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
5
|
+
describe Chars::CharSet do
|
|
6
|
+
before(:all) do
|
|
7
|
+
@integer_range = (0x41..0x43)
|
|
8
|
+
@string_range = ('A'..'C')
|
|
9
|
+
@integers = @integer_range.to_a
|
|
10
|
+
@strings = @string_range.to_a
|
|
11
|
+
|
|
12
|
+
@char_set = Chars::CharSet.new(*@strings)
|
|
13
|
+
end
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
it "may be created with String arguments" do
|
|
16
|
+
@chars = Chars::CharSet.new(*@strings)
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
end
|
|
18
|
+
@strings.each do |s|
|
|
19
|
+
@chars.include_char?(s).should == true
|
|
22
20
|
end
|
|
21
|
+
end
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
it "may be created with an Array of Strings" do
|
|
24
|
+
@chars = Chars::CharSet.new(@strings)
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
end
|
|
26
|
+
@strings.each do |s|
|
|
27
|
+
@chars.include_char?(s).should == true
|
|
30
28
|
end
|
|
29
|
+
end
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
it "may be created with a Range of Strings" do
|
|
32
|
+
@chars = Chars::CharSet.new(@string_range)
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
end
|
|
34
|
+
@strings.each do |s|
|
|
35
|
+
@chars.include_char?(s).should == true
|
|
38
36
|
end
|
|
37
|
+
end
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
it "may be created with Integer arguments" do
|
|
40
|
+
@chars = Chars::CharSet.new(*@integers)
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
end
|
|
42
|
+
@integers.each do |i|
|
|
43
|
+
@chars.include?(i).should == true
|
|
46
44
|
end
|
|
45
|
+
end
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
it "may be created with an Array of Integers" do
|
|
48
|
+
@chars = Chars::CharSet.new(@integers)
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
end
|
|
50
|
+
@integers.each do |i|
|
|
51
|
+
@chars.include?(i).should == true
|
|
54
52
|
end
|
|
53
|
+
end
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
it "may be created with a Range of Integers" do
|
|
56
|
+
@chars = Chars::CharSet.new(@integer_range)
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
end
|
|
58
|
+
@integers.each do |i|
|
|
59
|
+
@chars.include?(i).should == true
|
|
62
60
|
end
|
|
61
|
+
end
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
it "should include Strings" do
|
|
64
|
+
@char_set.include_char?('A').should == true
|
|
65
|
+
end
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
it "should include Integers" do
|
|
68
|
+
@char_set.include?(0x41).should == true
|
|
69
|
+
end
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
it "should be able to select bytes" do
|
|
72
|
+
@sub_chars = @char_set.select_bytes { |c| c <= 0x42 }
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
@sub_chars.should == [0x41, 0x42]
|
|
75
|
+
end
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
it "should be able to select chars" do
|
|
78
|
+
@sub_chars = @char_set.select_chars { |c| c <= 'B' }
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
@sub_chars.should == ['A', 'B']
|
|
81
|
+
end
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
it "should return a random byte" do
|
|
84
|
+
@char_set.include?(@char_set.random_byte).should == true
|
|
85
|
+
end
|
|
87
86
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
it "should return a random char" do
|
|
88
|
+
@char_set.include_char?(@char_set.random_char).should == true
|
|
89
|
+
end
|
|
91
90
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
end
|
|
91
|
+
it "should iterate over n random bytes" do
|
|
92
|
+
@char_set.each_random_byte(10) do |b|
|
|
93
|
+
@char_set.include?(b).should == true
|
|
96
94
|
end
|
|
95
|
+
end
|
|
97
96
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
end
|
|
97
|
+
it "should iterate over n random chars" do
|
|
98
|
+
@char_set.each_random_char(10) do |c|
|
|
99
|
+
@char_set.include_char?(c).should == true
|
|
102
100
|
end
|
|
101
|
+
end
|
|
103
102
|
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
it "should return a random Array of bytes" do
|
|
104
|
+
bytes = @char_set.random_bytes(10)
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
end
|
|
106
|
+
bytes.each do |b|
|
|
107
|
+
@char_set.include?(b).should == true
|
|
110
108
|
end
|
|
109
|
+
end
|
|
111
110
|
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
it "should return a random Array of chars" do
|
|
112
|
+
chars = @char_set.random_chars(10)
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
end
|
|
114
|
+
chars.each do |c|
|
|
115
|
+
@char_set.include_char?(c).should == true
|
|
118
116
|
end
|
|
117
|
+
end
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
it "should return a random Array of bytes with a varying length" do
|
|
120
|
+
bytes = @char_set.random_bytes(5..10)
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
end
|
|
122
|
+
bytes.length.between?(5, 10).should == true
|
|
123
|
+
bytes.each do |b|
|
|
124
|
+
@char_set.include?(b).should == true
|
|
127
125
|
end
|
|
126
|
+
end
|
|
128
127
|
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
it "should return a random Array of chars with a varying length" do
|
|
129
|
+
chars = @char_set.random_chars(5..10)
|
|
131
130
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
end
|
|
131
|
+
chars.length.between?(5, 10).should == true
|
|
132
|
+
chars.each do |c|
|
|
133
|
+
@char_set.include_char?(c).should == true
|
|
136
134
|
end
|
|
135
|
+
end
|
|
137
136
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
end
|
|
137
|
+
it "should return a random String of chars" do
|
|
138
|
+
@char_set.random_string(10).each_byte do |b|
|
|
139
|
+
@char_set.include?(b).should == true
|
|
142
140
|
end
|
|
141
|
+
end
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
it "should return a random String of chars with a varying length" do
|
|
144
|
+
string = @char_set.random_string(5..10)
|
|
146
145
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
end
|
|
146
|
+
string.length.between?(5, 10)
|
|
147
|
+
string.each_byte do |b|
|
|
148
|
+
@char_set.include?(b).should == true
|
|
151
149
|
end
|
|
150
|
+
end
|
|
152
151
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
it "should be able to be compared with another set of chars" do
|
|
153
|
+
(@char_set == Chars::CharSet['A', 'B', 'C']).should == true
|
|
154
|
+
(@char_set == Chars::CharSet['A', 'C', 'B']).should == true
|
|
155
|
+
end
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
it "should be able to be unioned with another set of chars" do
|
|
158
|
+
super_set = (@char_set | Chars::CharSet['D'])
|
|
160
159
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
super_set.class.should == Chars::CharSet
|
|
161
|
+
super_set.should == Chars::CharSet['A', 'B', 'C', 'D']
|
|
162
|
+
end
|
|
164
163
|
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
it "should be able to be removed from another set of chars" do
|
|
165
|
+
sub_set = (@char_set - Chars::CharSet['B'])
|
|
167
166
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
sub_set.class.should == Chars::CharSet
|
|
168
|
+
sub_set.subset?(@char_set).should == true
|
|
169
|
+
end
|
|
171
170
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
end
|
|
171
|
+
it "should determine if a String is made up of the characters from the char set" do
|
|
172
|
+
(@char_set =~ "AABCBAA").should == true
|
|
173
|
+
(@char_set =~ "AADDEE").should_not == true
|
|
176
174
|
end
|
|
177
175
|
end
|
data/spec/chars/chars_spec.rb
CHANGED
|
@@ -2,81 +2,72 @@ require 'ronin/chars/chars'
|
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
|
-
describe
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
5
|
+
describe Chars do
|
|
6
|
+
before(:all) do
|
|
7
|
+
@numeric_string = Chars.numeric.random_string(10)
|
|
8
|
+
@octal_string = Chars.octal.random_string(10)
|
|
9
|
+
@uppercase_hex_string = Chars.uppercase_hexadecimal.random_string(10)
|
|
10
|
+
@lowercase_hex_string = Chars.lowercase_hexadecimal.random_string(10)
|
|
11
|
+
@hex_string = Chars.hexadecimal.random_string(10)
|
|
12
|
+
@uppercase_alpha_string = Chars.uppercase_alpha.random_string(10)
|
|
13
|
+
@lowercase_alpha_string = Chars.lowercase_alpha.random_string(10)
|
|
14
|
+
@alpha_string = Chars.alpha.random_string(10)
|
|
15
|
+
@alpha_numeric = Chars.alpha_numeric.random_string(10)
|
|
16
|
+
@space_string = Chars.space.random_string(10)
|
|
17
|
+
@punctuation_string = Chars.punctuation.random_string(10)
|
|
18
|
+
@symbols_string = Chars.symbols.random_string(10)
|
|
19
|
+
@control_string = Chars.control.random_string(10)
|
|
20
|
+
@ascii_string = Chars.ascii.random_string(10)
|
|
21
|
+
@all_string = Chars.all.random_string(10)
|
|
22
|
+
end
|
|
36
23
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
it "should provide a numeric CharSet" do
|
|
25
|
+
(@numeric_string =~ /[0-9]{10}/).should_not be_nil
|
|
26
|
+
end
|
|
40
27
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
it "should provide an octal CharSet" do
|
|
29
|
+
(@octal_string =~ /[0-7]{10}/).should_not be_nil
|
|
30
|
+
end
|
|
44
31
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
it "should provide an upper-case hexadecimal CharSet" do
|
|
33
|
+
(@uppercase_hex_string =~ /[0-9A-F]{10}/).should_not be_nil
|
|
34
|
+
end
|
|
48
35
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
it "should provide a lower-case hexadecimal CharSet" do
|
|
37
|
+
(@lowercase_hex_string =~ /[0-9a-f]{10}/).should_not be_nil
|
|
38
|
+
end
|
|
52
39
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
it "should provide a hexadecimal CharSet" do
|
|
41
|
+
(@hex_string =~ /[0-9A-Fa-f]{10}/).should_not be_nil
|
|
42
|
+
end
|
|
56
43
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
it "should provide an upper-case alpha CharSet" do
|
|
45
|
+
(@uppercase_alpha_string =~ /[A-Z]{10}/).should_not be_nil
|
|
46
|
+
end
|
|
60
47
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
it "should provide a lower-case alpha CharSet" do
|
|
49
|
+
(@lowercase_alpha_string =~ /[a-z]{10}/).should_not be_nil
|
|
50
|
+
end
|
|
64
51
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
it "should provide an alpha CharSet" do
|
|
53
|
+
(@alpha_string =~ /[A-Za-z]{10}/).should_not be_nil
|
|
54
|
+
end
|
|
68
55
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
it "should provide an alpha-numeric CharSet" do
|
|
57
|
+
(@alpha_numeric_string =~ /[A-Za-z0-9]{10}/).should_not be_nil
|
|
58
|
+
end
|
|
72
59
|
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
it "should provide a space CharSet" do
|
|
61
|
+
(@space_string =~ /[ \f\n\r\t\v]{10}/).should_not be_nil
|
|
62
|
+
end
|
|
75
63
|
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
it "should provide a punctuation CharSet" do
|
|
65
|
+
(@punctuation_string =~ /[ \'\"\`\,\;\:\~\-\(\)\[\]\{\}\.\?\!]{10}/).should_not be_nil
|
|
66
|
+
end
|
|
78
67
|
|
|
79
|
-
|
|
68
|
+
it "should provide a symbols CharSet" do
|
|
69
|
+
pending "need to fix the testing regex" do
|
|
70
|
+
(@symbols_string =~ /[\@\#\$\%\^\&\*\_\+\=\|\\\<\>\/]{10}/).should_not be_nil
|
|
80
71
|
end
|
|
81
72
|
end
|
|
82
73
|
end
|