sonar-client 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +18 -0
- data/README.md +4 -1
- data/lib/sonar/version.rb +1 -1
- data/spec/cassette/valid_ms_registration.yml +103 -0
- data/spec/fixtures/sonar.rc +1 -1
- data/spec/sonar/registration_spec.rb +2 -2
- data/spec/sonar_spec.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5300d330259f4b803e14cde0d03922a93d31536
|
4
|
+
data.tar.gz: b79890de15b23b1cdead6778d90b20a33d182ad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c3e3181cf69d1bc9f2de4fc63f10414f7e414b73bc7144b818e63725d5f40fc49fa24f97e0cf990f05c7a42cbd459c12d5367a8e1a76e6b1b4ee61c5e631492
|
7
|
+
data.tar.gz: 69e4119f5780e963b34adc3cd63a96bec198a9e4da2a88b7dc14f7e2c106eb911ddc7a226ecdb78301f4056107d1858a7ffcfac583312e8f53373895bfe330a1
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: false
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- 2.1.5
|
6
|
+
- jruby
|
7
|
+
before_install:
|
8
|
+
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
|
9
|
+
- rake --version
|
10
|
+
before_script:
|
11
|
+
- bundle exec rake --version
|
12
|
+
script: bundle exec rspec
|
13
|
+
#
|
14
|
+
# Environment variables should be set in Travis repository settings per
|
15
|
+
# https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
|
16
|
+
#
|
17
|
+
# Required vars are SONAR_API_URL, SONAR_EMAIL, and SONAR_TOKEN
|
18
|
+
#
|
data/README.md
CHANGED
@@ -3,6 +3,9 @@ sonar-client
|
|
3
3
|
|
4
4
|
Ruby API Wrapper and CLI for [Sonar](https://sonar.labs.rapid7.com)
|
5
5
|
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/sonar-client.svg)](http://badge.fury.io/rb/sonar-client)
|
7
|
+
[![Build Status](https://travis-ci.org/rapid7/sonar-client.svg?branch=master)](https://travis-ci.org/rapid7/sonar-client)
|
8
|
+
|
6
9
|
## Installation
|
7
10
|
|
8
11
|
Install the gem by running
|
@@ -57,7 +60,7 @@ Until they're mocked, specs are run against a live API, either production, stagi
|
|
57
60
|
```
|
58
61
|
# Sonar config
|
59
62
|
export SONAR_TOKEN=asldkstokenalskdjf
|
60
|
-
export SONAR_API_URL=http://sonar
|
63
|
+
export SONAR_API_URL=http://sonar.labs.rapid7.com/
|
61
64
|
export SONAR_EMAIL=youremail@example.com
|
62
65
|
```
|
63
66
|
|
data/lib/sonar/version.rb
CHANGED
@@ -0,0 +1,103 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://sonar.labs.rapid7.com/api/v2/metasploit_verify
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"product_key":"SOME-VALID-KEY"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Sonar 0.0.8 Ruby Gem
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Thu, 19 Nov 2015 04:53:25 GMT
|
25
|
+
Server:
|
26
|
+
- Apache
|
27
|
+
X-Frame-Options:
|
28
|
+
- SAMEORIGIN
|
29
|
+
X-Xss-Protection:
|
30
|
+
- 1; mode=block
|
31
|
+
X-Content-Type-Options:
|
32
|
+
- nosniff
|
33
|
+
Cache-Control:
|
34
|
+
- max-age=0, private, must-revalidate
|
35
|
+
X-Runtime:
|
36
|
+
- '3.898589'
|
37
|
+
X-Powered-By:
|
38
|
+
- Phusion Passenger 4.0.53
|
39
|
+
Set-Cookie:
|
40
|
+
- request_method=POST; path=/
|
41
|
+
Status:
|
42
|
+
- 200 OK
|
43
|
+
Transfer-Encoding:
|
44
|
+
- chunked
|
45
|
+
Content-Type:
|
46
|
+
- application/json; charset=utf-8
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: '{"valid":true,"api_key":"YOUR-VALID-API-KEY","email":"metasploit-sdafsaefaef@rapid7.com"}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Thu, 19 Nov 2015 04:54:20 GMT
|
52
|
+
- request:
|
53
|
+
method: post
|
54
|
+
uri: https://sonar.labs.rapid7.com/api/v2/metasploit_verify
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: '{"product_key":"SOME-VALID-KEY"}'
|
58
|
+
headers:
|
59
|
+
Accept:
|
60
|
+
- application/json
|
61
|
+
Content-Type:
|
62
|
+
- application/json
|
63
|
+
User-Agent:
|
64
|
+
- Sonar 0.0.8 Ruby Gem
|
65
|
+
X-Sonar-Token:
|
66
|
+
- 6e28da9c72c1e2cecd2ac8ae890853fa72d26d55
|
67
|
+
X-Sonar-Email:
|
68
|
+
- marklinstop@gmail.com
|
69
|
+
Accept-Encoding:
|
70
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
71
|
+
response:
|
72
|
+
status:
|
73
|
+
code: 404
|
74
|
+
message: Not Found
|
75
|
+
headers:
|
76
|
+
Content-Type:
|
77
|
+
- application/json; charset=utf-8
|
78
|
+
Date:
|
79
|
+
- Mon, 23 Nov 2015 02:48:56 GMT
|
80
|
+
Server:
|
81
|
+
- Apache
|
82
|
+
Status:
|
83
|
+
- 404 Not Found
|
84
|
+
X-Content-Type-Options:
|
85
|
+
- nosniff
|
86
|
+
X-Frame-Options:
|
87
|
+
- sameorigin
|
88
|
+
X-Powered-By:
|
89
|
+
- Phusion Passenger 5.0.16
|
90
|
+
X-Request-Id:
|
91
|
+
- c5151aa7-f5d9-42d3-963e-6ce32a968921
|
92
|
+
X-Runtime:
|
93
|
+
- '0.003344'
|
94
|
+
Content-Length:
|
95
|
+
- '36'
|
96
|
+
Connection:
|
97
|
+
- keep-alive
|
98
|
+
body:
|
99
|
+
encoding: UTF-8
|
100
|
+
string: '{"status":"404","error":"Not Found"}'
|
101
|
+
http_version:
|
102
|
+
recorded_at: Mon, 23 Nov 2015 02:49:51 GMT
|
103
|
+
recorded_with: VCR 2.8.0
|
data/spec/fixtures/sonar.rc
CHANGED
@@ -28,11 +28,11 @@ describe Sonar::Registration do
|
|
28
28
|
context 'POSTing an invalid product key' do
|
29
29
|
let (:resp) { client.register_metasploit("DDXXXX") }
|
30
30
|
|
31
|
-
|
31
|
+
xit 'responds that the license is invalid' do
|
32
32
|
expect(resp).to have_key('valid')
|
33
33
|
expect(resp['valid']).to be(false)
|
34
34
|
end
|
35
|
-
|
35
|
+
xit 'responds with an error message' do
|
36
36
|
expect(resp).to have_key('error')
|
37
37
|
expect(resp['error']).to match(/not appear to be valid/)
|
38
38
|
end
|
data/spec/sonar_spec.rb
CHANGED
@@ -54,8 +54,8 @@ describe Sonar, skip_autoconfig: true do
|
|
54
54
|
c.email = "wrong@sowrong.com"
|
55
55
|
c.access_token = "somewrongkey"
|
56
56
|
c.api_version = "v2"
|
57
|
-
c.api_url = "https://sonar-staging.labs.rapid7.com"
|
58
57
|
end
|
58
|
+
puts Sonar.api_url
|
59
59
|
client = Sonar::Client.new
|
60
60
|
@resp = client.search(rdns: "hp.com")
|
61
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonar-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Deardorff & HD Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- .gitignore
|
233
233
|
- .rspec
|
234
234
|
- .rubocop.yml
|
235
|
+
- .travis.yml
|
235
236
|
- Gemfile
|
236
237
|
- LICENSE
|
237
238
|
- README.md
|
@@ -248,6 +249,7 @@ files:
|
|
248
249
|
- lib/sonar/user.rb
|
249
250
|
- lib/sonar/version.rb
|
250
251
|
- sonar-client.gemspec
|
252
|
+
- spec/cassette/valid_ms_registration.yml
|
251
253
|
- spec/fixtures/sonar-stock.rc
|
252
254
|
- spec/fixtures/sonar.rc
|
253
255
|
- spec/sonar/certificate_spec.rb
|
@@ -283,6 +285,7 @@ signing_key:
|
|
283
285
|
specification_version: 4
|
284
286
|
summary: API Wrapper for Sonar
|
285
287
|
test_files:
|
288
|
+
- spec/cassette/valid_ms_registration.yml
|
286
289
|
- spec/fixtures/sonar-stock.rc
|
287
290
|
- spec/fixtures/sonar.rc
|
288
291
|
- spec/sonar/certificate_spec.rb
|