bugcrowd 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
+ SHA1:
3
+ metadata.gz: eef56a1cec5bfc4199a8b4c892d7b0ddc98e2f1a
4
+ data.tar.gz: db170da2a0a57a45b0cfe3b07a2adb37df6ed2a8
5
+ SHA512:
6
+ metadata.gz: 65959204e1eb4e2b571f8916cb52debbf5b0ce138ff34eb4140e5d8ce130ac8e426a67fd85ea5490470afb414bc8794a9ce61e0b112522fc37e83006941cbcb1
7
+ data.tar.gz: 371a4b9363682cd27cc53357ecd92611d3fb4b69bf158161972b5bfa98ef234d776fc8c1e42358720c2018f8337529042e24bbcdd04919522441306affe30abd
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.14.3
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Matthew Conway
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,45 @@
1
+ # Bugcrowd
2
+
3
+ (Unofficial) Ruby wrapper for the Bugcrowd HTTP API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'bugcrowd'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install bugcrowd
20
+
21
+ ## Usage
22
+
23
+ Locally or in production, expose your Bugcrowd API credentials via environment variables:
24
+
25
+ ```bash
26
+ export BUGCROWD_USER=yourusername
27
+ export BUGCROWD_PASSWORD=yourpass
28
+ ```
29
+
30
+ Then use the client in either of two ways:
31
+
32
+ ```ruby
33
+ Bugcrowd.list_bounties
34
+
35
+ client = Bugcrowd::Client.new(username: 'yourusername', password: 'yourpass')
36
+ client.list_bounties
37
+ ```
38
+
39
+ ## Development
40
+
41
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bugcrowd"
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/bugcrowd.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bugcrowd/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bugcrowd"
8
+ spec.version = Bugcrowd::VERSION
9
+ spec.authors = ["Matthew Conway"]
10
+ spec.email = ["conway@heroku.com"]
11
+
12
+ spec.summary = %q{Ruby wrapper for the Bugcrowd HTTP API}
13
+ spec.description = %q{Ruby wrapper for the Bugcrowd HTTP API}
14
+ spec.homepage = "https://github.com/mattreduce/bugcrowd"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "excon", "~> 0.55"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "minitest", "~> 5.0"
27
+ end
data/lib/bugcrowd.rb ADDED
@@ -0,0 +1,22 @@
1
+ require "bugcrowd/version"
2
+ require "bugcrowd/client"
3
+
4
+ module Bugcrowd
5
+
6
+ class << self
7
+ def client
8
+ @client ||= Bugcrowd::Client.new
9
+ end
10
+
11
+ private
12
+
13
+ def method_missing(method_name, *args, &block)
14
+ if client.respond_to?(method_name)
15
+ return client.send(method_name, *args, &block)
16
+ end
17
+
18
+ super
19
+ end
20
+ end
21
+
22
+ end
@@ -0,0 +1,48 @@
1
+ require 'bugcrowd/client/bounties'
2
+ require 'excon'
3
+
4
+ module Bugcrowd
5
+ class Client
6
+ include Bugcrowd::Client::Bounties
7
+
8
+ API_ENDPOINT = "https://api.bugcrowd.com".freeze
9
+ USER_AGENT = "Bugcrowd Ruby Gem #{Bugcrowd::VERSION}".freeze
10
+ MEDIA_TYPE = "application/vnd.bugcrowd+json"
11
+
12
+ attr_accessor :username, :password
13
+
14
+ def initialize(username: ENV['BUGCROWD_USER'], password: ENV['BUGCROWD_PASSWORD'])
15
+ self.username = username
16
+ self.password = password
17
+ end
18
+
19
+ def inspect
20
+ inspected = super
21
+
22
+ inspected = inspected.gsub! self.username, "*******" if self.username
23
+ inspected = inspected.gsub! self.password, "*******" if self.password
24
+
25
+ inspected
26
+ end
27
+
28
+ def get(path, options = {})
29
+ options.merge!(path: path)
30
+ connection.get(options)
31
+ end
32
+
33
+ def connection_options
34
+ {
35
+ headers: {
36
+ "Accept" => MEDIA_TYPE,
37
+ "User-Agent" => USER_AGENT
38
+ },
39
+ user: self.username,
40
+ password: self.password
41
+ }
42
+ end
43
+
44
+ def connection
45
+ @connection = Excon.new(API_ENDPOINT, connection_options)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,9 @@
1
+ module Bugcrowd
2
+ class Client
3
+ module Bounties
4
+ def list_bounties
5
+ response = Client.new.get('/bounties')
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Bugcrowd
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bugcrowd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Conway
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: excon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.55'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.55'
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.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.14'
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: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: Ruby wrapper for the Bugcrowd HTTP API
70
+ email:
71
+ - conway@heroku.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - bugcrowd.gemspec
85
+ - lib/bugcrowd.rb
86
+ - lib/bugcrowd/client.rb
87
+ - lib/bugcrowd/client/bounties.rb
88
+ - lib/bugcrowd/version.rb
89
+ homepage: https://github.com/mattreduce/bugcrowd
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.5.2
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Ruby wrapper for the Bugcrowd HTTP API
113
+ test_files: []