mihari 1.3.0 → 1.3.1

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: 6d6b5d42dc4fbe937cc101f7dbdfa1491104f2b6f70fdf690b2ad51db02304c5
4
- data.tar.gz: 32b5df5f6970d6aaf6f9d5c57ca9bc86d8e43f0298f22c6c9e811cf60a6d1089
3
+ metadata.gz: 6ece49c7c528579aec4fec009765915a2afe72df87eca5c39ccb59a416a200c4
4
+ data.tar.gz: d4c595a7c38fb8e8b8350e38f90f572d8a74eef836817fea4ba21bb6893c3af3
5
5
  SHA512:
6
- metadata.gz: 16cdfd458c0d464eb618fc5aae8386c1cb37fd554fd6aba275323cb539a08916f3cd855e4e5683085e03f206debe879af6f2e3c7a42b1cd0b2a6395d86e3f55a
7
- data.tar.gz: 93f9e9e2165e79ef6602d1628b5689e0993ae4d88605db4f6aa4ff79dc6a21d25437997a1402f76ce3a5e2e9155ad68a441a8cc8351b54c5f4d1c3a72eb82df4
6
+ metadata.gz: 6ea5989d78febe490473a21c2c1958e96ea2f920eee5eee90c4521ca774c5fbd35b10efb41270adb1f5344189461afc010a2b38aec2aeae86d901e5dd7aea9d1
7
+ data.tar.gz: 3c18daec3b396ac0ec96cdb22cf444c8a12f1031189b68c90961bd24ccc8143e0682294b067ca21dd59115712f7d811aaf0352c6d27bf319dcce6e988b3362a9
data/README.md CHANGED
@@ -226,6 +226,7 @@ Configuration can be done via environment variables or a YAML file.
226
226
  | SPYSE_API_KEY | Spyse API key | |
227
227
  | THEHIVE_API_ENDPOINT | TheHive URL | |
228
228
  | THEHIVE_API_KEY | TheHive API key | |
229
+ | URLSCAN_API_KEY | urlscan.io API key | |
229
230
  | VIRUSTOTAL_API_KEY | VirusTotal API key | |
230
231
  | ZOOMEYE_PASSWORD | ZoomEye password | |
231
232
  | ZOOMEYE_USERNAMME | ZoomEye username | |
@@ -37,6 +37,10 @@ module Mihari
37
37
 
38
38
  def search_with_page(query, page: 1)
39
39
  api.host.search(query, page: page)
40
+ rescue ::BinaryEdge::Error => e
41
+ raise RetryableError, e if e.message.include?("Request time limit exceeded")
42
+
43
+ raise e
40
44
  end
41
45
 
42
46
  def search
@@ -45,6 +45,10 @@ module Mihari
45
45
 
46
46
  def search_with_page(query, page: 1)
47
47
  api.host.search(query, page: page)
48
+ rescue ::Shodan::Error => e
49
+ raise RetryableError, e if e.message.include?("request timed out")
50
+
51
+ raise e
48
52
  end
49
53
 
50
54
  def search
@@ -35,8 +35,12 @@ module Mihari
35
35
 
36
36
  private
37
37
 
38
+ def config_keys
39
+ %w(urlscan_api_key)
40
+ end
41
+
38
42
  def api
39
- @api ||= ::UrlScan::API.new
43
+ @api ||= ::UrlScan::API.new(Mihari.config.urlscan_api_key)
40
44
  end
41
45
 
42
46
  def search
@@ -23,6 +23,7 @@ module Mihari
23
23
  attr_accessor :spyse_api_key
24
24
  attr_accessor :thehive_api_endpoint
25
25
  attr_accessor :thehive_api_key
26
+ attr_accessor :urlscan_api_key
26
27
  attr_accessor :virustotal_api_key
27
28
  attr_accessor :zoomeye_password
28
29
  attr_accessor :zoomeye_username
@@ -53,6 +54,7 @@ module Mihari
53
54
  @spyse_api_key = ENV["SPYSE_API_KEY"]
54
55
  @thehive_api_endpoint = ENV["THEHIVE_API_ENDPOINT"]
55
56
  @thehive_api_key = ENV["THEHIVE_API_KEY"]
57
+ @urlscan_api_key = ENV["URLSCAN_API_KEY"]
56
58
  @virustotal_api_key = ENV["VIRUSTOTAL_API_KEY"]
57
59
  @zoomeye_password = ENV["ZOOMEYE_PASSWORD"]
58
60
  @zoomeye_username = ENV["ZOOMEYE_USERNAME"]
@@ -3,4 +3,5 @@
3
3
  module Mihari
4
4
  class Error < StandardError; end
5
5
  class InvalidInputError < Error; end
6
+ class RetryableError < Error; end
6
7
  end
@@ -7,7 +7,7 @@ module Mihari
7
7
  begin
8
8
  try += 1
9
9
  yield
10
- rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError, Timeout::Error, ::Shodan::Error => e
10
+ rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError, Timeout::Error, RetryableError => e
11
11
  sleep interval
12
12
  retry if try < times
13
13
  raise e
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mihari
4
- VERSION = "1.3.0"
4
+ VERSION = "1.3.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mihari
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-16 00:00:00.000000000 Z
11
+ date: 2020-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler