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 +4 -4
- data/README.md +39 -7
- data/lib/seer/dns.rb +26 -4
- data/lib/seer/hosts.rb +4 -4
- data/lib/seer/org.rb +4 -4
- data/lib/seer/status.rb +21 -12
- data/lib/seer/version.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9df7ac9813d08bdf735f5026a854631696141ac
|
4
|
+
data.tar.gz: 72a4dfa4a172451c7383e1c34d0cfbe04671ba09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
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(
|
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(
|
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(
|
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:
|
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(
|
44
|
+
seer.ip(IP)
|
45
45
|
```
|
46
46
|
|
47
47
|
#### Get type A record by domain
|
48
48
|
|
49
49
|
```ruby
|
50
|
-
seer.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: '
|
8
|
+
def initialize(token: '', version: '2.0', host: '')
|
9
9
|
@host = host + '/dns'
|
10
10
|
@header = {
|
11
|
-
|
12
|
-
|
13
|
-
|
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: '
|
8
|
+
def initialize(token: '', version: '2.0', host: '')
|
9
9
|
@host = host + '/hosts'
|
10
10
|
@header = {
|
11
|
-
|
12
|
-
|
13
|
-
|
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: '
|
8
|
+
def initialize(token: '', version: '2.0', host: '')
|
9
9
|
@host = host + '/org'
|
10
10
|
@header = {
|
11
|
-
|
12
|
-
|
13
|
-
|
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: '
|
8
|
+
def initialize(token: '', version: '2.0', host: '')
|
9
9
|
@host = host + '/status'
|
10
10
|
@header = {
|
11
11
|
content_type: 'application/json',
|
12
|
-
|
13
|
-
|
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
|
21
|
-
|
22
|
-
|
19
|
+
def services
|
20
|
+
url = @host + '/services'
|
21
|
+
response = RestClient.get url, @header
|
22
|
+
JSON.load response
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
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.
|
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:
|
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.
|
63
|
+
rubygems_version: 2.5.1
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: Ruby SDK for SEER API
|