miteru 0.12.2 → 0.12.3

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: d0345bd419d2af64ac26074a1a586ed961a6dce64bcb0043ee142cac6cfe99f7
4
- data.tar.gz: 53a828e7e50fcd83b5005eed831b29e1282f743729f2f57319dad21f51a53e59
3
+ metadata.gz: 92dd51ba5b114cdc84e97aa356c235c9f534332cc1d17c0fd7ebdffc9f9d1d02
4
+ data.tar.gz: 226ae4c89212677e7cc4a99e86ce978f7ee1b1f1c050732aa89ae307a8c3533b
5
5
  SHA512:
6
- metadata.gz: 4c43b49597aa13659906b5eb10cc151bfb04ae89e64fa62cd18e682e978f6330bd256cac3e2c168ca6d8c8b43f2b5194d2ea16e123875e3b607c603cb1a15146
7
- data.tar.gz: 31099a1446e773873327f1e9d51141f24386a6f0ea25d4502fd707c050a166c8406ca1528bca7cfb7b16670289c5dda689dec8764c5d83191b970118819dd843
6
+ metadata.gz: c04bc650fdd9adaedafd9a0cd99374966ec94c8bbb1f2e61c0cb175f5836fdeea7f78218480dbef26bcbd73c703695c808d4b4f6e2bf5bd61ba841c86480c8f1
7
+ data.tar.gz: 2b774f64092138fbe2119b2439a23a3710ae461b628da07b7a59b35c11f67bd9ef6bb035d5c85486e63fb02154c44a84d7557f3eaff26b986f4595edcf25b76f
data/lib/miteru/cli.rb CHANGED
@@ -9,7 +9,7 @@ module Miteru
9
9
  method_option :download_to, type: :string, default: "/tmp", desc: "Directory to download file(s)"
10
10
  method_option :post_to_slack, type: :boolean, default: false, desc: "Post a message to Slack if it detects a phishing kit"
11
11
  method_option :size, type: :numeric, default: 100, desc: "Number of urlscan.io's results. (Max: 10,000)"
12
- method_option :threads, type: :numeric, default: 10, desc: "Number of threads to use"
12
+ method_option :threads, type: :numeric, desc: "Number of threads to use"
13
13
  method_option :verbose, type: :boolean, default: true
14
14
  desc "execute", "Execute the crawler"
15
15
  def execute
@@ -6,7 +6,6 @@ require "uri"
6
6
 
7
7
  module Miteru
8
8
  class Crawler
9
- attr_reader :auto_download
10
9
  attr_reader :directory_traveling
11
10
  attr_reader :downloader
12
11
  attr_reader :feeds
@@ -14,7 +13,7 @@ module Miteru
14
13
  attr_reader :threads
15
14
  attr_reader :verbose
16
15
 
17
- def initialize(auto_download: false, directory_traveling: false, download_to: "/tmp", post_to_slack: false, size: 100, threads: 10, verbose: false)
16
+ def initialize(auto_download: false, directory_traveling: false, download_to: "/tmp", post_to_slack: false, size: 100, threads: Parallel.processor_count, verbose: false)
18
17
  @auto_download = auto_download
19
18
  @directory_traveling = directory_traveling
20
19
  @downloader = Downloader.new(download_to)
@@ -27,18 +26,18 @@ module Miteru
27
26
  end
28
27
 
29
28
  def execute
30
- puts "Loaded #{feeds.suspicious_urls.length} URLs to crawl." if verbose
29
+ puts "Loaded #{feeds.suspicious_urls.length} URLs to crawl. (crawling in #{threads} threads)" if verbose
31
30
 
32
31
  Parallel.each(feeds.suspicious_urls, in_threads: threads) do |url|
33
32
  website = Website.new(url)
34
33
  downloader.download_kits(website.kits) if website.has_kits? && auto_download?
35
34
  notify(website) if verbose || website.has_kits?
36
- rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError => _
35
+ rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError => _e
37
36
  next
38
37
  end
39
38
  end
40
39
 
41
- def self.execute(auto_download: false, directory_traveling: false, download_to: "/tmp", post_to_slack: false, size: 100, threads: 10, verbose: false)
40
+ def self.execute(auto_download: false, directory_traveling: false, download_to: "/tmp", post_to_slack: false, size: 100, threads: Parallel.processor_count, verbose: false)
42
41
  new(
43
42
  auto_download: auto_download,
44
43
  directory_traveling: directory_traveling,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miteru
4
- VERSION = "0.12.2"
4
+ VERSION = "0.12.3"
5
5
  end
@@ -34,13 +34,16 @@ module Miteru
34
34
 
35
35
  def has_kits?
36
36
  ok? && index? && kits?
37
- rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError => _
37
+ rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError => _e
38
38
  false
39
39
  end
40
40
 
41
41
  def message
42
+ return "It doesn't contain a phishing kit." unless kits?
43
+
42
44
  kit_names = kits.map(&:basename).join(", ")
43
- kits? ? "it might contain phishing kit(s): (#{kit_names})." : "it doesn't contain a phishing kit."
45
+ noun = kits.length == 1 ? "kit" : "kits"
46
+ "It might contain phishing #{noun}: (#{kit_names})."
44
47
  end
45
48
 
46
49
  private
@@ -59,7 +62,7 @@ module Miteru
59
62
 
60
63
  def parse_html(html)
61
64
  Oga.parse_html(html)
62
- rescue ArgumentError, LL::ParserError => _
65
+ rescue ArgumentError, Encoding::CompatibilityError, LL::ParserError => _e
63
66
  nil
64
67
  end
65
68
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miteru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-03 00:00:00.000000000 Z
11
+ date: 2019-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler