censu 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +50 -6
- data/.rubocop.yml +7 -7
- data/LICENSE.txt +2 -2
- data/README.md +2 -3
- data/lib/censys/api.rb +2 -2
- data/lib/censys/data/series.rb +1 -1
- data/lib/censys/document/has_location.rb +1 -1
- data/lib/censys/location.rb +16 -11
- data/lib/censys/search/ipv4.rb +3 -0
- data/lib/censys/version.rb +1 -1
- data/spec/search_spec.rb +15 -0
- data/spec/view_spec.rb +7 -4
- metadata +3 -4
- data/ChangeLog.md +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b83daf6ddb78d97687a6f5cf07460e1de49f28b10b91f89cfaf98c0279b05652
|
4
|
+
data.tar.gz: ed0bad88402f63cf4a6961386cb763b1ab20af8c71e611957f76c7c9042af457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 719b55f148ead33e32e3ef7d8290e05212d9efa80d4cbf407448bde0d1adee8ecb2d845b4fd5797fd88c8f5b7497a243e7bbb71aaf7168cfc67f05a8a08b8d2a
|
7
|
+
data.tar.gz: d246faf28d7f19dfc9a390d96200042bbc4a606f3c4a0889f64384ebdc2a0d9eb11c12ffbce83e8220fd2a93ea7de39d23c33ebb7eaabb9aa4218d97391a780a
|
data/.gitignore
CHANGED
@@ -1,8 +1,52 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
.env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
3
33
|
/.yardoc/
|
4
|
-
/
|
34
|
+
/_yardoc/
|
5
35
|
/doc/
|
6
|
-
/
|
7
|
-
|
8
|
-
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
Gemfile.lock
|
46
|
+
.ruby-version
|
47
|
+
.ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
.vscode
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Relaxed.Ruby.Style
|
2
|
-
## Version 2.
|
2
|
+
## Version 2.2
|
3
3
|
|
4
4
|
Style/Alias:
|
5
5
|
Enabled: false
|
@@ -113,9 +113,13 @@ Style/TrailingCommaInArguments:
|
|
113
113
|
Enabled: false
|
114
114
|
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarguments
|
115
115
|
|
116
|
-
Style/
|
116
|
+
Style/TrailingCommaInArrayLiteral:
|
117
117
|
Enabled: false
|
118
|
-
StyleGuide: http://relaxed.ruby.style/#
|
118
|
+
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarrayliteral
|
119
|
+
|
120
|
+
Style/TrailingCommaInHashLiteral:
|
121
|
+
Enabled: false
|
122
|
+
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainhashliteral
|
119
123
|
|
120
124
|
Style/WhileUntilModifier:
|
121
125
|
Enabled: false
|
@@ -139,10 +143,6 @@ Metrics/AbcSize:
|
|
139
143
|
Metrics/BlockNesting:
|
140
144
|
Enabled: false
|
141
145
|
|
142
|
-
Metrics/BlockLength:
|
143
|
-
Exclude:
|
144
|
-
- 'spec/**/*'
|
145
|
-
|
146
146
|
Metrics/ClassLength:
|
147
147
|
Enabled: false
|
148
148
|
|
data/LICENSE.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
Copyright
|
1
|
+
Copyright 2018 ninoseki
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
4
|
|
5
5
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
6
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -10,7 +10,6 @@
|
|
10
10
|
|
11
11
|
Ruby API client to the [Censys] internet search engine.
|
12
12
|
|
13
|
-
|
14
13
|
## Examples
|
15
14
|
|
16
15
|
Initialize the API:
|
@@ -107,9 +106,9 @@ end
|
|
107
106
|
|
108
107
|
## License
|
109
108
|
|
110
|
-
|
109
|
+
MIT License.
|
111
110
|
|
112
|
-
Note
|
111
|
+
**Note:** This gem is forked from [trailofbits/censys-ruby](https://github.com/trailofbits/censys-ruby).
|
113
112
|
|
114
113
|
[ruby]: http://www.ruby-lang.org/
|
115
114
|
[Censys]: https://censys.io/
|
data/lib/censys/api.rb
CHANGED
@@ -84,8 +84,8 @@ module Censys
|
|
84
84
|
# Censys - My Account
|
85
85
|
#
|
86
86
|
def initialize(id = ENV['CENSYS_ID'], secret = ENV['CENSYS_SECRET'])
|
87
|
-
raise(ArgumentError, "'id' argument required") if id.nil? || id.empty?
|
88
|
-
raise(ArgumentError, "'secret' argument required") if secret.nil? || secret.empty?
|
87
|
+
raise(ArgumentError, "'id' argument is required") if id.nil? || id.empty?
|
88
|
+
raise(ArgumentError, "'secret' argument is required") if secret.nil? || secret.empty?
|
89
89
|
|
90
90
|
@id, @secret = id, secret
|
91
91
|
|
data/lib/censys/data/series.rb
CHANGED
data/lib/censys/location.rb
CHANGED
@@ -36,19 +36,24 @@ module Censys
|
|
36
36
|
# @param [Hash{String => Object}] attributes
|
37
37
|
#
|
38
38
|
def initialize(attributes)
|
39
|
-
@
|
40
|
-
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
44
|
-
|
45
|
-
@
|
46
|
-
@
|
39
|
+
@attributes = attributes
|
40
|
+
|
41
|
+
@postal_code = self['postal_code']
|
42
|
+
@city = self['city']
|
43
|
+
@province = self['province']
|
44
|
+
@country = self['country']
|
45
|
+
@continent = self['continent']
|
46
|
+
@registered_country = self['registered_country']
|
47
|
+
@registered_country_code = self['registered_country_code']
|
48
|
+
@timezone = self['timezone']
|
49
|
+
@latitude = self['latitude']
|
50
|
+
@longitude = self['longitude']
|
51
|
+
end
|
47
52
|
|
48
|
-
|
53
|
+
private
|
49
54
|
|
50
|
-
|
51
|
-
@
|
55
|
+
def [](key)
|
56
|
+
@attributes[key] || @attributes["location.#{key}"]
|
52
57
|
end
|
53
58
|
end
|
54
59
|
end
|
data/lib/censys/search/ipv4.rb
CHANGED
data/lib/censys/version.rb
CHANGED
data/spec/search_spec.rb
CHANGED
@@ -10,7 +10,11 @@ describe Censys::API do
|
|
10
10
|
it "should return IPv4 response" do
|
11
11
|
res = @api.ipv4.search(query: "dropbox.com")
|
12
12
|
expect(res).to be_a(Search::Response)
|
13
|
+
|
13
14
|
expect(res.metadata).to be_a(Search::Metadata)
|
15
|
+
expect(res.metadata.count).to be_a(Integer)
|
16
|
+
expect(res.metadata.query).to eq("dropbox.com")
|
17
|
+
|
14
18
|
expect(res.each).to be_a(Enumerator)
|
15
19
|
expect(res.pages).to be_a(Enumerator)
|
16
20
|
|
@@ -18,6 +22,9 @@ describe Censys::API do
|
|
18
22
|
expect(first).to be_a(Search::IPv4)
|
19
23
|
expect(first.ip).to be_a(String)
|
20
24
|
expect(first.protocols).to be_a(Array)
|
25
|
+
|
26
|
+
expect(first.location).to be_a(Location)
|
27
|
+
expect(first.location.country).to be_a(String)
|
21
28
|
end
|
22
29
|
end
|
23
30
|
|
@@ -26,6 +33,10 @@ describe Censys::API do
|
|
26
33
|
res = @api.websites.search(query: "dropbox.com")
|
27
34
|
expect(res).to be_a(Search::Response)
|
28
35
|
|
36
|
+
expect(res.metadata).to be_a(Search::Metadata)
|
37
|
+
expect(res.metadata.count).to be_a(Integer)
|
38
|
+
expect(res.metadata.query).to eq("dropbox.com")
|
39
|
+
|
29
40
|
first = res.results.first
|
30
41
|
expect(first).to be_a(Search::Website)
|
31
42
|
expect(first.domain).to be_a(String)
|
@@ -38,6 +49,10 @@ describe Censys::API do
|
|
38
49
|
res = @api.certificates.search(query: "dropbox.com")
|
39
50
|
expect(res).to be_a(Search::Response)
|
40
51
|
|
52
|
+
expect(res.metadata).to be_a(Search::Metadata)
|
53
|
+
expect(res.metadata.count).to be_a(Integer)
|
54
|
+
expect(res.metadata.query).to eq("dropbox.com")
|
55
|
+
|
41
56
|
first = res.results.first
|
42
57
|
expect(first).to be_a(Search::Certificate)
|
43
58
|
expect(first.fingerprint_sha256).to be_a(String)
|
data/spec/view_spec.rb
CHANGED
@@ -12,12 +12,15 @@ describe Censys::API do
|
|
12
12
|
expect(view).to be_a(Censys::IPv4)
|
13
13
|
expect(view.tags).to be_a(Array)
|
14
14
|
expect(view.updated_at).to be_a(Time)
|
15
|
+
|
15
16
|
expect(view.autonomous_system).to be_a(AutonomousSystem)
|
17
|
+
expect(view.autonomous_system.routed_prefix).to eq("8.8.8.0/24")
|
18
|
+
|
16
19
|
expect(view.location).to be_a(Location)
|
20
|
+
expect(view.location.city).to eq("Mountain View")
|
21
|
+
|
17
22
|
expect(view.ports).to be_a(Hash)
|
18
23
|
expect(view.protocols).to be_a(Array)
|
19
|
-
expect(view["location.city"]).to eq("Mountain View")
|
20
|
-
expect(view.dig("location", "city")).to eq("Mountain View")
|
21
24
|
|
22
25
|
expect(view.ip).to eq("8.8.8.8")
|
23
26
|
expect(view.to_s).to eq("8.8.8.8")
|
@@ -33,13 +36,13 @@ describe Censys::API do
|
|
33
36
|
expect(view.to_s).to eq("google.com")
|
34
37
|
expect(view.alexa_rank).to be_a(Integer)
|
35
38
|
|
36
|
-
expect(view["80.http.get.body"]).to be_a(String)
|
37
|
-
|
38
39
|
expect(view.http_response).to be_a(Censys::HTTPResponse)
|
39
40
|
expect(view.http_response.body).to be_a(String)
|
40
41
|
expect(view.http_response.header).to be_a(Hash)
|
41
42
|
expect(view.http_response.status_code).to eq(200)
|
42
43
|
expect(view.http_response.title).to eq("Google")
|
44
|
+
|
45
|
+
expect(view["80.http.get.body"]).to be_a(String)
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: censu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manabu Niseki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -135,7 +135,6 @@ files:
|
|
135
135
|
- ".rubocop.yml"
|
136
136
|
- ".travis.yml"
|
137
137
|
- ".yardopts"
|
138
|
-
- ChangeLog.md
|
139
138
|
- Gemfile
|
140
139
|
- LICENSE.txt
|
141
140
|
- README.md
|
@@ -210,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
209
|
version: '0'
|
211
210
|
requirements: []
|
212
211
|
rubyforge_project:
|
213
|
-
rubygems_version: 2.6
|
212
|
+
rubygems_version: 2.7.6
|
214
213
|
signing_key:
|
215
214
|
specification_version: 4
|
216
215
|
summary: API client for censys.io
|
data/ChangeLog.md
DELETED