seer-rb 0.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe0f40db1b6ac7cfedeb6bd56ffe80d8ea0a139b
4
- data.tar.gz: 1cd268bec5e84942e023c93b55b83566dd211387
3
+ metadata.gz: c9df7ac9813d08bdf735f5026a854631696141ac
4
+ data.tar.gz: 72a4dfa4a172451c7383e1c34d0cfbe04671ba09
5
5
  SHA512:
6
- metadata.gz: 8e340f44f748fc9cc535928094b7a3cca53a24625a2c99a570948f5093d6cf5bdfea46afa83217b675d983d1504f6aa1044ff86bc29bc15442b0790352fa09bd
7
- data.tar.gz: 7739f507ceb7ae28e05b871f3c383ce7379fc87671970ac22e8764272e3a66e6d82ef3c851f5f5ac9d721f452833296cdf231eebd048326ce7964edee44680a5
6
+ metadata.gz: e6a173180e8cad111ee2070dd01ebfbebd106b0f1fb316f91e9769ca092f78781da62063e71488479eca9c1472c8226ba0ba7efc60684e62fb3797c5458f8521
7
+ data.tar.gz: 7a444968e4093b68dcbc45d92154bf7868892b943da2c43b77d821abbcf503be3565be8831dc083ac3f2e06b1153bfce4875fd10427e4dd7214273b6ff8063e4
data/README.md CHANGED
@@ -9,25 +9,25 @@ Ruby SDK for SEER API
9
9
  #### Register with API token
10
10
 
11
11
  ```ruby
12
- seer = Seer::Hosts.new(token: api_token, host: api_host)
12
+ seer = Seer::Hosts.new(token: API_TOKEN, host: API_HOST)
13
13
  ```
14
14
 
15
15
  #### Get host information by IP
16
16
 
17
17
  ```ruby
18
- host = seer.ip(ip)
18
+ host = seer.ip(IP)
19
19
  ```
20
20
 
21
21
  #### Get host information by custom search syntax
22
22
 
23
23
  ```ruby
24
- host = seer.search(query, return_field)
24
+ host = seer.search(QUERY, RETURN_FIELD)
25
25
  ```
26
26
 
27
27
  #### Get hosts by port
28
28
 
29
29
  ```ruby
30
- hosts = seer.port(port)
30
+ hosts = seer.port(PORT)
31
31
  ```
32
32
 
33
33
  ### Domain query
@@ -35,19 +35,51 @@ hosts = seer.port(port)
35
35
  #### Register with API token
36
36
 
37
37
  ```ruby
38
- seer = Seer::DNS.new(token: api_token, host: api_host)
38
+ seer = Seer::DNS.new(token: API_TOKEN, host: API_HOST)
39
39
  ```
40
40
 
41
41
  #### Get type A record by IP
42
42
 
43
43
  ```ruby
44
- seer.ip(ip)
44
+ seer.ip(IP)
45
45
  ```
46
46
 
47
47
  #### Get type A record by domain
48
48
 
49
49
  ```ruby
50
- seer.domain(domain)
50
+ seer.domain(DOMAIN)
51
+ ```
52
+
53
+ #### Get subdomain by domain
54
+
55
+ ```ruby
56
+ seer.subdomain(SUBDOMAIN)
57
+ ```
58
+
59
+ #### Custom search
60
+
61
+ ```ruby
62
+ seer.search(key: KEY, type: TYPE)
63
+ ```
64
+
65
+ ### Org query
66
+
67
+ #### Register with API token
68
+
69
+ ```ruby
70
+ seer = Seer::Org.new(token: API_TOKEN, host: API_HOST)
71
+ ```
72
+
73
+ #### Get org by ip
74
+
75
+ ```ruby
76
+ seer.ip(ip)
77
+ ```
78
+
79
+ #### Get ip by asn
80
+
81
+ ```ruby
82
+ seer.asn(asn)
51
83
  ```
52
84
 
53
85
  ## Installation
data/lib/seer/dns.rb CHANGED
@@ -5,12 +5,12 @@ module Seer
5
5
  # @param token [string] API token
6
6
  # @param version [string] API version you want use (defaut 1)
7
7
  # @param host [string] API host
8
- def initialize(token: '', version: '1', host: '')
8
+ def initialize(token: '', version: '2.0', host: '')
9
9
  @host = host + '/dns'
10
10
  @header = {
11
- content_type: 'application/json',
12
- accept: "application/seer+json;version=#{version}",
13
- x_seer_token: token
11
+ content_type: 'application/json',
12
+ x_seer_token: token,
13
+ x_seer_version: version
14
14
  }
15
15
  end
16
16
 
@@ -23,6 +23,15 @@ module Seer
23
23
  Seer.request(url, body, @header)
24
24
  end
25
25
 
26
+ # Get sub domain from domain
27
+ # @param subdomain [string]
28
+ # @return [Hash] Result
29
+ def subdomain(subdomain)
30
+ body = { subdomain: subdomain }
31
+ url = @host + '/subdomain'
32
+ Seer.request(url, body, @header)
33
+ end
34
+
26
35
  # Get domain by ip
27
36
  # @param ip [String]
28
37
  # @return [Hash] Result
@@ -31,5 +40,18 @@ module Seer
31
40
  url = @host + '/ip'
32
41
  Seer.request(url, body, @header)
33
42
  end
43
+
44
+ # Advance search
45
+ # @param type [string] DNS type
46
+ # @param key [string] Key
47
+ # @return [Hash] Result
48
+ def search(type, key)
49
+ body = {
50
+ type: type,
51
+ key: key
52
+ }
53
+ url = @host + '/search'
54
+ Seer.request(url, body, @header)
55
+ end
34
56
  end
35
57
  end
data/lib/seer/hosts.rb CHANGED
@@ -5,12 +5,12 @@ module Seer
5
5
  # @param token [string] API token
6
6
  # @param version [string] API version you want use (defaut 1)
7
7
  # @param host [string] API host
8
- def initialize(token: '', version: '1', host: '')
8
+ def initialize(token: '', version: '2.0', host: '')
9
9
  @host = host + '/hosts'
10
10
  @header = {
11
- content_type: 'application/json',
12
- accept: "application/seer+json;version=#{version}",
13
- x_seer_token: token
11
+ content_type: 'application/json',
12
+ x_seer_token: token,
13
+ x_seer_version: version
14
14
  }
15
15
  end
16
16
 
data/lib/seer/org.rb CHANGED
@@ -5,12 +5,12 @@ module Seer
5
5
  # @param token [string] API token
6
6
  # @param version [string] :version ('1') API version you want use (defaut 1)
7
7
  # @param host [string] API host (default http://seer.intra.nsfocus.com:8000/api)
8
- def initialize(token: '', version: '1', host: '')
8
+ def initialize(token: '', version: '2.0', host: '')
9
9
  @host = host + '/org'
10
10
  @header = {
11
- content_type: 'application/json',
12
- accept: "application/seer+json;version=#{version}",
13
- x_seer_token: token
11
+ content_type: 'application/json',
12
+ x_seer_token: token,
13
+ x_seer_version: version
14
14
  }
15
15
  end
16
16
 
data/lib/seer/status.rb CHANGED
@@ -5,27 +5,36 @@ module Seer
5
5
  # @param token [string] API token
6
6
  # @param version [string] :version ('1') API version you want use (defaut 1)
7
7
  # @param host [string] API host (default http://seer.intra.nsfocus.com:8000/api)
8
- def initialize(token: '', version: '1', host: '')
8
+ def initialize(token: '', version: '2.0', host: '')
9
9
  @host = host + '/status'
10
10
  @header = {
11
11
  content_type: 'application/json',
12
- accept: "application/seer+json;version=#{version}",
13
- x_seer_token: token
12
+ x_seer_token: token,
13
+ x_seer_version: version
14
14
  }
15
15
  end
16
16
 
17
17
  # Get SEER supported service
18
- # @param service [String] Return all service that SEER supported
19
18
  # @return [Hash] Result
20
- def service(service)
21
- body = { service: service }
22
- url = @host + '/service'
19
+ def services
20
+ url = @host + '/services'
21
+ response = RestClient.get url, @header
22
+ JSON.load response
23
+ end
23
24
 
24
- response = RestClient.post(
25
- url,
26
- JSON.dump(body),
27
- @header
28
- )
25
+ # Get all ports
26
+ # @return [Hash] Result
27
+ def ports
28
+ url = @host + '/ports'
29
+ response = RestClient.get url, @header
30
+ JSON.load response
31
+ end
32
+
33
+ # Get token status
34
+ # @return [Hash] Result
35
+ def token
36
+ url = @host + "/token?token=#{@header[:x_seer_token]}"
37
+ response = RestClient.get url, @header
29
38
  JSON.load response
30
39
  end
31
40
  end
data/lib/seer/version.rb CHANGED
@@ -2,13 +2,13 @@ module Seer
2
2
  # Version
3
3
  class Version
4
4
  # Major version
5
- MAJOR = 0
5
+ MAJOR = 2
6
6
 
7
7
  # Minor version
8
- MINOR = 1
8
+ MINOR = 0
9
9
 
10
10
  # Patch version
11
- PATCH = 1
11
+ PATCH = 0
12
12
 
13
13
  class << self
14
14
  # @return [String]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seer-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ztz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-28 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.4.8
63
+ rubygems_version: 2.5.1
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: Ruby SDK for SEER API