miteru 2.0.3 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/README.md +4 -4
- data/lib/miteru/config.rb +5 -1
- data/lib/miteru/crawler.rb +6 -1
- data/lib/miteru/feeds/urlscan.rb +9 -1
- data/lib/miteru/feeds/urlscan_pro.rb +1 -1
- data/lib/miteru/notifiers/slack.rb +8 -8
- data/lib/miteru/notifiers/urlscan.rb +7 -3
- data/lib/miteru/version.rb +1 -1
- data/lib/miteru/website.rb +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 509957b241020f76fcd9c85a6acbb9e80c0f8b3224fe5c1b4af41dcd2faa6ca5
|
4
|
+
data.tar.gz: 4e507a9974264a9b98d1ded16c09496a06ed4ca83409f75fc49719c37f934f77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dc8e2b4569555f5551a1b7fd2407162949cc7a459a5a7f83c5a787206b5cf39b34f16235466b6bcd74f34bac1878e1e4df6797daebe407eda2c03a9e7379e3a
|
7
|
+
data.tar.gz: 69d83a4c964ebbcd87b416675ed03bc18e270c0d604a19ef98b8988a0f344388eb49d0fb290edaa2f8637fa5f100608a3e9a76a1571503bda529611aea332bc0
|
data/.rubocop.yml
ADDED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Miteru
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/miteru)
|
4
|
-
[](https://github.com/ninoseki/miteru/actions/workflows/ruby.yml)
|
5
5
|
[](https://www.codefactor.io/repository/github/ninoseki/miteru)
|
6
6
|
[](https://coveralls.io/github/ninoseki/miteru?branch=master)
|
7
7
|
|
@@ -14,12 +14,12 @@ I take no responsibility and/or liability for how you choose to use this tool.
|
|
14
14
|
|
15
15
|
## How It Works
|
16
16
|
|
17
|
-
-
|
18
|
-
- urlscan.io's automatic submissions. (`task.method:automatic`)
|
17
|
+
- Collect phishy URLs from the following feeds:
|
18
|
+
- urlscan.io's automatic submissions. (`task.method:automatic AND NOT task.source:urlscan-observe`)
|
19
19
|
- urlscan.io phish feed. (available for Pro users)
|
20
20
|
- [mitchellkrogza/Phishing.Database](https://github.com/mitchellkrogza/Phishing.Database)'s `phishing-links-ACTIVE-NOW.txt`.
|
21
21
|
- [ninoseki/ayashige](https://github.com/ninoseki/ayashige) feed.
|
22
|
-
-
|
22
|
+
- Check each phishy URL whether it enables directory listing and contains phishing kits (compressed files) or not.
|
23
23
|
- Note: Supported compressed files are: `*.zip`, `*.rar`, `*.7z`, `*.tar` and `*.gz`.
|
24
24
|
|
25
25
|
## Docs
|
data/lib/miteru/config.rb
CHANGED
@@ -27,7 +27,8 @@ module Miteru
|
|
27
27
|
threads: Parallel.processor_count,
|
28
28
|
urlscan_api_key: nil,
|
29
29
|
urlscan_submit_visibility: "public",
|
30
|
-
urlscan_date_condition: "
|
30
|
+
urlscan_date_condition: "date:>now-1h",
|
31
|
+
urlscan_base_condition: "task.method:automatic AND NOT task.source:urlscan-observe",
|
31
32
|
verbose: false
|
32
33
|
)
|
33
34
|
|
@@ -91,6 +92,9 @@ module Miteru
|
|
91
92
|
# @!attribute [r] urlscan_date_condition
|
92
93
|
# @return [String]
|
93
94
|
|
95
|
+
# @!attribute [r] urlscan_base_condition
|
96
|
+
# @return [String]
|
97
|
+
|
94
98
|
def database_url=(val)
|
95
99
|
super(URI(val.to_s))
|
96
100
|
end
|
data/lib/miteru/crawler.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "colorize"
|
4
|
+
|
3
5
|
module Miteru
|
4
6
|
class Crawler < Service
|
5
7
|
#
|
@@ -7,7 +9,10 @@ module Miteru
|
|
7
9
|
#
|
8
10
|
def call(website)
|
9
11
|
Try[OpenSSL::SSL::SSLError, ::HTTP::Error, Addressable::URI::InvalidURIError] do
|
10
|
-
|
12
|
+
info = "Website:#{website.info}."
|
13
|
+
info = info.colorize(:red) if website.kits?
|
14
|
+
|
15
|
+
Miteru.logger.info(info)
|
11
16
|
return unless website.kits?
|
12
17
|
|
13
18
|
notify website
|
data/lib/miteru/feeds/urlscan.rb
CHANGED
@@ -31,7 +31,7 @@ module Miteru
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def q
|
34
|
-
"
|
34
|
+
"#{base_condition} AND #{date_condition}"
|
35
35
|
end
|
36
36
|
|
37
37
|
#
|
@@ -59,6 +59,14 @@ module Miteru
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
def base_condition
|
64
|
+
Miteru.config.urlscan_base_condition
|
65
|
+
end
|
66
|
+
|
67
|
+
def date_condition
|
68
|
+
Miteru.config.urlscan_date_condition
|
69
|
+
end
|
62
70
|
end
|
63
71
|
end
|
64
72
|
end
|
@@ -5,6 +5,7 @@ require "slack-notifier"
|
|
5
5
|
module Miteru
|
6
6
|
module Notifiers
|
7
7
|
class SlackAttachment
|
8
|
+
# @return [String]
|
8
9
|
attr_reader :url
|
9
10
|
|
10
11
|
def initialize(url)
|
@@ -14,7 +15,7 @@ module Miteru
|
|
14
15
|
def to_a
|
15
16
|
[
|
16
17
|
{
|
17
|
-
text
|
18
|
+
text:,
|
18
19
|
fallback: "VT & urlscan.io links",
|
19
20
|
actions:
|
20
21
|
}
|
@@ -47,10 +48,6 @@ module Miteru
|
|
47
48
|
}
|
48
49
|
end
|
49
50
|
|
50
|
-
def defanged_url
|
51
|
-
@defanged_url ||= url.to_s.gsub(".", "[.]")
|
52
|
-
end
|
53
|
-
|
54
51
|
def domain
|
55
52
|
@domain ||= [].tap do |out|
|
56
53
|
out << URI(url).hostname
|
@@ -59,6 +56,10 @@ module Miteru
|
|
59
56
|
end.first
|
60
57
|
end
|
61
58
|
|
59
|
+
def text
|
60
|
+
domain.to_s.gsub(".", "[.]")
|
61
|
+
end
|
62
|
+
|
62
63
|
def _urlscan_link
|
63
64
|
return nil unless domain
|
64
65
|
|
@@ -82,12 +83,11 @@ module Miteru
|
|
82
83
|
return unless callable?
|
83
84
|
|
84
85
|
attachment = SlackAttachment.new(website.url)
|
85
|
-
|
86
|
-
notifier.post(text: website.message.capitalize, attachments: attachment.to_a) if kits.any?
|
86
|
+
notifier.post(text: website.info, attachments: attachment.to_a) if website.kits?
|
87
87
|
end
|
88
88
|
|
89
89
|
def callable?
|
90
|
-
!
|
90
|
+
!webhook_url.nil?
|
91
91
|
end
|
92
92
|
|
93
93
|
private
|
@@ -9,7 +9,7 @@ module Miteru
|
|
9
9
|
def call(website)
|
10
10
|
return unless callable?
|
11
11
|
|
12
|
-
website.kits.each { |kit| submit(kit.url) }
|
12
|
+
website.kits.each { |kit| submit(kit.url, source: website.source) }
|
13
13
|
end
|
14
14
|
|
15
15
|
def callable?
|
@@ -41,8 +41,12 @@ module Miteru
|
|
41
41
|
Miteru.config.urlscan_submit_visibility
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
#
|
45
|
+
# @param [String] url
|
46
|
+
# @param [String] source
|
47
|
+
#
|
48
|
+
def submit(url, source:)
|
49
|
+
http.post("https://urlscan.io/api/v1/scan/", json: {tags: tags + ["source:#{source}"], visibility:, url:})
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
data/lib/miteru/version.rb
CHANGED
data/lib/miteru/website.rb
CHANGED
@@ -48,6 +48,14 @@ module Miteru
|
|
48
48
|
url.truncate(64)
|
49
49
|
end
|
50
50
|
|
51
|
+
def defanged_truncated_url
|
52
|
+
truncated_url.to_s.gsub(".", "[.]")
|
53
|
+
end
|
54
|
+
|
55
|
+
def info
|
56
|
+
"#{defanged_truncated_url} has #{kits.length} kit(s) (Source: #{source})"
|
57
|
+
end
|
58
|
+
|
51
59
|
private
|
52
60
|
|
53
61
|
def timeout
|
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: 2.
|
4
|
+
version: 2.1.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: 2024-02-
|
11
|
+
date: 2024-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -554,6 +554,7 @@ files:
|
|
554
554
|
- ".github/workflows/ruby.yml"
|
555
555
|
- ".gitignore"
|
556
556
|
- ".rspec"
|
557
|
+
- ".rubocop.yml"
|
557
558
|
- Gemfile
|
558
559
|
- LICENSE
|
559
560
|
- README.md
|