mihari 7.6.0 → 7.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.shadowenv.d/000_unset_all.lisp +1 -0
- data/lib/mihari/analyzers/validin.rb +76 -0
- data/lib/mihari/clients/validin.rb +47 -0
- data/lib/mihari/config.rb +4 -0
- data/lib/mihari/schemas/analyzer.rb +1 -0
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd0c07fe2661f57d6db5b409c527789c5e17d23e7691d5ac241ff5b36a20698
|
4
|
+
data.tar.gz: d7f2a832b3cb364aca8bdfad71cf762f72dc707892d2697ef8bb272bcb794b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39c5c92cf79721ed6d98b09a63a3d609eab8e8da9ba5badb1cd1a9f01fcb04d8f11edaa3b50fd7e0aed6dcb44f7befb77166e9bbf8399bac4d6592eafd943763
|
7
|
+
data.tar.gz: 7c06bd2ca9616605aa9601d198a413529f92205861dcafbfd86e84fa5bca6e2344d42ef558f27ee4c358f09778679fdaa2018954a6d34bfa534f2a3fa155042d
|
@@ -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
|
@@ -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
data/lib/mihari.rb
CHANGED
@@ -268,6 +268,7 @@ require "mihari/analyzers/pulsedive"
|
|
268
268
|
require "mihari/analyzers/securitytrails"
|
269
269
|
require "mihari/analyzers/shodan"
|
270
270
|
require "mihari/analyzers/urlscan"
|
271
|
+
require "mihari/analyzers/validin"
|
271
272
|
require "mihari/analyzers/virustotal_intelligence"
|
272
273
|
require "mihari/analyzers/virustotal"
|
273
274
|
require "mihari/analyzers/zoomeye"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mihari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.6.
|
4
|
+
version: 7.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manabu Niseki
|
@@ -1062,6 +1062,7 @@ files:
|
|
1062
1062
|
- lib/mihari/analyzers/securitytrails.rb
|
1063
1063
|
- lib/mihari/analyzers/shodan.rb
|
1064
1064
|
- lib/mihari/analyzers/urlscan.rb
|
1065
|
+
- lib/mihari/analyzers/validin.rb
|
1065
1066
|
- lib/mihari/analyzers/virustotal.rb
|
1066
1067
|
- lib/mihari/analyzers/virustotal_intelligence.rb
|
1067
1068
|
- lib/mihari/analyzers/zoomeye.rb
|
@@ -1094,6 +1095,7 @@ files:
|
|
1094
1095
|
- lib/mihari/clients/shodan_internet_db.rb
|
1095
1096
|
- lib/mihari/clients/the_hive.rb
|
1096
1097
|
- lib/mihari/clients/urlscan.rb
|
1098
|
+
- lib/mihari/clients/validin.rb
|
1097
1099
|
- lib/mihari/clients/virustotal.rb
|
1098
1100
|
- lib/mihari/clients/whois.rb
|
1099
1101
|
- lib/mihari/clients/yeti.rb
|