sonar-client 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/bin/sonar +3 -1
- data/lib/sonar/cli/cli.rb +1 -1
- data/lib/sonar/search.rb +6 -0
- data/lib/sonar/version.rb +1 -1
- data/spec/sonar/cli_spec.rb +10 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46f4c95ec260a3eb4b212c2f85c4bee5893dc461
|
4
|
+
data.tar.gz: 4a574ae9f388f0db79f28e80e9dc69b9c97de3eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8056aa52de648957853d67ad2ebcdb8168e4ee586dc8dfe0bdab2e6ef9d638f6caac2ae142c4eceffd9c598f0e17e402179bfad8a71df5d700b94dbce477b852
|
7
|
+
data.tar.gz: 66db84c021545e129f001839cb8de8e56b221175bbbb202df443d8f35e92ee5dd344c34dbb5ec034599abededc92f805a9d4cdea2b979d9c28a3a180aca684c0
|
data/bin/sonar
CHANGED
data/lib/sonar/cli/cli.rb
CHANGED
data/lib/sonar/search.rb
CHANGED
data/lib/sonar/version.rb
CHANGED
data/spec/sonar/cli_spec.rb
CHANGED
@@ -6,13 +6,8 @@ describe Sonar::CLI do
|
|
6
6
|
before do
|
7
7
|
Sonar::RCFile.instance.path = "#{fixtures_path}/sonar-stock.rc"
|
8
8
|
end
|
9
|
-
it '
|
10
|
-
|
11
|
-
expect(output).to match(/Could not authenticate/)
|
12
|
-
end
|
13
|
-
it 'exits non-zero when errors are encountered' do
|
14
|
-
_, ret = run_command('search rdns 8.8.8.8')
|
15
|
-
expect(ret).to eq(1)
|
9
|
+
it 'throws an exception because of errors' do
|
10
|
+
expect { run_command('search rdns 8.8.8.8') }.to raise_error(Sonar::Search::SearchError)
|
16
11
|
end
|
17
12
|
end
|
18
13
|
|
@@ -21,7 +16,7 @@ describe Sonar::CLI do
|
|
21
16
|
Sonar::RCFile.instance.path = "#{fixtures_path}/sonar.rc"
|
22
17
|
end
|
23
18
|
it "should return the profile" do
|
24
|
-
output
|
19
|
+
output = run_command('profile')
|
25
20
|
expect(output).to match(/email@asdfasdfasfd.com/)
|
26
21
|
end
|
27
22
|
|
@@ -32,11 +27,11 @@ describe Sonar::CLI do
|
|
32
27
|
)
|
33
28
|
end
|
34
29
|
it 'strips whitespace from values' do
|
35
|
-
output
|
30
|
+
output = run_command('search rdns 8.8.8.8')
|
36
31
|
expect(output).to eq('{"collection":[{"address":"192.168.1.1"}],"more":"false"}')
|
37
32
|
end
|
38
33
|
it 'can return lines format' do
|
39
|
-
output
|
34
|
+
output = run_command('search --format lines rdns 8.8.8.8')
|
40
35
|
expect(output).to eq('{"address":"192.168.1.1"}')
|
41
36
|
end
|
42
37
|
end
|
@@ -47,7 +42,7 @@ describe Sonar::CLI do
|
|
47
42
|
)
|
48
43
|
end
|
49
44
|
it 'parses the nested values in an array' do
|
50
|
-
output
|
45
|
+
output = run_command('search sslcert 152a0a633aaf13f02c428ac1a3e672e895512bfd')
|
51
46
|
expect(JSON.parse(output)['collection'].first['details'].first['subject']['ST']).to eq('California')
|
52
47
|
end
|
53
48
|
end
|
@@ -58,7 +53,7 @@ describe Sonar::CLI do
|
|
58
53
|
)
|
59
54
|
end
|
60
55
|
xit 'parses the nested value as a string' do
|
61
|
-
output
|
56
|
+
output = run_command('search processed 8.8.8.')
|
62
57
|
expect(JSON.parse(output)['collection'].first['value']['ip']).to eq('8.8.8.8')
|
63
58
|
end
|
64
59
|
end
|
@@ -70,7 +65,7 @@ describe Sonar::CLI do
|
|
70
65
|
)
|
71
66
|
end
|
72
67
|
it 'matches exactly with --exact' do
|
73
|
-
output
|
68
|
+
output = run_command('search fdns 208.118.227.20 --exact')
|
74
69
|
expect(JSON.parse(output)['collection'].size).to be >= 1
|
75
70
|
expect(JSON.parse(output)['collection'].any? { |c| c['name'] == '208.118.227.20' }).to be(true)
|
76
71
|
end
|
@@ -82,7 +77,7 @@ describe Sonar::CLI do
|
|
82
77
|
)
|
83
78
|
end
|
84
79
|
it 'matches exactly without --exact' do
|
85
|
-
output
|
80
|
+
output = run_command('search fdns 208.118.227.20')
|
86
81
|
expect(JSON.parse(output)['collection'].size).to be > 1
|
87
82
|
end
|
88
83
|
end
|
@@ -90,8 +85,6 @@ describe Sonar::CLI do
|
|
90
85
|
end
|
91
86
|
|
92
87
|
def run_command(args)
|
93
|
-
ret =
|
94
|
-
output, _ = capture(:stdout) { ret = Sonar::CLI.start(args.split) }.strip
|
95
|
-
[output, ret]
|
88
|
+
capture(:stdout) { ret = Sonar::CLI.start(args.split) }.strip
|
96
89
|
end
|
97
90
|
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.1.
|
4
|
+
version: 0.1.3
|
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: 2016-04-
|
11
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|