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 +4 -4
- data/lib/miteru/cli.rb +1 -1
- data/lib/miteru/crawler.rb +4 -5
- data/lib/miteru/version.rb +1 -1
- data/lib/miteru/website.rb +6 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92dd51ba5b114cdc84e97aa356c235c9f534332cc1d17c0fd7ebdffc9f9d1d02
|
4
|
+
data.tar.gz: 226ae4c89212677e7cc4a99e86ce978f7ee1b1f1c050732aa89ae307a8c3533b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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
|
data/lib/miteru/crawler.rb
CHANGED
@@ -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:
|
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:
|
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,
|
data/lib/miteru/version.rb
CHANGED
data/lib/miteru/website.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
11
|
+
date: 2019-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|