ronin-support 0.3.0 → 0.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +77 -7
- data/README.md +19 -3
- data/gemspec.yml +2 -2
- data/lib/ronin/extensions/regexp.rb +50 -2
- data/lib/ronin/extensions/string.rb +1 -0
- data/lib/ronin/formatting.rb +1 -0
- data/lib/ronin/formatting/extensions.rb +1 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +56 -5
- data/lib/ronin/formatting/extensions/html/string.rb +6 -7
- data/lib/ronin/formatting/extensions/sql/string.rb +34 -0
- data/lib/ronin/formatting/extensions/text/string.rb +0 -180
- data/lib/ronin/fuzzing.rb +21 -0
- data/lib/ronin/fuzzing/extensions.rb +20 -0
- data/lib/ronin/fuzzing/extensions/string.rb +380 -0
- data/lib/ronin/fuzzing/fuzzing.rb +191 -0
- data/lib/ronin/network/esmtp.rb +94 -1
- data/lib/ronin/network/extensions/esmtp/net.rb +2 -82
- data/lib/ronin/network/extensions/http/net.rb +1 -736
- data/lib/ronin/network/extensions/imap/net.rb +1 -103
- data/lib/ronin/network/extensions/pop3/net.rb +1 -71
- data/lib/ronin/network/extensions/smtp/net.rb +2 -157
- data/lib/ronin/network/extensions/ssl/net.rb +1 -132
- data/lib/ronin/network/extensions/tcp/net.rb +2 -296
- data/lib/ronin/network/extensions/telnet/net.rb +1 -135
- data/lib/ronin/network/extensions/udp/net.rb +2 -214
- data/lib/ronin/network/http/http.rb +750 -5
- data/lib/ronin/network/imap.rb +105 -2
- data/lib/ronin/network/mixins.rb +1 -1
- data/lib/ronin/network/mixins/esmtp.rb +49 -52
- data/lib/ronin/network/mixins/http.rb +49 -53
- data/lib/ronin/network/mixins/imap.rb +47 -44
- data/lib/ronin/network/mixins/mixin.rb +58 -0
- data/lib/ronin/network/mixins/pop3.rb +44 -38
- data/lib/ronin/network/mixins/smtp.rb +49 -51
- data/lib/ronin/network/mixins/tcp.rb +56 -69
- data/lib/ronin/network/mixins/telnet.rb +57 -50
- data/lib/ronin/network/mixins/udp.rb +48 -52
- data/lib/ronin/network/network.rb +1 -0
- data/lib/ronin/network/pop3.rb +72 -2
- data/lib/ronin/network/smtp/email.rb +1 -0
- data/lib/ronin/network/smtp/smtp.rb +159 -3
- data/lib/ronin/network/ssl.rb +131 -2
- data/lib/ronin/network/tcp.rb +306 -1
- data/lib/ronin/network/telnet.rb +136 -2
- data/lib/ronin/network/udp.rb +229 -1
- data/lib/ronin/support.rb +2 -3
- data/lib/ronin/support/support.rb +38 -0
- data/lib/ronin/support/version.rb +1 -1
- data/lib/ronin/templates/erb.rb +2 -1
- data/lib/ronin/ui/output/helpers.rb +35 -1
- data/lib/ronin/ui/shell.rb +12 -2
- data/lib/ronin/wordlist.rb +157 -0
- data/spec/extensions/regexp_spec.rb +38 -0
- data/spec/formatting/html/string_spec.rb +1 -1
- data/spec/formatting/sql/string_spec.rb +23 -3
- data/spec/formatting/text/string_spec.rb +0 -110
- data/spec/fuzzing/string_spec.rb +158 -0
- data/spec/wordlist_spec.rb +65 -0
- metadata +35 -27
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ronin/fuzzing/extensions/string'
|
3
|
+
|
4
|
+
describe String do
|
5
|
+
it "should provide String.generate" do
|
6
|
+
described_class.should respond_to(:generate)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should provide String#repeating" do
|
10
|
+
subject.should respond_to(:repeating)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should provide String#fuzz" do
|
14
|
+
subject.should respond_to(:fuzz)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should provide String#mutate" do
|
18
|
+
subject.should respond_to(:mutate)
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "generate" do
|
22
|
+
subject { described_class }
|
23
|
+
|
24
|
+
it "should generate Strings from CharSets" do
|
25
|
+
strings = subject.generate(:lowercase_hexadecimal, :numeric).to_a
|
26
|
+
|
27
|
+
strings.grep(/^[0-9a-f][0-9]$/).should == strings
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should generate Strings from lengths of CharSets" do
|
31
|
+
strings = subject.generate([:numeric, 2]).to_a
|
32
|
+
|
33
|
+
strings.grep(/^[0-9]{2}$/).should == strings
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should generate Strings from varying lengths of CharSets" do
|
37
|
+
strings = subject.generate([:numeric, 1..2]).to_a
|
38
|
+
|
39
|
+
strings.grep(/^[0-9]{1,2}$/).should == strings
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should generate Strings from custom CharSets" do
|
43
|
+
strings = subject.generate([%w[a b c], 2]).to_a
|
44
|
+
|
45
|
+
strings.grep(/^[abc]{2}$/).should == strings
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should generate Strings containing known Strings" do
|
49
|
+
strings = subject.generate('foo', [%w[a b c], 2]).to_a
|
50
|
+
|
51
|
+
strings.grep(/^foo[abc]{2}$/).should == strings
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should raise a TypeError for non String, Symbol, Enumerable CharSets" do
|
55
|
+
lambda {
|
56
|
+
subject.generate([Object.new, 2]).to_a
|
57
|
+
}.should raise_error(TypeError)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should raise an ArgumentError for unknown CharSets" do
|
61
|
+
lambda {
|
62
|
+
subject.generate([:foo_bar, 2]).to_a
|
63
|
+
}.should raise_error(ArgumentError)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should raise a TypeError for non Integer,Array,Range lengths" do
|
67
|
+
lambda {
|
68
|
+
subject.generate([:numeric, 'foo']).to_a
|
69
|
+
}.should raise_error(TypeError)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#repeating" do
|
74
|
+
subject { 'A' }
|
75
|
+
|
76
|
+
context "when n is an Integer" do
|
77
|
+
let(:n) { 100 }
|
78
|
+
|
79
|
+
it "should multiply the String by n" do
|
80
|
+
subject.repeating(n).should == (subject * n)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context "when n is Enumerable" do
|
85
|
+
let(:n) { [128, 512, 1024] }
|
86
|
+
|
87
|
+
it "should repeat the String by each length" do
|
88
|
+
strings = subject.repeating(n).to_a
|
89
|
+
|
90
|
+
strings.should == n.map { |length| subject * length }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#fuzz" do
|
96
|
+
subject { 'GET /one/two/three' }
|
97
|
+
|
98
|
+
context "matching" do
|
99
|
+
it "should allow Regexps" do
|
100
|
+
fuzzed = subject.fuzz(/GET/ => ['get']).to_a
|
101
|
+
|
102
|
+
fuzzed.should == ['get /one/two/three']
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should allow Strings" do
|
106
|
+
fuzzed = subject.fuzz('GET' => ['get']).to_a
|
107
|
+
|
108
|
+
fuzzed.should == ['get /one/two/three']
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should match Symbols to Regexp constants" do
|
112
|
+
fuzzed = subject.fuzz(:absolute_path => ['../../../..']).to_a
|
113
|
+
|
114
|
+
fuzzed.should == ['GET ../../../..']
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "substitution" do
|
119
|
+
it "should allow Procs" do
|
120
|
+
fuzzed = subject.fuzz('GET' => [lambda { |s| s.downcase }]).to_a
|
121
|
+
|
122
|
+
fuzzed.should == ['get /one/two/three']
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should allow Integers" do
|
126
|
+
fuzzed = subject.fuzz(' ' => [0x09]).to_a
|
127
|
+
|
128
|
+
fuzzed.should == ["GET\t/one/two/three"]
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should map Symbols to Fuzzing methods" do
|
132
|
+
fuzzed = subject.fuzz(/\/.*/ => :format_strings).to_a
|
133
|
+
|
134
|
+
fuzzed.should_not == [subject]
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should incrementally replace each occurrence" do
|
138
|
+
fuzzed = subject.fuzz('/' => ["\n\r"]).to_a
|
139
|
+
|
140
|
+
fuzzed.should == [
|
141
|
+
"GET \n\rone/two/three",
|
142
|
+
"GET /one\n\rtwo/three",
|
143
|
+
"GET /one/two\n\rthree"
|
144
|
+
]
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should replace each occurrence with each substitution" do
|
148
|
+
fuzzed = subject.fuzz('GET' => ["\n\rGET", "G\n\rET", "GET\n\r"]).to_a
|
149
|
+
|
150
|
+
fuzzed.should == [
|
151
|
+
"\n\rGET /one/two/three",
|
152
|
+
"G\n\rET /one/two/three",
|
153
|
+
"GET\n\r /one/two/three"
|
154
|
+
]
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ronin/wordlist'
|
3
|
+
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
describe Wordlist do
|
7
|
+
let(:words) { %w[foo bar baz] }
|
8
|
+
|
9
|
+
before(:all) do
|
10
|
+
Tempfile.open('ronin-support-wordlist') do |file|
|
11
|
+
words.each { |word| file.puts word }
|
12
|
+
|
13
|
+
@path = file.path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
subject { described_class.new(words) }
|
18
|
+
|
19
|
+
describe "#initialize" do
|
20
|
+
it "should accept a list of words" do
|
21
|
+
subject.to_a.should == words
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should accept a path to a wordlist file" do
|
25
|
+
file = described_class.new(@path)
|
26
|
+
|
27
|
+
file.to_a.should == words
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#each_word" do
|
32
|
+
it "should raise a TypeError for non-String / non-Enumerable objects" do
|
33
|
+
wordlist = described_class.new(Object.new)
|
34
|
+
|
35
|
+
lambda {
|
36
|
+
wordlist.each_word { |word| }
|
37
|
+
}.should raise_error(TypeError)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#each" do
|
42
|
+
it "should rewind file lists" do
|
43
|
+
subject.each { |word| }
|
44
|
+
|
45
|
+
subject.to_a.should == words
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should apply additional mutation rules" do
|
49
|
+
wordlist = described_class.new(words)
|
50
|
+
wordlist.mutations['o'] = ['0']
|
51
|
+
|
52
|
+
wordlist.to_a.should == %w[foo f0o fo0 f00 bar baz]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#each_n_words" do
|
57
|
+
it "should enumerate over every combination of N words" do
|
58
|
+
subject.each_n_words(2).to_a.should == %w[
|
59
|
+
foofoo foobar foobaz
|
60
|
+
barfoo barbar barbaz
|
61
|
+
bazfoo bazbar bazbaz
|
62
|
+
]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0.rc1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chars
|
16
|
-
requirement: &
|
16
|
+
requirement: &11794840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *11794840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hexdump
|
27
|
-
requirement: &
|
27
|
+
requirement: &11792620 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.1'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *11792620
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: combinatorics
|
38
|
-
requirement: &
|
38
|
+
requirement: &11791900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,24 +43,21 @@ dependencies:
|
|
43
43
|
version: '0.4'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *11791900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: uri-query_params
|
49
|
-
requirement: &
|
49
|
+
requirement: &11791120 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
55
|
-
- - ! '>='
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 0.5.2
|
54
|
+
version: '0.6'
|
58
55
|
type: :runtime
|
59
56
|
prerelease: false
|
60
|
-
version_requirements: *
|
57
|
+
version_requirements: *11791120
|
61
58
|
- !ruby/object:Gem::Dependency
|
62
59
|
name: data_paths
|
63
|
-
requirement: &
|
60
|
+
requirement: &11789140 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
62
|
requirements:
|
66
63
|
- - ~>
|
@@ -68,24 +65,21 @@ dependencies:
|
|
68
65
|
version: '0.3'
|
69
66
|
type: :runtime
|
70
67
|
prerelease: false
|
71
|
-
version_requirements: *
|
68
|
+
version_requirements: *11789140
|
72
69
|
- !ruby/object:Gem::Dependency
|
73
70
|
name: parameters
|
74
|
-
requirement: &
|
71
|
+
requirement: &11788500 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
73
|
requirements:
|
77
74
|
- - ~>
|
78
75
|
- !ruby/object:Gem::Version
|
79
|
-
version: '0.
|
80
|
-
- - ! '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.2.3
|
76
|
+
version: '0.4'
|
83
77
|
type: :runtime
|
84
78
|
prerelease: false
|
85
|
-
version_requirements: *
|
79
|
+
version_requirements: *11788500
|
86
80
|
- !ruby/object:Gem::Dependency
|
87
81
|
name: bundler
|
88
|
-
requirement: &
|
82
|
+
requirement: &11787520 !ruby/object:Gem::Requirement
|
89
83
|
none: false
|
90
84
|
requirements:
|
91
85
|
- - ~>
|
@@ -93,10 +87,10 @@ dependencies:
|
|
93
87
|
version: 1.0.10
|
94
88
|
type: :development
|
95
89
|
prerelease: false
|
96
|
-
version_requirements: *
|
90
|
+
version_requirements: *11787520
|
97
91
|
- !ruby/object:Gem::Dependency
|
98
92
|
name: yard
|
99
|
-
requirement: &
|
93
|
+
requirement: &11787040 !ruby/object:Gem::Requirement
|
100
94
|
none: false
|
101
95
|
requirements:
|
102
96
|
- - ~>
|
@@ -104,7 +98,7 @@ dependencies:
|
|
104
98
|
version: 0.7.0
|
105
99
|
type: :development
|
106
100
|
prerelease: false
|
107
|
-
version_requirements: *
|
101
|
+
version_requirements: *11787040
|
108
102
|
description: Ronin Support is a support library for Ronin. Ronin Support contains
|
109
103
|
many of the convenience methods used by Ronin and additional libraries.
|
110
104
|
email: postmodern.mod3@gmail.com
|
@@ -159,6 +153,10 @@ files:
|
|
159
153
|
- lib/ronin/formatting/http.rb
|
160
154
|
- lib/ronin/formatting/sql.rb
|
161
155
|
- lib/ronin/formatting/text.rb
|
156
|
+
- lib/ronin/fuzzing.rb
|
157
|
+
- lib/ronin/fuzzing/extensions.rb
|
158
|
+
- lib/ronin/fuzzing/extensions/string.rb
|
159
|
+
- lib/ronin/fuzzing/fuzzing.rb
|
162
160
|
- lib/ronin/mixin.rb
|
163
161
|
- lib/ronin/network.rb
|
164
162
|
- lib/ronin/network/esmtp.rb
|
@@ -192,6 +190,7 @@ files:
|
|
192
190
|
- lib/ronin/network/mixins/esmtp.rb
|
193
191
|
- lib/ronin/network/mixins/http.rb
|
194
192
|
- lib/ronin/network/mixins/imap.rb
|
193
|
+
- lib/ronin/network/mixins/mixin.rb
|
195
194
|
- lib/ronin/network/mixins/pop3.rb
|
196
195
|
- lib/ronin/network/mixins/smtp.rb
|
197
196
|
- lib/ronin/network/mixins/tcp.rb
|
@@ -210,6 +209,7 @@ files:
|
|
210
209
|
- lib/ronin/spec/ui/output.rb
|
211
210
|
- lib/ronin/support.rb
|
212
211
|
- lib/ronin/support/inflector.rb
|
212
|
+
- lib/ronin/support/support.rb
|
213
213
|
- lib/ronin/support/version.rb
|
214
214
|
- lib/ronin/templates.rb
|
215
215
|
- lib/ronin/templates/erb.rb
|
@@ -221,11 +221,13 @@ files:
|
|
221
221
|
- lib/ronin/ui/output/terminal/color.rb
|
222
222
|
- lib/ronin/ui/output/terminal/raw.rb
|
223
223
|
- lib/ronin/ui/shell.rb
|
224
|
+
- lib/ronin/wordlist.rb
|
224
225
|
- ronin-support.gemspec
|
225
226
|
- spec/extensions/enumerable_spec.rb
|
226
227
|
- spec/extensions/file_spec.rb
|
227
228
|
- spec/extensions/ip_addr_spec.rb
|
228
229
|
- spec/extensions/kernel_spec.rb
|
230
|
+
- spec/extensions/regexp_spec.rb
|
229
231
|
- spec/extensions/resolv_spec.rb
|
230
232
|
- spec/extensions/string_spec.rb
|
231
233
|
- spec/formatting/binary/helpers/hexdumps.rb
|
@@ -260,6 +262,7 @@ files:
|
|
260
262
|
- spec/formatting/sql/string_spec.rb
|
261
263
|
- spec/formatting/text/array_spec.rb
|
262
264
|
- spec/formatting/text/string_spec.rb
|
265
|
+
- spec/fuzzing/string_spec.rb
|
263
266
|
- spec/mixin_spec.rb
|
264
267
|
- spec/network/http/http_spec.rb
|
265
268
|
- spec/network/http/proxy_spec.rb
|
@@ -280,6 +283,7 @@ files:
|
|
280
283
|
- spec/ui/classes/test_shell.rb
|
281
284
|
- spec/ui/output_spec.rb
|
282
285
|
- spec/ui/shell_spec.rb
|
286
|
+
- spec/wordlist_spec.rb
|
283
287
|
homepage: http://github.com/ronin-ruby/ronin-support
|
284
288
|
licenses:
|
285
289
|
- LGPL-3
|
@@ -310,6 +314,7 @@ test_files:
|
|
310
314
|
- spec/extensions/file_spec.rb
|
311
315
|
- spec/extensions/ip_addr_spec.rb
|
312
316
|
- spec/extensions/kernel_spec.rb
|
317
|
+
- spec/extensions/regexp_spec.rb
|
313
318
|
- spec/extensions/resolv_spec.rb
|
314
319
|
- spec/extensions/string_spec.rb
|
315
320
|
- spec/formatting/binary/integer_spec.rb
|
@@ -322,6 +327,7 @@ test_files:
|
|
322
327
|
- spec/formatting/sql/string_spec.rb
|
323
328
|
- spec/formatting/text/array_spec.rb
|
324
329
|
- spec/formatting/text/string_spec.rb
|
330
|
+
- spec/fuzzing/string_spec.rb
|
325
331
|
- spec/mixin_spec.rb
|
326
332
|
- spec/network/http/http_spec.rb
|
327
333
|
- spec/network/http/proxy_spec.rb
|
@@ -335,3 +341,5 @@ test_files:
|
|
335
341
|
- spec/templates/template_spec.rb
|
336
342
|
- spec/ui/output_spec.rb
|
337
343
|
- spec/ui/shell_spec.rb
|
344
|
+
- spec/wordlist_spec.rb
|
345
|
+
has_rdoc:
|