bigbench 0.0.1

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.
Files changed (92) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +4 -0
  3. data/README.textile +81 -0
  4. data/Rakefile +10 -0
  5. data/bigbench.gemspec +29 -0
  6. data/bin/bigbench +6 -0
  7. data/doc/BigBench.html +631 -0
  8. data/doc/BigBench/Benchmark.html +328 -0
  9. data/doc/BigBench/Benchmark/Benchmark.html +431 -0
  10. data/doc/BigBench/Bot.html +233 -0
  11. data/doc/BigBench/Configuration.html +312 -0
  12. data/doc/BigBench/Configuration/Config.html +375 -0
  13. data/doc/BigBench/Configuration/InvalidOptions.html +217 -0
  14. data/doc/BigBench/Executor.html +252 -0
  15. data/doc/BigBench/Executor/InvalidCommand.html +222 -0
  16. data/doc/BigBench/Fragment.html +404 -0
  17. data/doc/BigBench/Fragment/Fragment.html +384 -0
  18. data/doc/BigBench/Output.html +703 -0
  19. data/doc/BigBench/Runner.html +222 -0
  20. data/doc/BigBench/Runner/NoBenchmarksDefined.html +217 -0
  21. data/doc/BigBench/Store.html +639 -0
  22. data/doc/BigBench/Tracker.html +179 -0
  23. data/doc/BigBench/Tracker/Tracker.html +273 -0
  24. data/doc/Float.html +217 -0
  25. data/doc/Gemfile.html +129 -0
  26. data/doc/Helpers.html +163 -0
  27. data/doc/Object.html +181 -0
  28. data/doc/Rakefile.html +136 -0
  29. data/doc/TestWebServer.html +247 -0
  30. data/doc/created.rid +31 -0
  31. data/doc/images/add.png +0 -0
  32. data/doc/images/brick.png +0 -0
  33. data/doc/images/brick_link.png +0 -0
  34. data/doc/images/bug.png +0 -0
  35. data/doc/images/bullet_black.png +0 -0
  36. data/doc/images/bullet_toggle_minus.png +0 -0
  37. data/doc/images/bullet_toggle_plus.png +0 -0
  38. data/doc/images/date.png +0 -0
  39. data/doc/images/delete.png +0 -0
  40. data/doc/images/find.png +0 -0
  41. data/doc/images/loadingAnimation.gif +0 -0
  42. data/doc/images/macFFBgHack.png +0 -0
  43. data/doc/images/package.png +0 -0
  44. data/doc/images/page_green.png +0 -0
  45. data/doc/images/page_white_text.png +0 -0
  46. data/doc/images/page_white_width.png +0 -0
  47. data/doc/images/plugin.png +0 -0
  48. data/doc/images/ruby.png +0 -0
  49. data/doc/images/tag_blue.png +0 -0
  50. data/doc/images/tag_green.png +0 -0
  51. data/doc/images/transparent.png +0 -0
  52. data/doc/images/wrench.png +0 -0
  53. data/doc/images/wrench_orange.png +0 -0
  54. data/doc/images/zoom.png +0 -0
  55. data/doc/index.html +122 -0
  56. data/doc/js/darkfish.js +153 -0
  57. data/doc/js/jquery.js +18 -0
  58. data/doc/js/navigation.js +142 -0
  59. data/doc/js/search.js +94 -0
  60. data/doc/js/search_index.js +1 -0
  61. data/doc/js/searcher.js +228 -0
  62. data/doc/lib/bigbench/help/executor_txt.html +145 -0
  63. data/doc/rdoc.css +543 -0
  64. data/doc/table_of_contents.html +263 -0
  65. data/lib/bigbench.rb +18 -0
  66. data/lib/bigbench/benchmark.rb +126 -0
  67. data/lib/bigbench/bot.rb +34 -0
  68. data/lib/bigbench/configuration.rb +109 -0
  69. data/lib/bigbench/executor.rb +131 -0
  70. data/lib/bigbench/float_extensions.rb +6 -0
  71. data/lib/bigbench/fragment.rb +119 -0
  72. data/lib/bigbench/help/executor.txt +17 -0
  73. data/lib/bigbench/initializers.rb +2 -0
  74. data/lib/bigbench/output.rb +116 -0
  75. data/lib/bigbench/runner.rb +52 -0
  76. data/lib/bigbench/store.rb +92 -0
  77. data/lib/bigbench/tracker.rb +79 -0
  78. data/lib/bigbench/version.rb +3 -0
  79. data/spec/benchmark_spec.rb +69 -0
  80. data/spec/bot_spec.rb +31 -0
  81. data/spec/configure_spec.rb +39 -0
  82. data/spec/executor_spec.rb +80 -0
  83. data/spec/fragment_spec.rb +110 -0
  84. data/spec/helpers.rb +19 -0
  85. data/spec/lib/test_web_server.rb +18 -0
  86. data/spec/runner_spec.rb +40 -0
  87. data/spec/store_spec.rb +72 -0
  88. data/spec/tests/local.rb +15 -0
  89. data/spec/tests/local_invalid.rb +9 -0
  90. data/spec/tracker_spec.rb +50 -0
  91. data/spec/webserver_spec.rb +35 -0
  92. metadata +220 -0
@@ -0,0 +1,19 @@
1
+ require 'bigbench'
2
+ require 'rack'
3
+ require 'active_support/all'
4
+ require 'net/http'
5
+ require 'thin'
6
+ require 'lib/test_web_server'
7
+
8
+ module Helpers
9
+ end
10
+
11
+ RSpec.configure do |config|
12
+ config.include Helpers
13
+ config.before(:all) { TestWebServer.start }
14
+ config.after(:all) { TestWebServer.stop }
15
+ config.before(:each) {
16
+ BigBench::Configuration.reset!
17
+ BigBench::Benchmark.reset!
18
+ }
19
+ end
@@ -0,0 +1,18 @@
1
+ module TestWebServer
2
+ mattr_accessor :server
3
+
4
+ def self.start
5
+ TestWebServer.server = Thread.new {
6
+ app = proc { [200, {'Content-Type' => 'text/plain'}, ['Test']] }
7
+ Rack::Handler::Thin.run(app,:Port => 3001)
8
+ }
9
+ puts "Starting Test Webserver"
10
+ sleep 2
11
+ end
12
+
13
+ def self.stop
14
+ Thread.kill(TestWebServer.server)
15
+ puts "Stopping Test Webserver"
16
+ end
17
+
18
+ end
@@ -0,0 +1,40 @@
1
+ require_relative "./helpers"
2
+
3
+ describe BigBench::Runner do
4
+
5
+ it "should raise an exception if no benchmarks were defined" do
6
+ lambda {BigBench.run!}.should raise_error(BigBench::Runner::NoBenchmarksDefined, "Sorry, I couldn't find any benchmarks!")
7
+ end
8
+
9
+ it "should run all benchmarks" do
10
+ BigBench.benchmark "index page" => "http://localhost:3001" do
11
+ get "/"
12
+ end
13
+
14
+ BigBench.benchmark "login and logout" => "http://localhost:3001" do
15
+ post "/login"
16
+ post "/logout"
17
+ end
18
+
19
+ BigBench.benchmarks.size.should == 2
20
+ BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 0 }
21
+
22
+ BigBench.run!
23
+
24
+ BigBench.benchmarks.size.should == 2
25
+ BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 1 }
26
+ end
27
+
28
+ it "should load an external test and warn about the missing config" do
29
+ test = File.open("spec/tests/local_invalid.rb", "rb"){ |file| file.read }
30
+ lambda{ BigBench.load_test!(test) }.should raise_error(BigBench::Configuration::InvalidOptions, "At least: #{BigBench::Configuration::Config::VALIDATE_OPTIONS.join(', ')} are required")
31
+ end
32
+
33
+ it "should successfully load an external test" do
34
+ test = File.open("spec/tests/local.rb", "rb"){ |file| file.read }
35
+ BigBench.load_test!(test)
36
+
37
+ BigBench.benchmarks.size.should == 2
38
+ end
39
+
40
+ end
@@ -0,0 +1,72 @@
1
+ require_relative "./helpers"
2
+
3
+ describe BigBench::Store do
4
+
5
+ before(:each) do
6
+ BigBench::Store.reset!
7
+ end
8
+
9
+ it "should setup properly" do
10
+ BigBench::Store.setup!("http://localhost:6379").should be_true
11
+ end
12
+
13
+ it "should supply a method to store a test receipts" do
14
+ test = File.open("spec/tests/local.rb", "rb"){ |file| file.read }
15
+ BigBench::Store.test = test
16
+ BigBench::Store.test.should == test
17
+ end
18
+
19
+ it "should supply a method to global start a test" do
20
+ test = File.open("spec/tests/local.rb", "rb"){ |file| file.read }
21
+
22
+ BigBench::Store.start
23
+ BigBench::Store.running?.should == true
24
+
25
+ BigBench::Store.stop
26
+ BigBench::Store.running?.should == false
27
+ end
28
+
29
+ it "should allow bots to add and change their status" do
30
+ id, id2 = "8746528kbvs", "dsfoiasdgf"
31
+ BigBench::Store.bot_is_working(id)
32
+ BigBench::Store.bot_is_working(id2)
33
+ BigBench::Store.bots.size.should == 2
34
+
35
+ BigBench::Store.bot_stopped_working(id)
36
+ BigBench::Store.bots.size.should == 1
37
+
38
+ BigBench::Store.bot_stopped_working(id2)
39
+ BigBench::Store.bots.size.should == 0
40
+ end
41
+
42
+ it "should allow to append trackings" do
43
+ BigBench::Store.setup!("http://localhost:6379").should be_true
44
+
45
+ BigBench::Store.add_tracking "Number 1"
46
+ BigBench::Store.add_tracking "Number 2"
47
+ BigBench::Store.add_tracking "Number 3"
48
+ BigBench::Store.add_tracking "Number 4"
49
+
50
+ BigBench::Store.count_trackings.should == 4
51
+
52
+ BigBench::Store.pop_tracking.should == "Number 1"
53
+ BigBench::Store.pop_tracking.should == "Number 2"
54
+ BigBench::Store.pop_tracking.should == "Number 3"
55
+ BigBench::Store.pop_tracking.should == "Number 4"
56
+ end
57
+
58
+ it "should allow to reset all values" do
59
+ BigBench::Store.setup!("http://localhost:6379").should be_true
60
+
61
+ test = File.open("spec/tests/local.rb", "rb"){ |file| file.read }
62
+ BigBench::Store.test = test
63
+ BigBench::Store.start
64
+
65
+ BigBench::Store.reset!
66
+
67
+ BigBench::Store.running?.should == false
68
+ BigBench::Store.test.should == nil
69
+ BigBench::Store.bots.should be_empty
70
+ end
71
+
72
+ end
@@ -0,0 +1,15 @@
1
+ BigBench.configure = {
2
+ :duration => 1.seconds,
3
+ :output => "spec/temp/local.ljson",
4
+ :threads => 1
5
+ }
6
+
7
+ benchmark "index page" => "http://localhost:3001" do
8
+ get "/"
9
+ get "/index"
10
+ end
11
+
12
+ benchmark "login and logout" => "http://localhost:3001" do
13
+ post "/login"
14
+ post "/logout"
15
+ end
@@ -0,0 +1,9 @@
1
+ benchmark "index page" => "http://localhost:3001" do
2
+ get "/"
3
+ get "/index"
4
+ end
5
+
6
+ benchmark "login and logout" => "http://localhost:3001" do
7
+ post "/login"
8
+ post "/logout"
9
+ end
@@ -0,0 +1,50 @@
1
+ require_relative "./helpers"
2
+
3
+ describe BigBench::Tracker do
4
+
5
+ it "should track supplied objects" do
6
+ @tracker = BigBench::Tracker::Tracker.new
7
+ @tracker.track "a result"
8
+ @tracker.track "a result"
9
+ @tracker.track "a result"
10
+ @tracker.trackings.size.should == 3
11
+ end
12
+
13
+ it "should write trackings to the specified file in the local mode" do
14
+ BigBench.config.output = "spec/temp/test.ljson"
15
+ BigBench.benchmark "index page call" => "http://localhost:3001" do
16
+ get "/"
17
+ end
18
+
19
+ BigBench.run!
20
+ BigBench.write_local_trackings_to_file!
21
+
22
+ File.exist?("spec/temp/test.ljson").should be_true
23
+ File.open("spec/temp/test.ljson") do |file|
24
+ file.each_line{ |json| JSON.parse(json).is_a?(Hash).should be_true }
25
+ end
26
+
27
+ File.delete "spec/temp/test.ljson"
28
+ end
29
+
30
+ it "should gather the remote trackings and write them into a file" do
31
+ BigBench::Store.setup!("http://localhost:6379").should be_true
32
+ BigBench.config.output = "spec/temp/test.ljson"
33
+
34
+ BigBench::Store.add_tracking({ :tracking => true }.to_json)
35
+ BigBench::Store.add_tracking({ :tracking => true }.to_json)
36
+ BigBench::Store.add_tracking({ :tracking => true }.to_json)
37
+ BigBench::Store.add_tracking({ :tracking => true }.to_json)
38
+ BigBench::Store.add_tracking({ :tracking => true }.to_json)
39
+ BigBench::Store.count_trackings.should == 5
40
+
41
+ BigBench.write_store_trackings_to_file!
42
+
43
+ File.exist?("spec/temp/test.ljson").should be_true
44
+ File.open("spec/temp/test.ljson") do |file|
45
+ file.each_line{ |json| JSON.parse(json).is_a?(Hash).should be_true }
46
+ end
47
+
48
+ File.delete "spec/temp/test.ljson"
49
+ end
50
+ end
@@ -0,0 +1,35 @@
1
+ require_relative "./helpers"
2
+
3
+ describe TestWebServer do
4
+
5
+ it "should respond to mock GET requests" do
6
+ uri = URI('http://localhost:3001/')
7
+ Net::HTTP.start(uri.host, uri.port) do |http|
8
+ request = Net::HTTP::Get.new(uri.request_uri)
9
+ last_response = http.request(request)
10
+ last_response.code.should == '200'
11
+ last_response.body.should == 'Test'
12
+ end
13
+ end
14
+
15
+ it "should respond to mock POST requests" do
16
+ uri = URI('http://localhost:3001/')
17
+ Net::HTTP.start(uri.host, uri.port) do |http|
18
+ request = Net::HTTP::Post.new(uri.request_uri)
19
+ last_response = http.request(request)
20
+ last_response.code.should == '200'
21
+ last_response.body.should == 'Test'
22
+ end
23
+ end
24
+
25
+ it "should respond to mock PUT requests" do
26
+ uri = URI('http://localhost:3001/')
27
+ Net::HTTP.start(uri.host, uri.port) do |http|
28
+ request = Net::HTTP::Put.new(uri.request_uri)
29
+ last_response = http.request(request)
30
+ last_response.code.should == '200'
31
+ last_response.body.should == 'Test'
32
+ end
33
+ end
34
+
35
+ end
metadata ADDED
@@ -0,0 +1,220 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bigbench
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Thomas Fankhauser
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70121129415100 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70121129415100
25
+ - !ruby/object:Gem::Dependency
26
+ name: active_support
27
+ requirement: &70121129414600 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70121129414600
36
+ - !ruby/object:Gem::Dependency
37
+ name: rack
38
+ requirement: &70121129414000 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70121129414000
47
+ - !ruby/object:Gem::Dependency
48
+ name: thin
49
+ requirement: &70121129413360 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70121129413360
58
+ - !ruby/object:Gem::Dependency
59
+ name: redis
60
+ requirement: &70121129412600 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70121129412600
69
+ - !ruby/object:Gem::Dependency
70
+ name: active_support
71
+ requirement: &70121129412080 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *70121129412080
80
+ description: Setup a network of bots only waiting to attack a few lonesome servers
81
+ and force them to their limits
82
+ email:
83
+ - tommylefunk@googlemail.com
84
+ executables:
85
+ - bigbench
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - .gitignore
90
+ - Gemfile
91
+ - README.textile
92
+ - Rakefile
93
+ - bigbench.gemspec
94
+ - bin/bigbench
95
+ - doc/BigBench.html
96
+ - doc/BigBench/Benchmark.html
97
+ - doc/BigBench/Benchmark/Benchmark.html
98
+ - doc/BigBench/Bot.html
99
+ - doc/BigBench/Configuration.html
100
+ - doc/BigBench/Configuration/Config.html
101
+ - doc/BigBench/Configuration/InvalidOptions.html
102
+ - doc/BigBench/Executor.html
103
+ - doc/BigBench/Executor/InvalidCommand.html
104
+ - doc/BigBench/Fragment.html
105
+ - doc/BigBench/Fragment/Fragment.html
106
+ - doc/BigBench/Output.html
107
+ - doc/BigBench/Runner.html
108
+ - doc/BigBench/Runner/NoBenchmarksDefined.html
109
+ - doc/BigBench/Store.html
110
+ - doc/BigBench/Tracker.html
111
+ - doc/BigBench/Tracker/Tracker.html
112
+ - doc/Float.html
113
+ - doc/Gemfile.html
114
+ - doc/Helpers.html
115
+ - doc/Object.html
116
+ - doc/Rakefile.html
117
+ - doc/TestWebServer.html
118
+ - doc/created.rid
119
+ - doc/images/add.png
120
+ - doc/images/brick.png
121
+ - doc/images/brick_link.png
122
+ - doc/images/bug.png
123
+ - doc/images/bullet_black.png
124
+ - doc/images/bullet_toggle_minus.png
125
+ - doc/images/bullet_toggle_plus.png
126
+ - doc/images/date.png
127
+ - doc/images/delete.png
128
+ - doc/images/find.png
129
+ - doc/images/loadingAnimation.gif
130
+ - doc/images/macFFBgHack.png
131
+ - doc/images/package.png
132
+ - doc/images/page_green.png
133
+ - doc/images/page_white_text.png
134
+ - doc/images/page_white_width.png
135
+ - doc/images/plugin.png
136
+ - doc/images/ruby.png
137
+ - doc/images/tag_blue.png
138
+ - doc/images/tag_green.png
139
+ - doc/images/transparent.png
140
+ - doc/images/wrench.png
141
+ - doc/images/wrench_orange.png
142
+ - doc/images/zoom.png
143
+ - doc/index.html
144
+ - doc/js/darkfish.js
145
+ - doc/js/jquery.js
146
+ - doc/js/navigation.js
147
+ - doc/js/search.js
148
+ - doc/js/search_index.js
149
+ - doc/js/searcher.js
150
+ - doc/lib/bigbench/help/executor_txt.html
151
+ - doc/rdoc.css
152
+ - doc/table_of_contents.html
153
+ - dump.rdb
154
+ - lib/bigbench.rb
155
+ - lib/bigbench/benchmark.rb
156
+ - lib/bigbench/bot.rb
157
+ - lib/bigbench/configuration.rb
158
+ - lib/bigbench/executor.rb
159
+ - lib/bigbench/float_extensions.rb
160
+ - lib/bigbench/fragment.rb
161
+ - lib/bigbench/help/executor.txt
162
+ - lib/bigbench/initializers.rb
163
+ - lib/bigbench/output.rb
164
+ - lib/bigbench/runner.rb
165
+ - lib/bigbench/store.rb
166
+ - lib/bigbench/tracker.rb
167
+ - lib/bigbench/version.rb
168
+ - spec/benchmark_spec.rb
169
+ - spec/bot_spec.rb
170
+ - spec/configure_spec.rb
171
+ - spec/executor_spec.rb
172
+ - spec/fragment_spec.rb
173
+ - spec/helpers.rb
174
+ - spec/lib/test_web_server.rb
175
+ - spec/runner_spec.rb
176
+ - spec/store_spec.rb
177
+ - spec/tests/local.rb
178
+ - spec/tests/local_invalid.rb
179
+ - spec/tracker_spec.rb
180
+ - spec/webserver_spec.rb
181
+ homepage: http://southdesign.github.com/bigbench
182
+ licenses: []
183
+ post_install_message:
184
+ rdoc_options:
185
+ - --include
186
+ - lib/bigbench/help/
187
+ require_paths:
188
+ - lib
189
+ required_ruby_version: !ruby/object:Gem::Requirement
190
+ none: false
191
+ requirements:
192
+ - - ! '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ required_rubygems_version: !ruby/object:Gem::Requirement
196
+ none: false
197
+ requirements:
198
+ - - ! '>='
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ requirements: []
202
+ rubyforge_project: bigbench
203
+ rubygems_version: 1.8.15
204
+ signing_key:
205
+ specification_version: 3
206
+ summary: A large scale ruby penetration tool
207
+ test_files:
208
+ - spec/benchmark_spec.rb
209
+ - spec/bot_spec.rb
210
+ - spec/configure_spec.rb
211
+ - spec/executor_spec.rb
212
+ - spec/fragment_spec.rb
213
+ - spec/helpers.rb
214
+ - spec/lib/test_web_server.rb
215
+ - spec/runner_spec.rb
216
+ - spec/store_spec.rb
217
+ - spec/tests/local.rb
218
+ - spec/tests/local_invalid.rb
219
+ - spec/tracker_spec.rb
220
+ - spec/webserver_spec.rb