ruckus 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/README +0 -0
  4. data/README.markdown +51 -0
  5. data/Rakefile +54 -0
  6. data/VERSION +1 -0
  7. data/lib/ruckus.rb +70 -0
  8. data/lib/ruckus/blob.rb +113 -0
  9. data/lib/ruckus/choice.rb +55 -0
  10. data/lib/ruckus/dfuzz.rb +231 -0
  11. data/lib/ruckus/dictionary.rb +119 -0
  12. data/lib/ruckus/enum.rb +39 -0
  13. data/lib/ruckus/extensions/array.rb +33 -0
  14. data/lib/ruckus/extensions/class.rb +168 -0
  15. data/lib/ruckus/extensions/duplicable.rb +37 -0
  16. data/lib/ruckus/extensions/file.rb +24 -0
  17. data/lib/ruckus/extensions/fixnum.rb +26 -0
  18. data/lib/ruckus/extensions/hash.rb +10 -0
  19. data/lib/ruckus/extensions/integer.rb +26 -0
  20. data/lib/ruckus/extensions/ipaddr.rb +155 -0
  21. data/lib/ruckus/extensions/irb.rb +30 -0
  22. data/lib/ruckus/extensions/math.rb +6 -0
  23. data/lib/ruckus/extensions/module.rb +37 -0
  24. data/lib/ruckus/extensions/numeric.rb +117 -0
  25. data/lib/ruckus/extensions/object.rb +22 -0
  26. data/lib/ruckus/extensions/range.rb +16 -0
  27. data/lib/ruckus/extensions/socket.rb +20 -0
  28. data/lib/ruckus/extensions/string.rb +327 -0
  29. data/lib/ruckus/filter.rb +16 -0
  30. data/lib/ruckus/human_display.rb +79 -0
  31. data/lib/ruckus/ip.rb +38 -0
  32. data/lib/ruckus/mac_addr.rb +31 -0
  33. data/lib/ruckus/mutator.rb +318 -0
  34. data/lib/ruckus/null.rb +24 -0
  35. data/lib/ruckus/number.rb +360 -0
  36. data/lib/ruckus/parsel.rb +363 -0
  37. data/lib/ruckus/selector.rb +92 -0
  38. data/lib/ruckus/str.rb +164 -0
  39. data/lib/ruckus/structure.rb +263 -0
  40. data/lib/ruckus/structure/atcreate.rb +23 -0
  41. data/lib/ruckus/structure/beforebacks.rb +28 -0
  42. data/lib/ruckus/structure/defaults.rb +57 -0
  43. data/lib/ruckus/structure/factory.rb +42 -0
  44. data/lib/ruckus/structure/fixupfields.rb +16 -0
  45. data/lib/ruckus/structure/initializers.rb +14 -0
  46. data/lib/ruckus/structure/relate.rb +34 -0
  47. data/lib/ruckus/structure/replacement.rb +30 -0
  48. data/lib/ruckus/structure/searchmods.rb +33 -0
  49. data/lib/ruckus/structure/structureproxies.rb +28 -0
  50. data/lib/ruckus/structure/validate.rb +12 -0
  51. data/lib/ruckus/structure_shortcuts.rb +109 -0
  52. data/lib/ruckus/time_t.rb +26 -0
  53. data/lib/ruckus/vector.rb +97 -0
  54. data/ruckus.gemspec +104 -0
  55. data/test/test_decides.rb +61 -0
  56. data/test/test_mutator.rb +29 -0
  57. data/test/test_override.rb +23 -0
  58. data/test/test_replace.rb +39 -0
  59. metadata +138 -0
@@ -0,0 +1,104 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{ruckus}
8
+ s.version = "0.5.4"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["tduehr", "tqbf"]
12
+ s.date = %q{2010-04-16}
13
+ s.description = %q{Ruckus: A DOM-Inspired Ruby Smart Fuzzer}
14
+ s.email = %q{td@matasano.com}
15
+ s.extra_rdoc_files = [
16
+ "README",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "README",
23
+ "README.markdown",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/ruckus.rb",
27
+ "lib/ruckus/blob.rb",
28
+ "lib/ruckus/choice.rb",
29
+ "lib/ruckus/dfuzz.rb",
30
+ "lib/ruckus/dictionary.rb",
31
+ "lib/ruckus/enum.rb",
32
+ "lib/ruckus/extensions/array.rb",
33
+ "lib/ruckus/extensions/class.rb",
34
+ "lib/ruckus/extensions/duplicable.rb",
35
+ "lib/ruckus/extensions/file.rb",
36
+ "lib/ruckus/extensions/fixnum.rb",
37
+ "lib/ruckus/extensions/hash.rb",
38
+ "lib/ruckus/extensions/integer.rb",
39
+ "lib/ruckus/extensions/ipaddr.rb",
40
+ "lib/ruckus/extensions/irb.rb",
41
+ "lib/ruckus/extensions/math.rb",
42
+ "lib/ruckus/extensions/module.rb",
43
+ "lib/ruckus/extensions/numeric.rb",
44
+ "lib/ruckus/extensions/object.rb",
45
+ "lib/ruckus/extensions/range.rb",
46
+ "lib/ruckus/extensions/socket.rb",
47
+ "lib/ruckus/extensions/string.rb",
48
+ "lib/ruckus/filter.rb",
49
+ "lib/ruckus/human_display.rb",
50
+ "lib/ruckus/ip.rb",
51
+ "lib/ruckus/mac_addr.rb",
52
+ "lib/ruckus/mutator.rb",
53
+ "lib/ruckus/null.rb",
54
+ "lib/ruckus/number.rb",
55
+ "lib/ruckus/parsel.rb",
56
+ "lib/ruckus/selector.rb",
57
+ "lib/ruckus/str.rb",
58
+ "lib/ruckus/structure.rb",
59
+ "lib/ruckus/structure/atcreate.rb",
60
+ "lib/ruckus/structure/beforebacks.rb",
61
+ "lib/ruckus/structure/defaults.rb",
62
+ "lib/ruckus/structure/factory.rb",
63
+ "lib/ruckus/structure/fixupfields.rb",
64
+ "lib/ruckus/structure/initializers.rb",
65
+ "lib/ruckus/structure/relate.rb",
66
+ "lib/ruckus/structure/replacement.rb",
67
+ "lib/ruckus/structure/searchmods.rb",
68
+ "lib/ruckus/structure/structureproxies.rb",
69
+ "lib/ruckus/structure/validate.rb",
70
+ "lib/ruckus/structure_shortcuts.rb",
71
+ "lib/ruckus/time_t.rb",
72
+ "lib/ruckus/vector.rb",
73
+ "ruckus.gemspec",
74
+ "test/test_decides.rb",
75
+ "test/test_mutator.rb",
76
+ "test/test_override.rb",
77
+ "test/test_replace.rb"
78
+ ]
79
+ s.homepage = %q{http://github.com/tduehr/ruckus}
80
+ s.rdoc_options = ["--inline-source", "--line-numbers", "--main", "README.markdown"]
81
+ s.require_paths = ["lib"]
82
+ s.rubygems_version = %q{1.3.6}
83
+ s.summary = %q{A DOM-Inspired Ruby Smart Fuzzer}
84
+ s.test_files = [
85
+ "test/test_decides.rb",
86
+ "test/test_mutator.rb",
87
+ "test/test_override.rb",
88
+ "test/test_replace.rb"
89
+ ]
90
+
91
+ if s.respond_to? :specification_version then
92
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
93
+ s.specification_version = 3
94
+
95
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
96
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
97
+ else
98
+ s.add_dependency(%q<jeweler>, [">= 0"])
99
+ end
100
+ else
101
+ s.add_dependency(%q<jeweler>, [">= 0"])
102
+ end
103
+ end
104
+
@@ -0,0 +1,61 @@
1
+ require 'ruckus'
2
+ require 'test/unit'
3
+
4
+ class TestKlass < Ruckus::Structure
5
+ n32 :decider, :decides => {
6
+ 1 => :test_sub_klass1,
7
+ 2 => :test_sub_klass2
8
+ }
9
+ end
10
+
11
+ class TestSubKlass1 < TestKlass
12
+ n32 :decider, :value => 1
13
+ n32 :secondary_element
14
+ end
15
+
16
+ class TestSubKlass2 < TestKlass
17
+ n32 :decider, :value => 2
18
+ n32 :secondary_element
19
+ n32 :secondary_decider, :decides => {
20
+ 1 => :test_nested_decide1,
21
+ 2 => :test_nested_decide2,
22
+ 3 => :test_nested_decide3
23
+ }
24
+ end
25
+
26
+ class TestNestedDecide1 < TestSubKlass2
27
+ n32 :secondary_decider, :value => 1
28
+ n32 :ternary_element
29
+ end
30
+
31
+ class TestNestedDecide2 < TestSubKlass2
32
+ n32 :secondary_decider, :value => 2
33
+ n32 :ternary_element
34
+ end
35
+
36
+ class TestNestedDecide3 < TestSubKlass2
37
+ n32 :secondary_decider, :value => 3
38
+ n32 :ternary_element
39
+ end
40
+
41
+ class TestDecides < Test::Unit::TestCase
42
+ def test_decides
43
+ o, s = TestKlass.factory("\000\000\000\001\000\000\000\002\000\000\000\003\000\000\000\004")
44
+ assert_equal("\000\000\000\003\000\000\000\004",s)
45
+ assert_equal(TestSubKlass1, o.class)
46
+ assert_equal(1,o.decider.value)
47
+
48
+ o, s = TestKlass.factory("\000\000\000\002\000\000\000\002\000\000\000\003\000\000\000\004")
49
+ assert_equal(TestNestedDecide3, o.class)
50
+ assert_equal(4, o.ternary_element.value)
51
+
52
+ s = (tnd2 = TestNestedDecide2.new).capture("\000\000\000\001\000\000\000\002\000\000\000\002\000\000\000\004")
53
+ assert_equal("", s)
54
+
55
+ # assert_equal(1, tnd2.decider.value)
56
+ assert_equal(2, tnd2.secondary_element.value)
57
+ assert_equal(2, tnd2.secondary_decider.value)
58
+ assert_equal(4, tnd2.ternary_element.value)
59
+ flunk("Scoping issues - fails until test classes can be brought into the TestDecides class' scope")
60
+ end
61
+ end
@@ -0,0 +1,29 @@
1
+ require 'ruckus'
2
+ require 'test/unit'
3
+
4
+ class TestMutator < Test::Unit::TestCase
5
+ class TestMutation < Ruckus::Structure
6
+ n32 :mfield, :value => Ruckus::Mutator.random_int(:width => 32, :seed => 0)
7
+ n32 :field2, :value => 2
8
+ end
9
+
10
+ def test_mutator
11
+ tm = TestMutation.new
12
+ mut_int = tm.mfield.permute
13
+ pp mut_int
14
+ mfield, field2 = tm.to_s.unpack("NN")
15
+ assert_equal(mut_int, mfield)
16
+ assert_equal(mut_int, tm.mfield.value.to_i)
17
+ assert_equal(2, field2)
18
+ assert_equal(2, tm.field2.value)
19
+ mut_int2 = tm.mfield.permute
20
+ # assert_not_equal(mut_int, mut_int2)
21
+ # assert_not_equal(mut_int, tm.mfield.value.to_i)
22
+ assert_equal(mut_int2, tm.mfield.value.to_i)
23
+ assert_equal(2, field2)
24
+ assert_equal(2, tm.field2.value)
25
+ mfield, field2 = tm.to_s.unpack("NN")
26
+ assert_equal(2, field2)
27
+ assert_equal(mut_int2, mfield)
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ require 'ruckus'
2
+ require 'test/unit'
3
+
4
+ class TestOverride < Test::Unit::TestCase
5
+ class TestOverridden < Ruckus::Structure
6
+ n32 :primary, :value => 1
7
+ n32 :secondary, :value => 2
8
+ end
9
+
10
+ class TestOverrider < TestOverridden
11
+ override :primary, 2
12
+ override :secondary, 1
13
+ end
14
+
15
+ def test_override
16
+ overridden = TestOverridden.new
17
+ overrider = TestOverrider.new
18
+ assert_equal(overridden.primary.value, 1)
19
+ assert_equal(overridden.secondary.value, 2)
20
+ assert_equal(overrider.primary.value, 2)
21
+ assert_equal(overrider.secondary.value, 1)
22
+ end
23
+ end
@@ -0,0 +1,39 @@
1
+ require 'ruckus'
2
+ require 'test/unit'
3
+
4
+ class TestReplace < Test::Unit::TestCase
5
+ class TestReplaceKlass < Ruckus::Structure
6
+ n32 :element_one, :value => 1
7
+ n32 :element_two, :value => 2
8
+ n32 :element_three, :value => 3
9
+ end
10
+
11
+ class TestReplaceSubKlass < TestReplaceKlass
12
+ n32 :element_one, :value => 2
13
+ n32 :element_two, :value => 1
14
+ n32 :element_four, :value => 4
15
+ end
16
+
17
+ class TestReplaceStrKlass < TestReplaceKlass
18
+ str :element_one, :value => "element_one", :size => "element_one".size
19
+ str :element_four, :value => "element_four", :size => "element_four".size
20
+ end
21
+
22
+ def test_replace
23
+ tk = TestReplaceKlass.new
24
+ tsk = TestReplaceSubKlass.new
25
+ assert_equal(1, tk.element_one.value)
26
+ assert_equal(2, tk.element_two.value)
27
+ assert_equal(3, tk.element_three.value)
28
+ assert_equal(2, tsk.element_one.value)
29
+ assert_equal(1, tsk.element_two.value)
30
+ assert_equal(3, tsk.element_three.value)
31
+ assert_equal(4, tsk.element_four.value)
32
+ end
33
+
34
+ def test_type_replace
35
+ trsk = TestReplaceStrKlass.new
36
+ assert_equal("element_one", trsk.element_one.value)
37
+ assert_equal("element_four", trsk.element_four.value)
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruckus
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 4
9
+ version: 0.5.4
10
+ platform: ruby
11
+ authors:
12
+ - tduehr
13
+ - tqbf
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-04-16 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: jeweler
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
33
+ description: "Ruckus: A DOM-Inspired Ruby Smart Fuzzer"
34
+ email: td@matasano.com
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - README
41
+ - README.markdown
42
+ files:
43
+ - .document
44
+ - .gitignore
45
+ - README
46
+ - README.markdown
47
+ - Rakefile
48
+ - VERSION
49
+ - lib/ruckus.rb
50
+ - lib/ruckus/blob.rb
51
+ - lib/ruckus/choice.rb
52
+ - lib/ruckus/dfuzz.rb
53
+ - lib/ruckus/dictionary.rb
54
+ - lib/ruckus/enum.rb
55
+ - lib/ruckus/extensions/array.rb
56
+ - lib/ruckus/extensions/class.rb
57
+ - lib/ruckus/extensions/duplicable.rb
58
+ - lib/ruckus/extensions/file.rb
59
+ - lib/ruckus/extensions/fixnum.rb
60
+ - lib/ruckus/extensions/hash.rb
61
+ - lib/ruckus/extensions/integer.rb
62
+ - lib/ruckus/extensions/ipaddr.rb
63
+ - lib/ruckus/extensions/irb.rb
64
+ - lib/ruckus/extensions/math.rb
65
+ - lib/ruckus/extensions/module.rb
66
+ - lib/ruckus/extensions/numeric.rb
67
+ - lib/ruckus/extensions/object.rb
68
+ - lib/ruckus/extensions/range.rb
69
+ - lib/ruckus/extensions/socket.rb
70
+ - lib/ruckus/extensions/string.rb
71
+ - lib/ruckus/filter.rb
72
+ - lib/ruckus/human_display.rb
73
+ - lib/ruckus/ip.rb
74
+ - lib/ruckus/mac_addr.rb
75
+ - lib/ruckus/mutator.rb
76
+ - lib/ruckus/null.rb
77
+ - lib/ruckus/number.rb
78
+ - lib/ruckus/parsel.rb
79
+ - lib/ruckus/selector.rb
80
+ - lib/ruckus/str.rb
81
+ - lib/ruckus/structure.rb
82
+ - lib/ruckus/structure/atcreate.rb
83
+ - lib/ruckus/structure/beforebacks.rb
84
+ - lib/ruckus/structure/defaults.rb
85
+ - lib/ruckus/structure/factory.rb
86
+ - lib/ruckus/structure/fixupfields.rb
87
+ - lib/ruckus/structure/initializers.rb
88
+ - lib/ruckus/structure/relate.rb
89
+ - lib/ruckus/structure/replacement.rb
90
+ - lib/ruckus/structure/searchmods.rb
91
+ - lib/ruckus/structure/structureproxies.rb
92
+ - lib/ruckus/structure/validate.rb
93
+ - lib/ruckus/structure_shortcuts.rb
94
+ - lib/ruckus/time_t.rb
95
+ - lib/ruckus/vector.rb
96
+ - ruckus.gemspec
97
+ - test/test_decides.rb
98
+ - test/test_mutator.rb
99
+ - test/test_override.rb
100
+ - test/test_replace.rb
101
+ has_rdoc: true
102
+ homepage: http://github.com/tduehr/ruckus
103
+ licenses: []
104
+
105
+ post_install_message:
106
+ rdoc_options:
107
+ - --inline-source
108
+ - --line-numbers
109
+ - --main
110
+ - README.markdown
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ requirements: []
128
+
129
+ rubyforge_project:
130
+ rubygems_version: 1.3.6
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: A DOM-Inspired Ruby Smart Fuzzer
134
+ test_files:
135
+ - test/test_decides.rb
136
+ - test/test_mutator.rb
137
+ - test/test_override.rb
138
+ - test/test_replace.rb