mihari 7.6.0 → 7.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +25 -5
- data/.shadowenv.d/000_unset_all.lisp +1 -0
- data/README.md +1 -0
- data/Rakefile +3 -1
- data/lefthook.yml +4 -4
- data/lib/mihari/analyzers/validin.rb +76 -0
- data/lib/mihari/clients/crtsh.rb +1 -1
- data/lib/mihari/clients/dnstwister.rb +1 -1
- data/lib/mihari/clients/google_public_dns.rb +1 -1
- data/lib/mihari/clients/mmdb.rb +1 -1
- data/lib/mihari/clients/shodan_internet_db.rb +1 -1
- data/lib/mihari/clients/validin.rb +47 -0
- data/lib/mihari/config.rb +4 -0
- data/lib/mihari/enrichers/base.rb +1 -1
- data/lib/mihari/schemas/analyzer.rb +1 -0
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/public/assets/index-CuFhw5g8.css +1 -0
- data/lib/mihari/web/public/assets/index-Dgz0wXc1.js +1764 -0
- data/lib/mihari/web/public/index.html +2 -2
- data/lib/mihari/web/public/redoc-static.html +389 -389
- data/lib/mihari.rb +1 -0
- data/mihari.gemspec +42 -40
- data/mkdocs.yml +1 -1
- data/requirements.txt +2 -2
- metadata +112 -82
- data/lib/mihari/web/public/assets/index-CNoViC5p.css +0 -1
- data/lib/mihari/web/public/assets/index-ruBsf_QV.js +0 -1783
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5fff977863ca54dae5b645e3587d8f09f0583df44fca258ac4f1c8f3455a74e
|
4
|
+
data.tar.gz: 3c45cf5405737aaddbd79b42590509f155b3be13c3a0645057cc446666728655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d189d79161738b06e2ee970b835b953bd968c4c4500b7cf589fcf3c2ac31a49f46a9d2fcf3581818484f9daf0b72a87a1d3cd39084d39e4a9bcfdf4ab0edc1a4
|
7
|
+
data.tar.gz: 463d12e871297b9d5be403139720fc51d09bd51e0c41855d47cbe889de086f2a5a2d2fe25fa592f81ddec1b6e56195b9878372c1fc8955f23357b72d09bbdce0
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 3.2
|
3
|
+
NewCops: enable
|
3
4
|
Metrics/BlockLength:
|
4
5
|
Max: 150
|
5
6
|
Exclude:
|
@@ -12,13 +13,32 @@ Metrics/MethodLength:
|
|
12
13
|
Metrics/AbcSize:
|
13
14
|
Max: 50
|
14
15
|
RSpec/MultipleMemoizedHelpers:
|
15
|
-
Max:
|
16
|
+
Max: 15
|
16
17
|
RSpec/ExampleLength:
|
17
18
|
Max: 20
|
18
|
-
RSpec/
|
19
|
-
|
19
|
+
RSpec/NestedGroups:
|
20
|
+
Max: 5
|
21
|
+
RSpec/RepeatedExampleGroupDescription:
|
22
|
+
Enabled: false
|
23
|
+
RSpec/ReceiveMessages:
|
24
|
+
Enabled: false
|
25
|
+
RSpec/MultipleExpectations:
|
26
|
+
Enabled: false
|
27
|
+
RSpec/SpecFilePathFormat:
|
28
|
+
Enabled: false
|
29
|
+
FactoryBot/SyntaxMethods:
|
30
|
+
Enabled: false
|
20
31
|
require:
|
32
|
+
- rubocop-capybara
|
21
33
|
- rubocop-factory_bot
|
34
|
+
- rubocop-performance
|
22
35
|
- rubocop-rake
|
23
36
|
- rubocop-rspec
|
24
37
|
- rubocop-yard
|
38
|
+
- standard
|
39
|
+
- standard-custom
|
40
|
+
- standard-performance
|
41
|
+
inherit_gem:
|
42
|
+
standard: config/base.yml
|
43
|
+
standard-custom: config/base.yml
|
44
|
+
standard-performance: config/base.yml
|
data/README.md
CHANGED
@@ -27,6 +27,7 @@ Mihari supports the following services by default.
|
|
27
27
|
- [SecurityTrails](https://securitytrails.com/)
|
28
28
|
- [Shodan](https://shodan.io)
|
29
29
|
- [urlscan.io](https://urlscan.io)
|
30
|
+
- [Validin](https://validin.com)
|
30
31
|
- [VirusTotal](http://virustotal.com) & [VirusTotal Intelligence](https://www.virustotal.com/gui/intelligence-overview)
|
31
32
|
- [ZoomEye](https://zoomeye.org)
|
32
33
|
|
data/Rakefile
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
require "time"
|
4
4
|
|
5
5
|
require "rspec/core/rake_task"
|
6
|
-
require "
|
6
|
+
require "rubocop/rake_task"
|
7
7
|
|
8
|
+
RuboCop::RakeTask.new
|
8
9
|
RSpec::Core::RakeTask.new(:spec)
|
9
10
|
|
10
11
|
task default: :spec
|
@@ -67,6 +68,7 @@ namespace :build do
|
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
71
|
+
desc "Build including Swagger doc and frontend assets"
|
70
72
|
task :build do
|
71
73
|
Rake::Task["build:swagger"].invoke
|
72
74
|
Rake::Task["build:frontend"].invoke
|
data/lefthook.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
pre-commit:
|
2
2
|
commands:
|
3
|
-
|
3
|
+
rubocop:
|
4
4
|
glob: "*.rb"
|
5
|
-
run: bundle exec
|
5
|
+
run: bundle exec rubocop --fix {staged_files}
|
6
6
|
stage_fixed: true
|
7
7
|
eslint:
|
8
8
|
root: "frontend/"
|
@@ -19,5 +19,5 @@ pre-commit:
|
|
19
19
|
glob: "*.{js,ts,vue}"
|
20
20
|
run: npm run type-check
|
21
21
|
actionlint:
|
22
|
-
glob: ".github/workflows/*.yaml"
|
23
|
-
run: actionlint
|
22
|
+
glob: ".github/workflows/*.{yaml,yml}"
|
23
|
+
run: actionlint {staged_files}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "mihari/clients/validin"
|
4
|
+
|
5
|
+
module Mihari
|
6
|
+
module Analyzers
|
7
|
+
#
|
8
|
+
# Validin analyzer
|
9
|
+
#
|
10
|
+
class Validin < Base
|
11
|
+
include Concerns::Refangable
|
12
|
+
|
13
|
+
# @return [String, nil]
|
14
|
+
attr_reader :type
|
15
|
+
|
16
|
+
# @return [String, nil]
|
17
|
+
attr_reader :username
|
18
|
+
|
19
|
+
# @return [String, nil]
|
20
|
+
attr_reader :api_key
|
21
|
+
|
22
|
+
#
|
23
|
+
# @param [String] query
|
24
|
+
# @param [Hash, nil] options
|
25
|
+
# @param [String, nil] api_key
|
26
|
+
#
|
27
|
+
def initialize(query, options: nil, api_key: nil)
|
28
|
+
super(refang(query), options:)
|
29
|
+
|
30
|
+
@type = DataType.type(query)
|
31
|
+
|
32
|
+
@api_key = api_key || Mihari.config.validin_api_key
|
33
|
+
end
|
34
|
+
|
35
|
+
def artifacts
|
36
|
+
case type
|
37
|
+
when "domain"
|
38
|
+
dns_history_search
|
39
|
+
when "ip"
|
40
|
+
reverse_ip_search
|
41
|
+
else
|
42
|
+
raise ValueError, "#{query}(type: #{type || "unknown"}) is not supported." unless valid_type?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def dns_history_search
|
49
|
+
res = client.dns_history_search(query)
|
50
|
+
(res.dig("records", "A") || []).filter_map do |r|
|
51
|
+
r["value"]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def reverse_ip_search
|
56
|
+
res = client.dns_history_search(query)
|
57
|
+
(res.dig("records", "A") || []).filter_map do |r|
|
58
|
+
r["value"]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def client
|
63
|
+
Clients::Validin.new(api_key:, timeout:)
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Check whether a type is valid or not
|
68
|
+
#
|
69
|
+
# @return [Boolean]
|
70
|
+
#
|
71
|
+
def valid_type?
|
72
|
+
%w[ip domain].include? type
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/mihari/clients/crtsh.rb
CHANGED
data/lib/mihari/clients/mmdb.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mihari
|
4
|
+
module Clients
|
5
|
+
#
|
6
|
+
# Validin API client
|
7
|
+
#
|
8
|
+
class Validin < Base
|
9
|
+
#
|
10
|
+
# @param [String] base_url
|
11
|
+
# @param [String, nil] api_key
|
12
|
+
# @param [Hash] headers
|
13
|
+
# @param [Integer, nil] timeout
|
14
|
+
#
|
15
|
+
def initialize(
|
16
|
+
base_url = "https://app.validin.com",
|
17
|
+
api_key:,
|
18
|
+
headers: {},
|
19
|
+
timeout: nil
|
20
|
+
)
|
21
|
+
raise(ArgumentError, "api_key is required") if api_key.nil?
|
22
|
+
|
23
|
+
headers["Authorization"] = "Bearer #{api_key}"
|
24
|
+
|
25
|
+
super(base_url, headers:, timeout:)
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# @param [String] domain
|
30
|
+
#
|
31
|
+
# @return [Hash]
|
32
|
+
#
|
33
|
+
def dns_history_search(domain)
|
34
|
+
get_json "/api/axon/domain/dns/history/#{domain}/A"
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# @param [String] ip
|
39
|
+
#
|
40
|
+
# @return [Hash]
|
41
|
+
#
|
42
|
+
def search_reverse_ip(ip)
|
43
|
+
get_json "/api/axon/ip/dns/history/#{ip}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/mihari/config.rb
CHANGED
@@ -33,6 +33,7 @@ module Mihari
|
|
33
33
|
thehive_api_key: nil,
|
34
34
|
thehive_url: nil,
|
35
35
|
urlscan_api_key: nil,
|
36
|
+
validin_api_key: nil,
|
36
37
|
virustotal_api_key: nil,
|
37
38
|
yeti_api_key: nil,
|
38
39
|
yeti_url: nil,
|
@@ -122,6 +123,9 @@ module Mihari
|
|
122
123
|
# @!attribute [r] urlscan_api_key
|
123
124
|
# @return [String, nil]
|
124
125
|
|
126
|
+
# @!attribute [r] validin_api_key
|
127
|
+
# @return [String, nil]
|
128
|
+
|
125
129
|
# @!attribute [r] virustotal_api_key
|
126
130
|
# @return [String, nil]
|
127
131
|
|
data/lib/mihari/version.rb
CHANGED