ronin-support 0.5.0.rc1 → 0.5.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +6 -1
- data/lib/ronin/fuzzing/extensions/string.rb +21 -208
- data/lib/ronin/fuzzing/fuzzer.rb +118 -0
- data/lib/ronin/fuzzing/fuzzing.rb +7 -2
- data/lib/ronin/fuzzing/mutator.rb +161 -0
- data/lib/ronin/fuzzing/repeater.rb +81 -0
- data/lib/ronin/fuzzing/template.rb +133 -0
- data/lib/ronin/network/mixins/http.rb +51 -580
- data/lib/ronin/support/version.rb +1 -1
- data/lib/ronin/wordlist.rb +9 -4
- data/spec/fuzzing/extensions/string_spec.rb +87 -0
- data/spec/fuzzing/fuzzer_spec.rb +109 -0
- data/spec/fuzzing/fuzzing_spec.rb +24 -0
- data/spec/fuzzing/mutator_spec.rb +112 -0
- data/spec/fuzzing/repeater_spec.rb +57 -0
- data/spec/fuzzing/template_spec.rb +54 -0
- data/spec/spec_helper.rb +3 -3
- metadata +12 -3
- data/spec/fuzzing/string_spec.rb +0 -158
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,7 @@ require 'ronin/support/version'
|
|
3
3
|
|
4
4
|
include Ronin
|
5
5
|
|
6
|
-
RSpec.configure do |
|
7
|
-
|
8
|
-
|
6
|
+
RSpec.configure do |specs|
|
7
|
+
specs.treat_symbols_as_metadata_keys_with_true_values = true
|
8
|
+
specs.filter_run_excluding :network
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0.
|
4
|
+
version: 0.5.0.rc2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chars
|
@@ -223,7 +223,11 @@ files:
|
|
223
223
|
- lib/ronin/fuzzing.rb
|
224
224
|
- lib/ronin/fuzzing/extensions.rb
|
225
225
|
- lib/ronin/fuzzing/extensions/string.rb
|
226
|
+
- lib/ronin/fuzzing/fuzzer.rb
|
226
227
|
- lib/ronin/fuzzing/fuzzing.rb
|
228
|
+
- lib/ronin/fuzzing/mutator.rb
|
229
|
+
- lib/ronin/fuzzing/repeater.rb
|
230
|
+
- lib/ronin/fuzzing/template.rb
|
227
231
|
- lib/ronin/mixin.rb
|
228
232
|
- lib/ronin/network.rb
|
229
233
|
- lib/ronin/network/dns.rb
|
@@ -352,7 +356,12 @@ files:
|
|
352
356
|
- spec/formatting/sql/string_spec.rb
|
353
357
|
- spec/formatting/text/array_spec.rb
|
354
358
|
- spec/formatting/text/string_spec.rb
|
355
|
-
- spec/fuzzing/string_spec.rb
|
359
|
+
- spec/fuzzing/extensions/string_spec.rb
|
360
|
+
- spec/fuzzing/fuzzer_spec.rb
|
361
|
+
- spec/fuzzing/fuzzing_spec.rb
|
362
|
+
- spec/fuzzing/mutator_spec.rb
|
363
|
+
- spec/fuzzing/repeater_spec.rb
|
364
|
+
- spec/fuzzing/template_spec.rb
|
356
365
|
- spec/mixin_spec.rb
|
357
366
|
- spec/network/dns_spec.rb
|
358
367
|
- spec/network/ftp_spec.rb
|
data/spec/fuzzing/string_spec.rb
DELETED
@@ -1,158 +0,0 @@
|
|
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
|