onyphe 1.0.0 → 1.1.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
  SHA256:
3
- metadata.gz: bb197595f583cae4f7474231b924a3ea0adb24ba1921acc2452ab8154868b575
4
- data.tar.gz: 91af3240e44f93e3f14c7c9f2d6fedbd33a89d6c97f89ffaa8ac4ac31a917861
3
+ metadata.gz: 4be6ceccc9070b0ff3e837f9df144bd8b1871f369559b735cbc24c3928de33e5
4
+ data.tar.gz: f21a7895f4c10fb3290f81a807912cfcc70477d53ecf0ba82800f736b3b6e9cb
5
5
  SHA512:
6
- metadata.gz: 678cbca08957c71d3c6744b525491f08cb4efa3f8e6483a0fc55e3063bf2876c0207da3c3e40b86fefa88802ad7fdce135e2ad621c33dc6504d5f91d062cb44e
7
- data.tar.gz: 8f96e012931f4551a0d3fbf29f60f10aeba8f7da071bbcdbd78ebcd4387bc5ec24058156da32e6baa522b322505c06db2dc1597e7d4be4dd2588f45192cc62c9
6
+ metadata.gz: 6c15b5f8728f4f5f67e620bc4b3fea7fa6e322c2bf139bbccdad9ace88abaa90b0f89c37b362534f8c2e4af986d43985b13795acc2917ee2e9a7cc9bc0805a03
7
+ data.tar.gz: 2f4b24073d4c4e9f7ffee038343814a46260846f1fbfad9d490277acd3c15e87133f5576576e5784648106fc619a1bc90969e47aa0517e31956ca4d0332a80ee
@@ -4,4 +4,4 @@ language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
6
  - 2.6
7
- before_install: gem install bundler -v 2.0
7
+ before_install: gem install bundler -v 2.1
data/README.md CHANGED
@@ -68,6 +68,10 @@ api.search.resolver(ip: "124.108.0.0/16")
68
68
  api.search.sniffer(ip: "14.164.0.0/14")
69
69
  api.search.ctl(host: "vpn")
70
70
  api.search.onionscan("app.http.keywords": "dump")
71
+
72
+ api.alert.list
73
+ api.alert.add(name: "foo", query:"bar", email: "foo@bar.com")
74
+ api.alert.delete("id")
71
75
  ```
72
76
 
73
77
  #### Pagination
@@ -5,6 +5,7 @@ require "onyphe/api"
5
5
  require "onyphe/validator"
6
6
 
7
7
  require "onyphe/client"
8
+ require "onyphe/clients/alert"
8
9
  require "onyphe/clients/ctl"
9
10
  require "onyphe/clients/datascan"
10
11
  require "onyphe/clients/forward"
@@ -22,6 +22,10 @@ module Onyphe
22
22
  @search ||= Clients::Search.new(api_key)
23
23
  end
24
24
 
25
+ def alert
26
+ @alert ||= Clients::Alert.new(api_key)
27
+ end
28
+
25
29
  private
26
30
 
27
31
  def _ctl
@@ -56,5 +56,14 @@ module Onyphe
56
56
  get = Net::HTTP::Get.new(url)
57
57
  request(get, &block)
58
58
  end
59
+
60
+ def post(path, params = {}, &block)
61
+ url = url_for(path)
62
+
63
+ post = Net::HTTP::Post.new(url)
64
+ post.set_form_data params
65
+ post["Authorization"] = "apikey #{@api_key}"
66
+ request(post, &block)
67
+ end
59
68
  end
60
69
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Onyphe
4
+ module Clients
5
+ class Alert < Client
6
+ def list
7
+ get("/v2/alert/list") { |json| json }
8
+ end
9
+
10
+ def add(name:, query:, email:)
11
+ params = {
12
+ name: name,
13
+ query: query,
14
+ email: email
15
+ }
16
+ post("/v2/alert/add", params) { |json| json }
17
+ end
18
+
19
+ def delete(id)
20
+ post("/v2/alert/del/#{id}") { |json| json }
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onyphe
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
 
27
27
  spec.add_dependency "addressable", "~> 2.7"
28
- spec.add_dependency "thor", "~> 0.20"
28
+ spec.add_dependency "thor", "~> 1.0"
29
29
 
30
- spec.add_development_dependency "bundler", "~> 2.0"
30
+ spec.add_development_dependency "bundler", "~> 2.1"
31
31
  spec.add_development_dependency "coveralls", "~> 0.8"
32
32
  spec.add_development_dependency "rake", "~> 13.0"
33
33
  spec.add_development_dependency "rspec", "~> 3.9"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onyphe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-21 00:00:00.000000000 Z
11
+ date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.20'
33
+ version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.20'
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '2.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '2.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: coveralls
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -145,6 +145,7 @@ files:
145
145
  - lib/onyphe/api.rb
146
146
  - lib/onyphe/cli.rb
147
147
  - lib/onyphe/client.rb
148
+ - lib/onyphe/clients/alert.rb
148
149
  - lib/onyphe/clients/ctl.rb
149
150
  - lib/onyphe/clients/datascan.rb
150
151
  - lib/onyphe/clients/forward.rb
@@ -181,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
182
  - !ruby/object:Gem::Version
182
183
  version: '0'
183
184
  requirements: []
184
- rubygems_version: 3.0.6
185
+ rubygems_version: 3.0.3
185
186
  signing_key:
186
187
  specification_version: 4
187
188
  summary: ONYPHE API wrapper for Ruby