mihari 1.4.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +43 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
- data/.github/workflows/test.yml +68 -0
- data/.standard.yml +4 -0
- data/README.md +22 -270
- data/Rakefile +1 -0
- data/build_frontend.sh +14 -0
- data/docker/Dockerfile +5 -3
- data/{screenshots → images}/alert.png +0 -0
- data/{screenshots → images}/eyecatch.png +0 -0
- data/images/logo.png +0 -0
- data/{screenshots → images}/misp.png +0 -0
- data/{screenshots → images}/slack.png +0 -0
- data/images/web_alerts.png +0 -0
- data/images/web_config.png +0 -0
- data/lib/mihari.rb +2 -2
- data/lib/mihari/analyzers/basic.rb +3 -4
- data/lib/mihari/analyzers/binaryedge.rb +4 -7
- data/lib/mihari/analyzers/censys.rb +3 -7
- data/lib/mihari/analyzers/circl.rb +3 -5
- data/lib/mihari/analyzers/crtsh.rb +2 -6
- data/lib/mihari/analyzers/dnpedia.rb +3 -6
- data/lib/mihari/analyzers/dnstwister.rb +4 -9
- data/lib/mihari/analyzers/free_text.rb +2 -6
- data/lib/mihari/analyzers/http_hash.rb +3 -11
- data/lib/mihari/analyzers/onyphe.rb +3 -6
- data/lib/mihari/analyzers/otx.rb +4 -9
- data/lib/mihari/analyzers/passive_dns.rb +4 -9
- data/lib/mihari/analyzers/passive_ssl.rb +4 -9
- data/lib/mihari/analyzers/passivetotal.rb +9 -14
- data/lib/mihari/analyzers/pulsedive.rb +7 -12
- data/lib/mihari/analyzers/reverse_whois.rb +4 -9
- data/lib/mihari/analyzers/securitytrails.rb +12 -17
- data/lib/mihari/analyzers/securitytrails_domain_feed.rb +3 -7
- data/lib/mihari/analyzers/shodan.rb +9 -8
- data/lib/mihari/analyzers/spyse.rb +6 -11
- data/lib/mihari/analyzers/ssh_fingerprint.rb +2 -6
- data/lib/mihari/analyzers/urlscan.rb +4 -12
- data/lib/mihari/analyzers/virustotal.rb +6 -11
- data/lib/mihari/analyzers/zoomeye.rb +7 -11
- data/lib/mihari/cli.rb +62 -299
- data/lib/mihari/commands/binaryedge.rb +21 -0
- data/lib/mihari/commands/censys.rb +22 -0
- data/lib/mihari/commands/circl.rb +21 -0
- data/lib/mihari/commands/config.rb +21 -0
- data/lib/mihari/commands/crtsh.rb +22 -0
- data/lib/mihari/commands/dnpedia.rb +21 -0
- data/lib/mihari/commands/dnstwister.rb +19 -0
- data/lib/mihari/commands/free_text.rb +21 -0
- data/lib/mihari/commands/http_hash.rb +25 -0
- data/lib/mihari/commands/json.rb +36 -0
- data/lib/mihari/commands/onyphe.rb +19 -0
- data/lib/mihari/commands/otx.rb +21 -0
- data/lib/mihari/commands/passive_dns.rb +19 -0
- data/lib/mihari/commands/passive_ssl.rb +21 -0
- data/lib/mihari/commands/passivetotal.rb +21 -0
- data/lib/mihari/commands/pulsedive.rb +21 -0
- data/lib/mihari/commands/reverse_whois.rb +21 -0
- data/lib/mihari/commands/securitytrails.rb +20 -0
- data/lib/mihari/commands/securitytrails_domain_feed.rb +23 -0
- data/lib/mihari/commands/shodan.rb +19 -0
- data/lib/mihari/commands/spyse.rb +20 -0
- data/lib/mihari/commands/ssh_fingerprint.rb +21 -0
- data/lib/mihari/commands/urlscan.rb +23 -0
- data/lib/mihari/commands/virustotal.rb +19 -0
- data/lib/mihari/commands/web.rb +20 -0
- data/lib/mihari/commands/zoomeye.rb +20 -0
- data/lib/mihari/config.rb +13 -25
- data/lib/mihari/configurable.rb +4 -5
- data/lib/mihari/database.rb +7 -1
- data/lib/mihari/emitters/misp.rb +4 -2
- data/lib/mihari/emitters/slack.rb +18 -7
- data/lib/mihari/emitters/the_hive.rb +1 -1
- data/lib/mihari/errors.rb +2 -0
- data/lib/mihari/models/alert.rb +51 -0
- data/lib/mihari/models/artifact.rb +1 -1
- data/lib/mihari/notifiers/exception_notifier.rb +1 -1
- data/lib/mihari/serializers/alert.rb +1 -1
- data/lib/mihari/serializers/artifact.rb +1 -1
- data/lib/mihari/serializers/tag.rb +1 -1
- data/lib/mihari/status.rb +10 -10
- data/lib/mihari/type_checker.rb +4 -4
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/app.rb +166 -0
- data/lib/mihari/web/public/index.html +21 -0
- data/lib/mihari/web/public/static/favicon.ico +0 -0
- data/lib/mihari/web/public/static/fonts/fa-brands-400.099a9556.woff +0 -0
- data/lib/mihari/web/public/static/fonts/fa-brands-400.30cc681d.eot +0 -0
- data/lib/mihari/web/public/static/fonts/fa-brands-400.3b89dd10.ttf +0 -0
- data/lib/mihari/web/public/static/fonts/fa-brands-400.f7307680.woff2 +0 -0
- data/lib/mihari/web/public/static/fonts/fa-regular-400.1f77739c.ttf +0 -0
- data/lib/mihari/web/public/static/fonts/fa-regular-400.7124eb50.woff +0 -0
- data/lib/mihari/web/public/static/fonts/fa-regular-400.7630483d.eot +0 -0
- data/lib/mihari/web/public/static/fonts/fa-regular-400.f0f82301.woff2 +0 -0
- data/lib/mihari/web/public/static/fonts/fa-solid-900.1042e8ca.eot +0 -0
- data/lib/mihari/web/public/static/fonts/fa-solid-900.605ed792.ttf +0 -0
- data/lib/mihari/web/public/static/fonts/fa-solid-900.9fe5a17c.woff +0 -0
- data/lib/mihari/web/public/static/fonts/fa-solid-900.e8a427e1.woff2 +0 -0
- data/lib/mihari/web/public/static/img/fa-brands-400.ba7ed552.svg +3717 -0
- data/lib/mihari/web/public/static/img/fa-regular-400.0bb42845.svg +801 -0
- data/lib/mihari/web/public/static/img/fa-solid-900.376c1f97.svg +5034 -0
- data/lib/mihari/web/public/static/js/app.280cbdb7.js +12 -0
- data/lib/mihari/web/public/static/js/app.280cbdb7.js.map +1 -0
- data/mihari.gemspec +31 -24
- metadata +213 -49
- data/.travis.yml +0 -13
- data/lib/mihari/alert_viewer.rb +0 -23
@@ -5,11 +5,7 @@ require "zoomeye"
|
|
5
5
|
module Mihari
|
6
6
|
module Analyzers
|
7
7
|
class ZoomEye < Base
|
8
|
-
attr_reader :title
|
9
|
-
attr_reader :description
|
10
|
-
attr_reader :query
|
11
|
-
attr_reader :tags
|
12
|
-
attr_reader :type
|
8
|
+
attr_reader :title, :description, :query, :tags, :type
|
13
9
|
|
14
10
|
def initialize(query, title: nil, description: nil, tags: [], type: "host")
|
15
11
|
super()
|
@@ -37,11 +33,11 @@ module Mihari
|
|
37
33
|
PAGE_SIZE = 10
|
38
34
|
|
39
35
|
def valid_type?
|
40
|
-
%w
|
36
|
+
%w[host web].include? type
|
41
37
|
end
|
42
38
|
|
43
39
|
def config_keys
|
44
|
-
%w
|
40
|
+
%w[zoomeye_password zoomeye_username]
|
45
41
|
end
|
46
42
|
|
47
43
|
def api
|
@@ -50,9 +46,9 @@ module Mihari
|
|
50
46
|
|
51
47
|
def convert_responses(responses)
|
52
48
|
responses.map do |res|
|
53
|
-
matches = res
|
49
|
+
matches = res["matches"] || []
|
54
50
|
matches.map do |match|
|
55
|
-
match
|
51
|
+
match["ip"]
|
56
52
|
end
|
57
53
|
end.flatten.compact.uniq
|
58
54
|
end
|
@@ -69,7 +65,7 @@ module Mihari
|
|
69
65
|
res = _host_lookup(query, page: page)
|
70
66
|
break unless res
|
71
67
|
|
72
|
-
total = res
|
68
|
+
total = res["total"].to_i
|
73
69
|
responses << res
|
74
70
|
break if total <= page * PAGE_SIZE
|
75
71
|
end
|
@@ -88,7 +84,7 @@ module Mihari
|
|
88
84
|
res = _web_lookup(query, page: page)
|
89
85
|
break unless res
|
90
86
|
|
91
|
-
total = res
|
87
|
+
total = res["total"].to_i
|
92
88
|
responses << res
|
93
89
|
break if total <= page * PAGE_SIZE
|
94
90
|
end
|
data/lib/mihari/cli.rb
CHANGED
@@ -1,301 +1,70 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "thor"
|
4
|
-
|
4
|
+
|
5
|
+
require "mihari/commands/binaryedge"
|
6
|
+
require "mihari/commands/censys"
|
7
|
+
require "mihari/commands/circl"
|
8
|
+
require "mihari/commands/crtsh"
|
9
|
+
require "mihari/commands/dnpedia"
|
10
|
+
require "mihari/commands/dnstwister"
|
11
|
+
require "mihari/commands/onyphe"
|
12
|
+
require "mihari/commands/otx"
|
13
|
+
require "mihari/commands/passivetotal"
|
14
|
+
require "mihari/commands/pulsedive"
|
15
|
+
require "mihari/commands/securitytrails_domain_feed"
|
16
|
+
require "mihari/commands/securitytrails"
|
17
|
+
require "mihari/commands/shodan"
|
18
|
+
require "mihari/commands/spyse"
|
19
|
+
require "mihari/commands/urlscan"
|
20
|
+
require "mihari/commands/virustotal"
|
21
|
+
require "mihari/commands/zoomeye"
|
22
|
+
|
23
|
+
require "mihari/commands/free_text"
|
24
|
+
require "mihari/commands/http_hash"
|
25
|
+
require "mihari/commands/passive_dns"
|
26
|
+
require "mihari/commands/passive_ssl"
|
27
|
+
require "mihari/commands/reverse_whois"
|
28
|
+
require "mihari/commands/ssh_fingerprint"
|
29
|
+
|
30
|
+
require "mihari/commands/config"
|
31
|
+
require "mihari/commands/json"
|
32
|
+
require "mihari/commands/web"
|
5
33
|
|
6
34
|
module Mihari
|
7
35
|
class CLI < Thor
|
8
|
-
class_option :config, type: :string, desc: "path to config file"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
with_error_handling do
|
41
|
-
run_analyzer Analyzers::Onyphe, query: query, options: options
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
desc "urlscan [QUERY]", "urlscan search by a given query"
|
46
|
-
method_option :title, type: :string, desc: "title"
|
47
|
-
method_option :description, type: :string, desc: "description"
|
48
|
-
method_option :tags, type: :array, desc: "tags"
|
49
|
-
method_option :filter, type: :string, desc: "filter for urlscan pro search"
|
50
|
-
method_option :target_type, type: :string, default: "url", desc: "target type to fetch from lookup results (target type should be 'url', 'domain' or 'ip')"
|
51
|
-
method_option :use_pro, type: :boolean, default: false, desc: "use pro search API or not"
|
52
|
-
method_option :use_similarity, type: :boolean, default: false, desc: "use similarity API or not"
|
53
|
-
def urlscan(query)
|
54
|
-
with_error_handling do
|
55
|
-
run_analyzer Analyzers::Urlscan, query: query, options: options
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
desc "virustotal [IP|DOMAIN]", "VirusTotal resolutions lookup by an ip or domain"
|
60
|
-
method_option :title, type: :string, desc: "title"
|
61
|
-
method_option :description, type: :string, desc: "description"
|
62
|
-
method_option :tags, type: :array, desc: "tags"
|
63
|
-
def virustotal(indiactor)
|
64
|
-
with_error_handling do
|
65
|
-
run_analyzer Analyzers::VirusTotal, query: refang(indiactor), options: options
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
desc "securitytrails [IP|DOMAIN|EMAIL]", "SecurityTrails lookup by an ip, domain or email"
|
70
|
-
method_option :title, type: :string, desc: "title"
|
71
|
-
method_option :description, type: :string, desc: "description"
|
72
|
-
method_option :tags, type: :array, desc: "tags"
|
73
|
-
def securitytrails(indiactor)
|
74
|
-
with_error_handling do
|
75
|
-
run_analyzer Analyzers::SecurityTrails, query: refang(indiactor), options: options
|
76
|
-
end
|
77
|
-
end
|
78
|
-
map "st" => :securitytrails
|
79
|
-
|
80
|
-
desc "securitytrails_domain_feed [REGEXP]", "SecurityTrails new domain feed search by a regexp"
|
81
|
-
method_option :title, type: :string, desc: "title"
|
82
|
-
method_option :description, type: :string, desc: "description"
|
83
|
-
method_option :tags, type: :array, desc: "tags"
|
84
|
-
method_option :type, type: :string, default: "registered", desc: "A type of domain feed ('all', 'new' or 'registered')"
|
85
|
-
def securitytrails_domain_feed(regexp)
|
86
|
-
with_error_handling do
|
87
|
-
run_analyzer Analyzers::SecurityTrailsDomainFeed, query: regexp, options: options
|
88
|
-
end
|
89
|
-
end
|
90
|
-
map "st_domain_feed" => :securitytrails_domain_feed
|
91
|
-
|
92
|
-
desc "crtsh [QUERY]", "crt.sh search by a query"
|
93
|
-
method_option :title, type: :string, desc: "title"
|
94
|
-
method_option :description, type: :string, desc: "description"
|
95
|
-
method_option :tags, type: :array, desc: "tags"
|
96
|
-
method_option :exclude_expired, type: :boolean, desc: "exclude expired certificates"
|
97
|
-
def crtsh(query)
|
98
|
-
with_error_handling do
|
99
|
-
run_analyzer Analyzers::Crtsh, query: query, options: options
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
desc "dnpedia [QUERY]", "DNPedia domain search by a query"
|
104
|
-
method_option :title, type: :string, desc: "title"
|
105
|
-
method_option :description, type: :string, desc: "description"
|
106
|
-
method_option :tags, type: :array, desc: "tags"
|
107
|
-
def dnpedia(query)
|
108
|
-
with_error_handling do
|
109
|
-
run_analyzer Analyzers::DNPedia, query: query, options: options
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
desc "circl [DOMAIN|SHA1]", "CIRCL passive DNS/SSL lookup by a domain or SHA1 certificate fingerprint"
|
114
|
-
method_option :title, type: :string, desc: "title"
|
115
|
-
method_option :description, type: :string, desc: "description"
|
116
|
-
method_option :tags, type: :array, desc: "tags"
|
117
|
-
def circl(query)
|
118
|
-
with_error_handling do
|
119
|
-
run_analyzer Analyzers::CIRCL, query: refang(query), options: options
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
desc "passivetotal [IP|DOMAIN|EMAIL|SHA1]", "PassiveTotal lookup by an ip, domain, email or SHA1 certificate fingerprint"
|
124
|
-
method_option :title, type: :string, desc: "title"
|
125
|
-
method_option :description, type: :string, desc: "description"
|
126
|
-
method_option :tags, type: :array, desc: "tags"
|
127
|
-
def passivetotal(indicator)
|
128
|
-
with_error_handling do
|
129
|
-
run_analyzer Analyzers::PassiveTotal, query: refang(indicator), options: options
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
desc "zoomeye [QUERY]", "ZoomEye search by a query"
|
134
|
-
method_option :title, type: :string, desc: "title"
|
135
|
-
method_option :description, type: :string, desc: "description"
|
136
|
-
method_option :tags, type: :array, desc: "tags"
|
137
|
-
method_option :type, type: :string, desc: "type to search(host / web)", default: "host"
|
138
|
-
def zoomeye(query)
|
139
|
-
with_error_handling do
|
140
|
-
run_analyzer Analyzers::ZoomEye, query: query, options: options
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
desc "binaryedge [QUERY]", "BinaryEdge host search by a query"
|
145
|
-
method_option :title, type: :string, desc: "title"
|
146
|
-
method_option :description, type: :string, desc: "description"
|
147
|
-
method_option :tags, type: :array, desc: "tags"
|
148
|
-
def binaryedge(query)
|
149
|
-
with_error_handling do
|
150
|
-
run_analyzer Analyzers::BinaryEdge, query: query, options: options
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
desc "pulsedive [IP|DOMAIN]", "Pulsedive lookup by an ip or domain"
|
155
|
-
method_option :title, type: :string, desc: "title"
|
156
|
-
method_option :description, type: :string, desc: "description"
|
157
|
-
method_option :tags, type: :array, desc: "tags"
|
158
|
-
def pulsedive(indiactor)
|
159
|
-
with_error_handling do
|
160
|
-
run_analyzer Analyzers::Pulsedive, query: refang(indiactor), options: options
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
desc "dnstwister [DOMAIN]", "dnstwister lookup by a domain"
|
165
|
-
method_option :title, type: :string, desc: "title"
|
166
|
-
method_option :description, type: :string, desc: "description"
|
167
|
-
method_option :tags, type: :array, desc: "tags"
|
168
|
-
def dnstwister(domain)
|
169
|
-
with_error_handling do
|
170
|
-
run_analyzer Analyzers::DNSTwister, query: refang(domain), options: options
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
desc "otx [IP|DOMAIN]", "OTX lookup by an IP or domain"
|
175
|
-
method_option :title, type: :string, desc: "title"
|
176
|
-
method_option :description, type: :string, desc: "description"
|
177
|
-
method_option :tags, type: :array, desc: "tags"
|
178
|
-
def otx(domain)
|
179
|
-
with_error_handling do
|
180
|
-
run_analyzer Analyzers::OTX, query: refang(domain), options: options
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
desc "spyse [QUERY]", "Spyse search by a query"
|
185
|
-
method_option :title, type: :string, desc: "title"
|
186
|
-
method_option :description, type: :string, desc: "description"
|
187
|
-
method_option :tags, type: :array, desc: "tags"
|
188
|
-
method_option :type, type: :string, desc: "type to search (ip or domain)", default: "doamin"
|
189
|
-
def spyse(query)
|
190
|
-
with_error_handling do
|
191
|
-
run_analyzer Analyzers::Spyse, query: query, options: options
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
desc "passive_dns [IP|DOMAIN]", "Cross search with passive DNS services by an ip or domain"
|
196
|
-
method_option :title, type: :string, desc: "title"
|
197
|
-
method_option :description, type: :string, desc: "description"
|
198
|
-
method_option :tags, type: :array, desc: "tags"
|
199
|
-
def passive_dns(query)
|
200
|
-
with_error_handling do
|
201
|
-
run_analyzer Analyzers::PassiveDNS, query: refang(query), options: options
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
desc "passive_ssl [SHA1]", "Cross search with passive SSL services by an SHA1 certificate fingerprint"
|
206
|
-
method_option :title, type: :string, desc: "title"
|
207
|
-
method_option :description, type: :string, desc: "description"
|
208
|
-
method_option :tags, type: :array, desc: "tags"
|
209
|
-
def passive_ssl(query)
|
210
|
-
with_error_handling do
|
211
|
-
run_analyzer Analyzers::PassiveSSL, query: query, options: options
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
desc "reverse_whois [EMAIL]", "Cross search with reverse whois services by an email"
|
216
|
-
method_option :title, type: :string, desc: "title"
|
217
|
-
method_option :description, type: :string, desc: "description"
|
218
|
-
method_option :tags, type: :array, desc: "tags"
|
219
|
-
def reverse_whois(query)
|
220
|
-
with_error_handling do
|
221
|
-
run_analyzer Analyzers::ReveseWhois, query: refang(query), options: options
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
desc "http_hash", "Cross search with search engines by a hash of an HTTP response (SHA256, MD5 and MurmurHash3)"
|
226
|
-
method_option :title, type: :string, desc: "title"
|
227
|
-
method_option :description, type: :string, desc: "description"
|
228
|
-
method_option :tags, type: :array, desc: "tags"
|
229
|
-
method_option :md5, type: :string, desc: "MD5 hash"
|
230
|
-
method_option :sha256, type: :string, desc: "SHA256 hash"
|
231
|
-
method_option :mmh3, type: :numeric, desc: "MurmurHash3 hash"
|
232
|
-
method_option :html, type: :string, desc: "path to an HTML file"
|
233
|
-
def http_hash
|
234
|
-
with_error_handling do
|
235
|
-
run_analyzer Analyzers::HTTPHash, query: nil, options: options
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
desc "free_text [TEXT]", "Cross search with search engines by a free text"
|
240
|
-
method_option :title, type: :string, desc: "title"
|
241
|
-
method_option :description, type: :string, desc: "description"
|
242
|
-
method_option :tags, type: :array, desc: "tags"
|
243
|
-
def free_text(text)
|
244
|
-
with_error_handling do
|
245
|
-
run_analyzer Analyzers::FreeText, query: text, options: options
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
desc "ssh_fingerprint [FINGERPRINT]", "Cross search with search engines by an SSH fingerprint (e.g. dc:14:de:8e:d7:c1:15:43:23:82:25:81:d2:59:e8:c0)"
|
250
|
-
method_option :title, type: :string, desc: "title"
|
251
|
-
method_option :description, type: :string, desc: "description"
|
252
|
-
method_option :tags, type: :array, desc: "tags"
|
253
|
-
def ssh_fingerprint(fingerprint)
|
254
|
-
with_error_handling do
|
255
|
-
run_analyzer Analyzers::SSHFingerprint, query: fingerprint, options: options
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
desc "import_from_json", "Give a JSON input via STDIN"
|
260
|
-
def import_from_json(input = nil)
|
261
|
-
with_error_handling do
|
262
|
-
json = input || STDIN.gets.chomp
|
263
|
-
raise ArgumentError, "Input not found: please give an input in a JSON format" unless json
|
264
|
-
|
265
|
-
json = parse_as_json(json)
|
266
|
-
raise ArgumentError, "Invalid input format: an input JSON data should have title, description and artifacts key" unless valid_json?(json)
|
267
|
-
|
268
|
-
title = json.dig("title")
|
269
|
-
description = json.dig("description")
|
270
|
-
artifacts = json.dig("artifacts")
|
271
|
-
tags = json.dig("tags") || []
|
272
|
-
|
273
|
-
basic = Analyzers::Basic.new(title: title, description: description, artifacts: artifacts, source: "json", tags: tags)
|
274
|
-
basic.run
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
desc "alerts", "Show the alerts on TheHive"
|
279
|
-
method_option :limit, type: :string, default: "5", desc: "Number of alerts to show (or 'all' to show all the alerts)"
|
280
|
-
method_option :title, type: :string, desc: "Title to filter"
|
281
|
-
method_option :source, type: :string, desc: "Source to filter"
|
282
|
-
method_option :tag, type: :string, desc: "Tag to filter"
|
283
|
-
def alerts
|
284
|
-
with_error_handling do
|
285
|
-
load_configuration
|
286
|
-
|
287
|
-
viewer = AlertViewer.new
|
288
|
-
alerts = viewer.list(limit: options["limit"], title: options["title"], source: options["source"], tag: options[:tag])
|
289
|
-
puts JSON.pretty_generate(alerts)
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
desc "status", "Show the current configuration status"
|
294
|
-
def status
|
295
|
-
with_error_handling do
|
296
|
-
load_configuration
|
297
|
-
|
298
|
-
puts JSON.pretty_generate(Status.check)
|
36
|
+
class_option :config, type: :string, desc: "path to the config file"
|
37
|
+
|
38
|
+
include Mihari::Commands::BinaryEdge
|
39
|
+
include Mihari::Commands::Censys
|
40
|
+
include Mihari::Commands::CIRCL
|
41
|
+
include Mihari::Commands::Config
|
42
|
+
include Mihari::Commands::Crtsh
|
43
|
+
include Mihari::Commands::DNPedia
|
44
|
+
include Mihari::Commands::DNSTwister
|
45
|
+
include Mihari::Commands::FreeText
|
46
|
+
include Mihari::Commands::HTTPHash
|
47
|
+
include Mihari::Commands::JSON
|
48
|
+
include Mihari::Commands::Onyphe
|
49
|
+
include Mihari::Commands::OTX
|
50
|
+
include Mihari::Commands::PassiveDNS
|
51
|
+
include Mihari::Commands::PassiveSSL
|
52
|
+
include Mihari::Commands::PassiveTotal
|
53
|
+
include Mihari::Commands::Pulsedive
|
54
|
+
include Mihari::Commands::ReverseWhois
|
55
|
+
include Mihari::Commands::SecurityTrails
|
56
|
+
include Mihari::Commands::SecurityTrailsDomainFeed
|
57
|
+
include Mihari::Commands::Shodan
|
58
|
+
include Mihari::Commands::Spyse
|
59
|
+
include Mihari::Commands::SSHFingerprint
|
60
|
+
include Mihari::Commands::Urlscan
|
61
|
+
include Mihari::Commands::VirusTotal
|
62
|
+
include Mihari::Commands::Web
|
63
|
+
include Mihari::Commands::ZoomEye
|
64
|
+
|
65
|
+
class << self
|
66
|
+
def exit_on_failure?
|
67
|
+
true
|
299
68
|
end
|
300
69
|
end
|
301
70
|
|
@@ -307,15 +76,9 @@ module Mihari
|
|
307
76
|
notifier.notify e
|
308
77
|
end
|
309
78
|
|
310
|
-
def parse_as_json(input)
|
311
|
-
JSON.parse input
|
312
|
-
rescue JSON::ParserError => _e
|
313
|
-
nil
|
314
|
-
end
|
315
|
-
|
316
79
|
# @return [true, false]
|
317
80
|
def valid_json?(json)
|
318
|
-
%w
|
81
|
+
%w[title description artifacts].all? { |key| json.key? key }
|
319
82
|
end
|
320
83
|
|
321
84
|
def load_configuration
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mihari
|
4
|
+
module Commands
|
5
|
+
module BinaryEdge
|
6
|
+
def self.included(thor)
|
7
|
+
thor.class_eval do
|
8
|
+
desc "binaryedge [QUERY]", "BinaryEdge host search by a query"
|
9
|
+
method_option :title, type: :string, desc: "title"
|
10
|
+
method_option :description, type: :string, desc: "description"
|
11
|
+
method_option :tags, type: :array, desc: "tags"
|
12
|
+
def binaryedge(query)
|
13
|
+
with_error_handling do
|
14
|
+
run_analyzer Analyzers::BinaryEdge, query: query, options: options
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|