prodder-steps 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/lib/prodder-steps.rb +7 -0
- data/lib/prodder-steps/api.rb +13 -0
- data/lib/prodder-steps/cli.rb +3 -0
- data/lib/prodder-steps/cucumber.rb +9 -0
- data/lib/prodder-steps/headers.rb +25 -0
- data/lib/prodder-steps/ports.rb +32 -0
- data/lib/prodder-steps/ssl.rb +18 -0
- data/lib/prodder-steps/version.rb +5 -0
- data/prodder-steps.gemspec +27 -0
- metadata +161 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Gareth Rushgrove
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Prodder::Steps
|
2
|
+
|
3
|
+
[Prodder](https://github.com/garethr/prodder/) is a set of cucumber
|
4
|
+
features for testing various aspects of web application security. This
|
5
|
+
gem contains the steps used in Prodder and is intended to make writing
|
6
|
+
your own opinionated set of features easier.
|
7
|
+
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'prodder-steps'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install prodder-steps
|
22
|
+
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
For examples of usage see the
|
27
|
+
[Prodder](https://github.com/garethr/prodder/) project from which these
|
28
|
+
steps were extracted.
|
29
|
+
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Prodder
|
2
|
+
module Steps
|
3
|
+
module Api
|
4
|
+
def cli_installed?(bin_name)
|
5
|
+
`which #{bin_name}` && $?.success?
|
6
|
+
end
|
7
|
+
|
8
|
+
def ensure_cli_installed(bin)
|
9
|
+
raise "#{bin} is not installed or is not in your path" unless cli_installed?(bin)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
|
3
|
+
def canonical_header(header)
|
4
|
+
header.downcase.gsub('-', '_').to_sym
|
5
|
+
end
|
6
|
+
|
7
|
+
When(/^we request the site over "(.*?)"$/) do |protocol|
|
8
|
+
@response = RestClient.get "#{protocol.downcase}://#{ENV['HOST']}"
|
9
|
+
end
|
10
|
+
|
11
|
+
Then(/^the "(.*?)" header should be set to "(.*?)"$/) do |header, value|
|
12
|
+
@response.headers.should include(canonical_header(header) => value)
|
13
|
+
end
|
14
|
+
|
15
|
+
Then(/^the "(.*?)" header should not be set$/) do |header|
|
16
|
+
@response.headers.should_not have_key(canonical_header(header))
|
17
|
+
end
|
18
|
+
|
19
|
+
Then(/^the "(.*?)" header should be set$/) do |header|
|
20
|
+
@response.headers.should have_key(canonical_header(header))
|
21
|
+
end
|
22
|
+
|
23
|
+
Then(/^the "(.*?)" header should have the "(.*?)" attribute$/) do |header, attribute|
|
24
|
+
@response.headers[canonical_header(header)].to_s.should =~ /#{attribute}/
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'nmap/program'
|
3
|
+
require 'nmap/xml'
|
4
|
+
|
5
|
+
When(/^we scan the site for open ports$/) do
|
6
|
+
file = Tempfile.new('nmap.xml')
|
7
|
+
Nmap::Program.scan do |nmap|
|
8
|
+
nmap.xml = file.path
|
9
|
+
nmap.targets = ENV['HOST']
|
10
|
+
end
|
11
|
+
|
12
|
+
@open_ports = []
|
13
|
+
Nmap::XML.new(file.path) do |xml|
|
14
|
+
xml.each_host do |host|
|
15
|
+
host.each_port do |port|
|
16
|
+
@open_ports << port.number if port.state == :open
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Then(/^we should find port "(.*?)" open$/) do |port|
|
23
|
+
@open_ports.should include(port.to_i)
|
24
|
+
end
|
25
|
+
|
26
|
+
Then(/^we should find port "(.*?)" closed$/) do |port|
|
27
|
+
@open_ports.should_not include(port.to_i)
|
28
|
+
end
|
29
|
+
|
30
|
+
Then(/^we should find only "(.*?)" port open$/) do |number|
|
31
|
+
@open_ports.should have(number.to_i).items
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Before do
|
2
|
+
@aruba_timeout_seconds = 5
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^we test using the "(.*?)" protocol$/) do |protocol|
|
6
|
+
step("I run `sslyze.py --#{protocol} #{ENV['HOST']}`")
|
7
|
+
step("the exit status should be 0")
|
8
|
+
end
|
9
|
+
|
10
|
+
When(/^we check the certificate$/) do
|
11
|
+
step("I run `sslyze.py --certinfo=basic #{ENV['HOST']}`")
|
12
|
+
step("the exit status should be 0")
|
13
|
+
end
|
14
|
+
|
15
|
+
When(/^we test certificate renegotiation$/) do
|
16
|
+
step("I run `sslyze.py --reneg #{ENV['HOST']}`")
|
17
|
+
step("the exit status should be 0")
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'prodder-steps/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "prodder-steps"
|
8
|
+
gem.version = Prodder::Steps::VERSION
|
9
|
+
gem.authors = ["Gareth Rushgrove"]
|
10
|
+
gem.email = ["gareth@morethanseven.net"]
|
11
|
+
gem.description = "Cucumber steps for security testing"
|
12
|
+
gem.summary = "Extracted from the Prodder security testing suite"
|
13
|
+
gem.homepage = "https://github.com/garethr/prodder-steps"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_development_dependency 'rake'
|
21
|
+
|
22
|
+
gem.add_runtime_dependency 'aruba'
|
23
|
+
gem.add_runtime_dependency 'rest-client'
|
24
|
+
gem.add_runtime_dependency 'ruby-nmap'
|
25
|
+
gem.add_runtime_dependency 'cucumber'
|
26
|
+
gem.add_runtime_dependency 'rspec'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: prodder-steps
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gareth Rushgrove
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-11-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !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: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: aruba
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rest-client
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: ruby-nmap
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: cucumber
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
description: Cucumber steps for security testing
|
111
|
+
email:
|
112
|
+
- gareth@morethanseven.net
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- Gemfile
|
119
|
+
- LICENSE.txt
|
120
|
+
- README.md
|
121
|
+
- Rakefile
|
122
|
+
- lib/prodder-steps.rb
|
123
|
+
- lib/prodder-steps/api.rb
|
124
|
+
- lib/prodder-steps/cli.rb
|
125
|
+
- lib/prodder-steps/cucumber.rb
|
126
|
+
- lib/prodder-steps/headers.rb
|
127
|
+
- lib/prodder-steps/ports.rb
|
128
|
+
- lib/prodder-steps/ssl.rb
|
129
|
+
- lib/prodder-steps/version.rb
|
130
|
+
- prodder-steps.gemspec
|
131
|
+
homepage: https://github.com/garethr/prodder-steps
|
132
|
+
licenses: []
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
hash: -4184300659337990794
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ! '>='
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
hash: -4184300659337990794
|
155
|
+
requirements: []
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 1.8.24
|
158
|
+
signing_key:
|
159
|
+
specification_version: 3
|
160
|
+
summary: Extracted from the Prodder security testing suite
|
161
|
+
test_files: []
|