wdbomber 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 35b31bb97962d1728d31213f11bd50a1154fa231edd7fd62858866a5fd08ebdc
4
+ data.tar.gz: 0e8eb0723b1d2a94e410673a04f15f830961808cc7f727754eca3b28e8c09f75
5
+ SHA512:
6
+ metadata.gz: 42c1211573eaab795c8ed6718376b5946d1d27547a17726d8cffbcce4bb81fd5ac400df8f1f67d9492971affe8f2e2210b376a5f3691e0c8ce02531132bdc9dc
7
+ data.tar.gz: 475d7ec243fcee8d9bc569b653bf351b78bb7b44f136fd7d04f0a7acd59ccb48a5773547e83dcc5d3a2b29bef02b4a7c786c081f4ca81e9e5c2a433524fd1e06
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ wdbomber
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in wdbomber.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wdbomber (0.1.0)
5
+ superbot-selenium-webdriver
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ archive-zip (0.11.0)
11
+ io-like (~> 0.3.0)
12
+ childprocess (0.9.0)
13
+ ffi (~> 1.0, >= 1.0.11)
14
+ chromedriver-helper (2.1.0)
15
+ archive-zip (~> 0.10)
16
+ nokogiri (~> 1.8)
17
+ diff-lcs (1.3)
18
+ ffi (1.9.25)
19
+ io-like (0.3.0)
20
+ kommando (0.1.2)
21
+ mini_portile2 (2.3.0)
22
+ nokogiri (1.8.5)
23
+ mini_portile2 (~> 2.3.0)
24
+ rake (10.5.0)
25
+ rspec (3.8.0)
26
+ rspec-core (~> 3.8.0)
27
+ rspec-expectations (~> 3.8.0)
28
+ rspec-mocks (~> 3.8.0)
29
+ rspec-core (3.8.0)
30
+ rspec-support (~> 3.8.0)
31
+ rspec-expectations (3.8.2)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.8.0)
34
+ rspec-mocks (3.8.0)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.8.0)
37
+ rspec-support (3.8.0)
38
+ rubyzip (1.2.2)
39
+ selenium-webdriver (3.141.0)
40
+ childprocess (~> 0.5)
41
+ rubyzip (~> 1.2, >= 1.2.2)
42
+ superbot-selenium-webdriver (1.0.0)
43
+ chromedriver-helper (= 2.1.0)
44
+ selenium-webdriver (= 3.141.0)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 1.16)
51
+ kommando
52
+ rake (~> 10.0)
53
+ rspec (~> 3.0)
54
+ wdbomber!
55
+
56
+ BUNDLED WITH
57
+ 1.17.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Matti Paksula
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # wdbomber
2
+
3
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "wdbomber"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/wdbomber ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # add lib to libpath (only needed when running from the sources)
5
+ require 'pathname'
6
+ lib_path = File.expand_path('../../lib', Pathname.new(__FILE__).realpath)
7
+ $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
8
+
9
+ STDOUT.sync = true
10
+
11
+ require 'wdbomber'
12
+
13
+ endpoint = ARGV[0]
14
+ iterations = ARGV[1] ? Integer(ARGV[1]) : 0
15
+ concurrency = ARGV[2] ? Integer(ARGV[2]) : 1
16
+
17
+ Wdbomber.run! endpoint, iterations: iterations, concurrency: concurrency
@@ -0,0 +1,3 @@
1
+ module Wdbomber
2
+ VERSION = "0.1.0"
3
+ end
data/lib/wdbomber.rb ADDED
@@ -0,0 +1,62 @@
1
+ require "wdbomber/version"
2
+ require "selenium-webdriver"
3
+
4
+ Signal.trap("INT") {
5
+ if $SHUTDOWN_REQUESTED
6
+ puts "ANOTHER CONTROL+C DETECTED - EXITING"
7
+ exit 1
8
+ else
9
+ puts "REQUESTING SHUTDOWN, PLEASE WAIT - HIT ANOTHER CONTROL+C TO FORCE"
10
+ $SHUTDOWN_REQUESTED = true
11
+ end
12
+ }
13
+
14
+ module Wdbomber
15
+ def self.run!(endpoint, iterations:, concurrency:1, concurrency_delay:0)
16
+ STDERR.puts "attacking #{endpoint} #{iterations} times with #{concurrency} bombers"
17
+
18
+ desired_capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
19
+ if ENV["SUPERBOT_REGION"]
20
+ desired_capabilities['superOptions'] = {}
21
+ desired_capabilities['superOptions']['region'] = ENV["SUPERBOT_REGION"]
22
+ end
23
+
24
+ threads = []
25
+ concurrency.times do |t|
26
+ bomber = t+1
27
+ sleep t*concurrency_delay #for specs
28
+
29
+ threads << Thread.new do
30
+ iterations.times do |i|
31
+ if $SHUTDOWN_REQUESTED
32
+ puts "#{bomber}: SHUTDOWN"
33
+ break
34
+ end
35
+
36
+ iteration = i+1
37
+
38
+ started_at = Time.now
39
+ client = Selenium::WebDriver::Remote::Http::Default.new
40
+ client.read_timeout = 500
41
+ driver = Selenium::WebDriver.for :remote, {
42
+ url: endpoint,
43
+ desired_capabilities: desired_capabilities,
44
+ http_client: client,
45
+ }
46
+ driver.navigate.to "about:blank"
47
+ took = Time.now - started_at
48
+
49
+ puts "#{bomber}: took #{took.floor(1)}s (##{iteration}/#{iterations})"
50
+ rescue
51
+ puts "#{bomber}: EXCEPTION (#{iteration}/#{iterations})"
52
+ p $!
53
+ exit 1 unless ENV["WDBOMBER_KEEP_BOMBING"] == "true"
54
+ ensure
55
+ driver&.quit unless ENV["WDBOMBER_NO_QUIT"] == "true"
56
+ end
57
+ end
58
+ end
59
+
60
+ threads.each(&:join)
61
+ end
62
+ end
data/wdbomber.gemspec ADDED
@@ -0,0 +1,32 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "wdbomber/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "wdbomber"
8
+ spec.version = Wdbomber::VERSION
9
+ spec.authors = ["Matti Paksula"]
10
+ spec.email = ["matti.paksula@iki.fi"]
11
+
12
+ spec.summary = "bomb remote webdrivers"
13
+ spec.homepage = "https://github.com/matti/wdbomber"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency "superbot-selenium-webdriver"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.16"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ spec.add_development_dependency "kommando"
31
+
32
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wdbomber
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matti Paksula
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: superbot-selenium-webdriver
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: kommando
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - matti.paksula@iki.fi
86
+ executables:
87
+ - wdbomber
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".ruby-gemset"
94
+ - ".ruby-version"
95
+ - ".travis.yml"
96
+ - Gemfile
97
+ - Gemfile.lock
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - bin/console
102
+ - bin/setup
103
+ - exe/wdbomber
104
+ - lib/wdbomber.rb
105
+ - lib/wdbomber/version.rb
106
+ - wdbomber.gemspec
107
+ homepage: https://github.com/matti/wdbomber
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.7.7
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: bomb remote webdrivers
131
+ test_files: []