hachi 0.3.2 → 1.0.0
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/.github/workflows/test.yml +26 -0
- data/README.md +18 -8
- data/Rakefile +1 -1
- data/hachi.gemspec +3 -3
- data/lib/hachi/api.rb +8 -0
- data/lib/hachi/clients/alert.rb +7 -7
- data/lib/hachi/clients/artifact.rb +4 -4
- data/lib/hachi/clients/base.rb +49 -85
- data/lib/hachi/clients/case.rb +5 -5
- data/lib/hachi/clients/user.rb +1 -1
- data/lib/hachi/models/alert.rb +2 -13
- data/lib/hachi/models/artifact.rb +1 -5
- data/lib/hachi/models/case.rb +1 -8
- data/lib/hachi/models/user.rb +1 -4
- data/lib/hachi/version.rb +1 -1
- data/renovate.json +5 -0
- metadata +11 -10
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d03f917e4b7693f16612d130fb9808df41a4f66f962d757ec8e2dbedd6f039e1
|
4
|
+
data.tar.gz: 76ee4ec9ba69e732b17c7bff865fa5aaa5a251339b39b7daacc4e104000f99a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9281deed1829c4efe3ea82ed2ecafa616535cb4038867ab9ef480e28a328b39ad66c270503b5ef40d80b18c99dce849231aaa31e6c59a24ec5073dfebf9c103b
|
7
|
+
data.tar.gz: 637a3945b65862633bdfeeb1723f4179bd7a61ae989cc725b4427d94257dc5aa71c972100110afdadd61717294b7001957349ffb90a1978dcce70060186f82e6
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on: [pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby: [2.7, '3.0']
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Build and test with Rake
|
23
|
+
run: |
|
24
|
+
gem install bundler
|
25
|
+
bundle install
|
26
|
+
bundle exec rake
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# Hachi
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/hachi)
|
4
|
-
[](https://github.com/ninoseki/hachi/actions/workflows/test.yml)
|
5
5
|
[](https://coveralls.io/github/ninoseki/hachi?branch=master)
|
6
6
|
[](https://www.codefactor.io/repository/github/ninoseki/hachi)
|
7
7
|
|
8
8
|
Hachi(`蜂`) is a dead simple [TheHive](https://github.com/TheHive-Project/TheHive) API wrapper for Ruby.
|
9
9
|
|
10
|
+
**Note**: This library supports TheHive v4.
|
11
|
+
|
10
12
|
## Installation
|
11
13
|
|
12
14
|
```bash
|
@@ -26,10 +28,9 @@ api = Hachi::API.new(api_endpoint: "http://your_api_endpoint", api_key: "yoru_ap
|
|
26
28
|
# list alerts
|
27
29
|
api.alert.list
|
28
30
|
|
29
|
-
# search
|
30
|
-
|
31
|
-
|
32
|
-
api.artifact.search(data: %w(1.1.1.1 8.8.8.8 github.com))
|
31
|
+
# search artifacts
|
32
|
+
query = { "_and": [{ "_or": [{ "_field": "data", "_value": "1.1.1.1" }, { "_field": "data", "_value": "example.com" }] }] }
|
33
|
+
api.artifact.search(query)
|
33
34
|
```
|
34
35
|
|
35
36
|
See `samples` for more.
|
@@ -41,7 +42,7 @@ See `samples` for more.
|
|
41
42
|
| HTTP Method | URI | Action | API method |
|
42
43
|
|-------------|-----------------------------------|-----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
43
44
|
| GET | /api/alert | List alerts | `#api.alert.list` |
|
44
|
-
| POST | /api/alert/_search | Find alerts | `#api.alert.search(
|
45
|
+
| POST | /api/alert/_search | Find alerts | `#api.alert.search(query, range: "all")` |
|
45
46
|
| PATCH | /api/alert/_bulk | Update alerts in bulk | N/A |
|
46
47
|
| POST | /api/alert/_stats | Compute stats on alerts | N/A |
|
47
48
|
| POST | /api/alert | Create an alert | `#api.alert.create(title:, description:, severity: nil, date: nil, tags: nil, tlp: nil, status: nil, type:, source:, source_ref: nil, artifacts: nil, follow: nil)` |
|
@@ -59,7 +60,7 @@ See `samples` for more.
|
|
59
60
|
|
60
61
|
| HTTP Method | URI | Action | API method |
|
61
62
|
|-------------|----------------------------------------|---------------------------------|---------------------------------------------------------------------------------------|
|
62
|
-
| POST | /api/case/artifact/_search | Find observables | `#api.artifact.search(
|
63
|
+
| POST | /api/case/artifact/_search | Find observables | `#api.artifact.search(query, range: "all")` |
|
63
64
|
| POST | /api/case/artifact/_stats | Compute stats on observables | N/A |
|
64
65
|
| POST | /api/case/:caseId/artifact | Create an observable | `#api.artifact.create(case_id, data:, data_type:, message: nil, tlp: nil, tags: nil)` |
|
65
66
|
| GET | /api/case/artifact/:artifactId | Get an observable | `#api.artifact.get_by_id(id)` |
|
@@ -73,7 +74,7 @@ See `samples` for more.
|
|
73
74
|
| HTTP Method | URI | Action | API method |
|
74
75
|
|-------------|------------------------------------|---------------------------------------|----------------------------------------------------------------------------------------------------------------------|
|
75
76
|
| GET | /api/case | List cases | `#api.case.list` |
|
76
|
-
| POST | /api/case/_search | Find cases | `#api.case.search(
|
77
|
+
| POST | /api/case/_search | Find cases | `#api.case.search(query, range: "all")` |
|
77
78
|
| PATCH | /api/case/_bulk | Update cases in bulk | N/A |
|
78
79
|
| POST | /api/case/_stats | Compute stats on cases | N/A |
|
79
80
|
| POST | /api/case | Create a case | `#api.case.create(title:, description:, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil)` |
|
@@ -98,6 +99,15 @@ See `samples` for more.
|
|
98
99
|
| POST | /api/user/:userId/password/set | Set password | N/A |
|
99
100
|
| POST | /api/user/:userId/password/change | Change password | N/A |
|
100
101
|
|
102
|
+
|
103
|
+
## How to interact with unimplemented API endpoints
|
104
|
+
|
105
|
+
`Hachi::API` exposes `get`, `post`, `delete` and `patch` methods. You can interact with the API endpoints via the methods.
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
alerts = api.get("/api/alert" ) { |json| json }
|
109
|
+
```
|
110
|
+
|
101
111
|
## License
|
102
112
|
|
103
113
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
data/hachi.gemspec
CHANGED
@@ -24,10 +24,10 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_development_dependency "bundler", "~> 2.
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.2"
|
28
28
|
spec.add_development_dependency "coveralls", "~> 0.8"
|
29
29
|
spec.add_development_dependency "rake", "~> 13.0"
|
30
|
-
spec.add_development_dependency "rspec", "~> 3.
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.10"
|
31
31
|
spec.add_development_dependency "vcr", "~> 6.0"
|
32
|
-
spec.add_development_dependency "webmock", "~> 3.
|
32
|
+
spec.add_development_dependency "webmock", "~> 3.12"
|
33
33
|
end
|
data/lib/hachi/api.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'forwardable'
|
4
|
+
|
3
5
|
module Hachi
|
4
6
|
class API
|
7
|
+
extend Forwardable
|
8
|
+
|
5
9
|
# @return [String] TheHive API endpoint
|
6
10
|
attr_reader :api_endpoint
|
7
11
|
|
@@ -20,8 +24,12 @@ module Hachi
|
|
20
24
|
|
21
25
|
@api_key = api_key
|
22
26
|
raise ArgumentError, "api_key argument is required" unless api_key
|
27
|
+
|
28
|
+
@base = Clients::Base.new(api_endpoint: api_endpoint, api_key: api_key)
|
23
29
|
end
|
24
30
|
|
31
|
+
def_delegators :@base, :get, :post, :delete, :push
|
32
|
+
|
25
33
|
#
|
26
34
|
# Alert API endpoint client
|
27
35
|
#
|
data/lib/hachi/clients/alert.rb
CHANGED
@@ -55,7 +55,7 @@ module Hachi
|
|
55
55
|
#
|
56
56
|
# @return [Hash]
|
57
57
|
#
|
58
|
-
def create(title:, description:, severity: nil, date: nil, tags: nil, tlp: nil, status: nil,
|
58
|
+
def create(title:, description:, type:, source:, severity: nil, date: nil, tags: nil, tlp: nil, status: nil, source_ref: nil, artifacts: nil, follow: nil)
|
59
59
|
alert = Models::Alert.new(
|
60
60
|
title: title,
|
61
61
|
description: description,
|
@@ -70,20 +70,20 @@ module Hachi
|
|
70
70
|
artifacts: artifacts,
|
71
71
|
follow: follow,
|
72
72
|
)
|
73
|
-
post("/api/alert", alert.payload) { |json| json }
|
73
|
+
post("/api/alert", json: alert.payload) { |json| json }
|
74
74
|
end
|
75
75
|
|
76
76
|
#
|
77
77
|
# Find alerts
|
78
78
|
#
|
79
|
-
# @param [Hash]
|
79
|
+
# @param [Hash] query
|
80
80
|
# @param [String] range
|
81
81
|
# @param [String, nil] sort
|
82
82
|
#
|
83
83
|
# @return [Array]
|
84
84
|
#
|
85
|
-
def search(
|
86
|
-
_search("/api/alert/_search",
|
85
|
+
def search(query, range: "all", sort: nil)
|
86
|
+
_search("/api/alert/_search", query: query, range: range, sort: sort) { |json| json }
|
87
87
|
end
|
88
88
|
|
89
89
|
#
|
@@ -132,7 +132,7 @@ module Hachi
|
|
132
132
|
alertIds: ids.flatten,
|
133
133
|
caseId: case_id
|
134
134
|
}
|
135
|
-
post("/api/alert/merge/_bulk", params) { |json| json }
|
135
|
+
post("/api/alert/merge/_bulk", json: params) { |json| json }
|
136
136
|
end
|
137
137
|
|
138
138
|
#
|
@@ -157,7 +157,7 @@ module Hachi
|
|
157
157
|
tlp: tlp,
|
158
158
|
artifacts: artifacts,
|
159
159
|
}.compact
|
160
|
-
patch("/api/alert/#{id}", attributes) { |json| json }
|
160
|
+
patch("/api/alert/#{id}", json: attributes) { |json| json }
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
@@ -24,7 +24,7 @@ module Hachi
|
|
24
24
|
tags: tags,
|
25
25
|
)
|
26
26
|
|
27
|
-
post("/api/case/#{case_id}/artifact", artifact.payload) { |json| json }
|
27
|
+
post("/api/case/#{case_id}/artifact", json: artifact.payload) { |json| json }
|
28
28
|
end
|
29
29
|
|
30
30
|
#
|
@@ -52,13 +52,13 @@ module Hachi
|
|
52
52
|
#
|
53
53
|
# Find artifacts
|
54
54
|
#
|
55
|
-
# @param [Hash]
|
55
|
+
# @param [Hash] query
|
56
56
|
# @param [String] range
|
57
57
|
#
|
58
58
|
# @return [Array]
|
59
59
|
#
|
60
|
-
def search( range: "all"
|
61
|
-
_search("/api/case/artifact/_search",
|
60
|
+
def search(query, range: "all")
|
61
|
+
_search("/api/case/artifact/_search", query: query, range: range) { |json| json }
|
62
62
|
end
|
63
63
|
|
64
64
|
#
|
data/lib/hachi/clients/base.rb
CHANGED
@@ -7,14 +7,59 @@ require "uri"
|
|
7
7
|
module Hachi
|
8
8
|
module Clients
|
9
9
|
class Base
|
10
|
-
attr_reader :api_endpoint
|
11
|
-
attr_reader :api_key
|
10
|
+
attr_reader :api_endpoint, :api_key
|
12
11
|
|
13
12
|
def initialize(api_endpoint:, api_key:)
|
14
13
|
@api_endpoint = URI(api_endpoint)
|
15
14
|
@api_key = api_key
|
16
15
|
end
|
17
16
|
|
17
|
+
def get(path, params: {}, &block)
|
18
|
+
url = url_for(path)
|
19
|
+
url.query = URI.encode_www_form(params) unless params.empty?
|
20
|
+
|
21
|
+
get = Net::HTTP::Get.new(url)
|
22
|
+
get.add_field "Authorization", "Bearer #{api_key}"
|
23
|
+
request(get, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
def post(path, params: {}, json: {}, &block)
|
27
|
+
url = url_for(path)
|
28
|
+
url.query = URI.encode_www_form(params) unless params.empty?
|
29
|
+
|
30
|
+
post = Net::HTTP::Post.new(url)
|
31
|
+
post.body = json.is_a?(Hash) ? json.to_json : json.to_s
|
32
|
+
|
33
|
+
post.add_field "Content-Type", "application/json"
|
34
|
+
post.add_field "Authorization", "Bearer #{api_key}"
|
35
|
+
|
36
|
+
request(post, &block)
|
37
|
+
end
|
38
|
+
|
39
|
+
def delete(path, params: {}, json: {}, &block)
|
40
|
+
url = url_for(path)
|
41
|
+
url.query = URI.encode_www_form(params) unless params.empty?
|
42
|
+
|
43
|
+
delete = Net::HTTP::Delete.new(url)
|
44
|
+
delete.body = json.is_a?(Hash) ? json.to_json : json.to_s
|
45
|
+
|
46
|
+
delete.add_field "Authorization", "Bearer #{api_key}"
|
47
|
+
request(delete, &block)
|
48
|
+
end
|
49
|
+
|
50
|
+
def patch(path, params: {}, json: {}, &block)
|
51
|
+
url = url_for(path)
|
52
|
+
url.query = URI.encode_www_form(params) unless params.empty?
|
53
|
+
|
54
|
+
patch = Net::HTTP::Patch.new(url)
|
55
|
+
patch.body = json.is_a?(Hash) ? json.to_json : json.to_s
|
56
|
+
|
57
|
+
patch.add_field "Content-Type", "application/json"
|
58
|
+
patch.add_field "Authorization", "Bearer #{api_key}"
|
59
|
+
|
60
|
+
request(patch, &block)
|
61
|
+
end
|
62
|
+
|
18
63
|
private
|
19
64
|
|
20
65
|
def base_url
|
@@ -74,48 +119,6 @@ module Hachi
|
|
74
119
|
end
|
75
120
|
end
|
76
121
|
|
77
|
-
def get(path, params = {}, &block)
|
78
|
-
url = url_for(path)
|
79
|
-
url.query = URI.encode_www_form(params) unless params.empty?
|
80
|
-
|
81
|
-
get = Net::HTTP::Get.new(url)
|
82
|
-
get.add_field "Authorization", "Bearer #{api_key}"
|
83
|
-
request(get, &block)
|
84
|
-
end
|
85
|
-
|
86
|
-
def post(path, params = {}, &block)
|
87
|
-
url = url_for(path)
|
88
|
-
|
89
|
-
post = Net::HTTP::Post.new(url)
|
90
|
-
post.body = params.is_a?(Hash) ? params.to_json : params.to_s
|
91
|
-
|
92
|
-
post.add_field "Content-Type", "application/json"
|
93
|
-
post.add_field "Authorization", "Bearer #{api_key}"
|
94
|
-
|
95
|
-
request(post, &block)
|
96
|
-
end
|
97
|
-
|
98
|
-
def delete(path, params = {}, &block)
|
99
|
-
url = url_for(path)
|
100
|
-
url.query = URI.encode_www_form(params) unless params.empty?
|
101
|
-
|
102
|
-
delete = Net::HTTP::Delete.new(url)
|
103
|
-
delete.add_field "Authorization", "Bearer #{api_key}"
|
104
|
-
request(delete, &block)
|
105
|
-
end
|
106
|
-
|
107
|
-
def patch(path, params = {}, &block)
|
108
|
-
url = url_for(path)
|
109
|
-
|
110
|
-
patch = Net::HTTP::Patch.new(url)
|
111
|
-
patch.body = params.is_a?(Hash) ? params.to_json : params.to_s
|
112
|
-
|
113
|
-
patch.add_field "Content-Type", "application/json"
|
114
|
-
patch.add_field "Authorization", "Bearer #{api_key}"
|
115
|
-
|
116
|
-
request(patch, &block)
|
117
|
-
end
|
118
|
-
|
119
122
|
def validate_range(range)
|
120
123
|
return true if range == "all"
|
121
124
|
raise ArgumentError, "range should be 'all' or `from-to`" unless range.match?(/(\d+)-(\d+)/)
|
@@ -126,51 +129,12 @@ module Hachi
|
|
126
129
|
raise ArgumentError, "from should be smaller than to"
|
127
130
|
end
|
128
131
|
|
129
|
-
def _search(path,
|
132
|
+
def _search(path, query:, range: "all", sort: nil)
|
130
133
|
validate_range range
|
131
134
|
|
132
|
-
attributes = normalize_attributes(attributes)
|
133
|
-
conditions = attributes.map do |key, value|
|
134
|
-
if key == :data && value.is_a?(Array)
|
135
|
-
{ _or: decompose_data(value) }
|
136
|
-
else
|
137
|
-
{ _string: "#{key}:\"#{value}\"" }
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
default_conditions = {
|
142
|
-
_and: [
|
143
|
-
{ _not: { status: "Deleted" } },
|
144
|
-
{ _not: { _in: { _field: "_type", _values: ["dashboard", "data", "user", "analyzer", "caseTemplate", "reportTemplate", "action"] } } },
|
145
|
-
],
|
146
|
-
}
|
147
|
-
|
148
|
-
query = {
|
149
|
-
_and: [conditions, default_conditions].flatten,
|
150
|
-
}
|
151
|
-
|
152
135
|
query_string = build_query_string(range: range, sort: sort)
|
153
136
|
|
154
|
-
post("#{path}?#{query_string}", query: query) { |json| json }
|
155
|
-
end
|
156
|
-
|
157
|
-
def decompose_data(data)
|
158
|
-
data.map do |elem|
|
159
|
-
{ _field: "data", _value: elem }
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
def normalize_attributes(attributes)
|
164
|
-
h = {}
|
165
|
-
attributes.each do |key, value|
|
166
|
-
h[camelize(key).to_sym] = value
|
167
|
-
end
|
168
|
-
h
|
169
|
-
end
|
170
|
-
|
171
|
-
def camelize(string)
|
172
|
-
head, *others = string.to_s.split("_")
|
173
|
-
[head, others.map(&:capitalize)].flatten.join
|
137
|
+
post("#{path}?#{query_string}", json: { query: query }) { |json| json }
|
174
138
|
end
|
175
139
|
|
176
140
|
def build_query_string(params)
|
data/lib/hachi/clients/case.rb
CHANGED
@@ -60,19 +60,19 @@ module Hachi
|
|
60
60
|
tags: tags,
|
61
61
|
)
|
62
62
|
|
63
|
-
post("/api/case", kase.payload) { |json| json }
|
63
|
+
post("/api/case", json: kase.payload) { |json| json }
|
64
64
|
end
|
65
65
|
|
66
66
|
#
|
67
67
|
# Find cases
|
68
68
|
#
|
69
|
-
# @param [Hash]
|
69
|
+
# @param [Hash] query
|
70
70
|
# @param [String] range
|
71
71
|
#
|
72
72
|
# @return [Hash]
|
73
73
|
#
|
74
|
-
def search(range: "all"
|
75
|
-
_search("/api/case/_search",
|
74
|
+
def search(query, range: "all")
|
75
|
+
_search("/api/case/_search", query: query, range: range) { |json| json }
|
76
76
|
end
|
77
77
|
|
78
78
|
#
|
@@ -138,7 +138,7 @@ module Hachi
|
|
138
138
|
metrics: metrics,
|
139
139
|
customFields: custom_fields
|
140
140
|
}.compact
|
141
|
-
patch("/api/case/#{id}", attributes) { |json| json }
|
141
|
+
patch("/api/case/#{id}", json: attributes) { |json| json }
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|
data/lib/hachi/clients/user.rb
CHANGED
data/lib/hachi/models/alert.rb
CHANGED
@@ -6,20 +6,9 @@ require "securerandom"
|
|
6
6
|
module Hachi
|
7
7
|
module Models
|
8
8
|
class Alert < Base
|
9
|
-
attr_reader :title
|
10
|
-
attr_reader :description
|
11
|
-
attr_reader :severity
|
12
|
-
attr_reader :date
|
13
|
-
attr_reader :tags
|
14
|
-
attr_reader :tlp
|
15
|
-
attr_reader :status
|
16
|
-
attr_reader :type
|
17
|
-
attr_reader :source
|
18
|
-
attr_reader :source_ref
|
19
|
-
attr_reader :artifacts
|
20
|
-
attr_reader :follow
|
9
|
+
attr_reader :title, :description, :severity, :date, :tags, :tlp, :status, :type, :source, :source_ref, :artifacts, :follow
|
21
10
|
|
22
|
-
def initialize(title:, description:, severity: nil, date: nil, tags: nil, tlp: nil, status: nil,
|
11
|
+
def initialize(title:, description:, type:, source:, severity: nil, date: nil, tags: nil, tlp: nil, status: nil, source_ref: nil, artifacts: nil, follow: nil)
|
23
12
|
@title = title
|
24
13
|
@description = description
|
25
14
|
@severity = severity
|
@@ -5,11 +5,7 @@ module Hachi
|
|
5
5
|
class Artifact < Base
|
6
6
|
DATA_TYPES = %w(filename file fqdn hash uri_path ip domain mail autonomous-system registry mail_subject regexp user-agent other url).freeze
|
7
7
|
|
8
|
-
attr_reader :data
|
9
|
-
attr_reader :data_type
|
10
|
-
attr_reader :message
|
11
|
-
attr_reader :tlp
|
12
|
-
attr_reader :tags
|
8
|
+
attr_reader :data, :data_type, :message, :tlp, :tags
|
13
9
|
|
14
10
|
def initialize(data:, data_type:, message: nil, tlp: nil, tags: nil)
|
15
11
|
@data = data
|
data/lib/hachi/models/case.rb
CHANGED
@@ -3,14 +3,7 @@
|
|
3
3
|
module Hachi
|
4
4
|
module Models
|
5
5
|
class Case < Base
|
6
|
-
attr_reader :title
|
7
|
-
attr_reader :description
|
8
|
-
attr_reader :severity
|
9
|
-
attr_reader :start_date
|
10
|
-
attr_reader :owner
|
11
|
-
attr_reader :flag
|
12
|
-
attr_reader :tlp
|
13
|
-
attr_reader :tags
|
6
|
+
attr_reader :title, :description, :severity, :start_date, :owner, :flag, :tlp, :tags
|
14
7
|
|
15
8
|
def initialize(title:, description:, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil)
|
16
9
|
@title = title
|
data/lib/hachi/models/user.rb
CHANGED
data/lib/hachi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hachi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: coveralls
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.10'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
68
|
+
version: '3.10'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: vcr
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.12'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.12'
|
97
97
|
description: A dead simple TheHive API wrapper.
|
98
98
|
email:
|
99
99
|
- manabu.niseki@gmail.com
|
@@ -101,9 +101,9 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".github/workflows/test.yml"
|
104
105
|
- ".gitignore"
|
105
106
|
- ".rspec"
|
106
|
-
- ".travis.yml"
|
107
107
|
- Gemfile
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/hachi/models/case.rb
|
125
125
|
- lib/hachi/models/user.rb
|
126
126
|
- lib/hachi/version.rb
|
127
|
+
- renovate.json
|
127
128
|
- samples/01_create_an_alert.rb
|
128
129
|
- samples/02_search_artifacts.rb
|
129
130
|
- samples/03_list_cases.rb
|
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
148
|
- !ruby/object:Gem::Version
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.2.3
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: A dead simple TheHive API wrapper.
|