miteru 0.11.3 → 0.12.0

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: 1c0d220bd3b7a0ea6ca5b394e27f2bf86ad2f11f4c7ea524226c843f430d5c4e
4
- data.tar.gz: 9c295c3913fb784eb66a17341d14c89955befbb7daed8d443996f27205e1a4a2
3
+ metadata.gz: c8e78ff07e29bdfb439c4f5a1c9918fdd689c3ee9a6e076cd48fc08ce2c7f129
4
+ data.tar.gz: 8524c293c6b72bf6a7d980306fcb15df6053e923241b1403590bb065ee10eac2
5
5
  SHA512:
6
- metadata.gz: aa2a4d9344b6e46da84e052d09335fa20637da4bcca905bc40b23ae8422fb7d420ffff25bed3e103e4e672eba1eb6456e34eba303be883f6abeda2dcd5366c79
7
- data.tar.gz: e4dc6c7bbc95ba5a7185c44f9ecc7f8ded173278e756544a1c2c4232b31b3725a12a12b73b8b1e8e74e4842943334402aab36bb8a4b13b0d41a98393c5aee92a
6
+ metadata.gz: 541a1464c16e6b1182bbc042de1225e7ac1aa04d6b048fe39aaa647f7d59d0ba88feb462f242d244eebb9999f51f1fc2d2d3561081be0a02d512668523eeab40
7
+ data.tar.gz: 128d70f6b65351a3023d9f9adb34b1bc8ffbcd6bafc9375891d2b8f7817f1da22ee8f367ee0eaf3dff42e29c9b4d381cab118216d53e542da22377029a8dc48d
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "uri"
4
+
5
+ module Miteru
6
+ class Attachement
7
+ attr_reader :url
8
+ def initialize(url)
9
+ @url = url
10
+ end
11
+
12
+ def to_h
13
+ {
14
+ fallback: "urlscan.io link",
15
+ title: title,
16
+ title_link: title_link,
17
+ footer: "urlscan.io",
18
+ footer_icon: "http://www.google.com/s2/favicons?domain=urlscan.io"
19
+ }
20
+ end
21
+
22
+ private
23
+
24
+ def title_link
25
+ domain ? "https://urlscan.io/domain/#{domain}" : "https://urlscan.io"
26
+ end
27
+
28
+ def title
29
+ domain || "N/A"
30
+ end
31
+
32
+ def domain
33
+ @domain ||=
34
+ [].tap do |out|
35
+ out << URI(url).hostname
36
+ rescue URI::Error => _
37
+ out << nil
38
+ end.first
39
+ end
40
+ end
41
+ end
@@ -37,7 +37,7 @@ module Miteru
37
37
  else
38
38
  notify(website.url, website.compressed_files) if verbose
39
39
  end
40
- rescue OpenSSL::SSL::SSLError, HTTP::Error, LL::ParserError => _
40
+ rescue OpenSSL::SSL::SSLError, HTTP::Error, LL::ParserError, Addressable::URI::InvalidURIError => _
41
41
  next
42
42
  end
43
43
  end
@@ -11,10 +11,17 @@ module Miteru
11
11
 
12
12
  def notify(url, compressed_files)
13
13
  message = compressed_files.empty? ? "it doesn't contain a phishing kit." : "it might contain phishing kit(s): (#{compressed_files.join(', ')})."
14
+ attachement = Attachement.new(url)
14
15
 
15
16
  if post_to_slack? && !compressed_files.empty?
16
17
  slack = Slack::Incoming::Webhooks.new(slack_webhook_url, channel: slack_channel)
17
- slack.post url, attachments: [{ text: message }]
18
+ slack.post(
19
+ url,
20
+ attachments: [
21
+ { text: message },
22
+ attachement.to_h
23
+ ]
24
+ )
18
25
  end
19
26
 
20
27
  message = message.colorize(:light_red) unless compressed_files.empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miteru
4
- VERSION = "0.11.3"
4
+ VERSION = "0.12.0"
5
5
  end
data/lib/miteru.rb CHANGED
@@ -7,6 +7,7 @@ require "miteru/http_client"
7
7
  require "miteru/website"
8
8
  require "miteru/downloader"
9
9
  require "miteru/feeds"
10
+ require "miteru/attachement"
10
11
  require "miteru/notifier"
11
12
  require "miteru/crawler"
12
13
  require "miteru/cli"
data/miteru.gemspec CHANGED
@@ -33,10 +33,10 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "webmock", "~> 3.5"
34
34
 
35
35
  spec.add_dependency "colorize", "~> 0.8"
36
- spec.add_dependency "down", "~> 4.7"
37
- spec.add_dependency "http", "~> 4.0"
36
+ spec.add_dependency "down", "~> 4.8"
37
+ spec.add_dependency "http", "~> 4.1"
38
38
  spec.add_dependency "oga", "~> 2.15"
39
- spec.add_dependency "parallel", "~> 1.12"
39
+ spec.add_dependency "parallel", "~> 1.14"
40
40
  spec.add_dependency "slack-incoming-webhooks", "~> 0.2"
41
41
  spec.add_dependency "thor", "~> 0.19"
42
42
  end
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.11.3
4
+ version: 0.12.0
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-02-11 00:00:00.000000000 Z
11
+ date: 2019-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '4.7'
131
+ version: '4.8'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '4.7'
138
+ version: '4.8'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: http
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '4.0'
145
+ version: '4.1'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '4.0'
152
+ version: '4.1'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: oga
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '1.12'
173
+ version: '1.14'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '1.12'
180
+ version: '1.14'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: slack-incoming-webhooks
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -226,6 +226,7 @@ files:
226
226
  - docker/Dockerfile
227
227
  - exe/miteru
228
228
  - lib/miteru.rb
229
+ - lib/miteru/attachement.rb
229
230
  - lib/miteru/cli.rb
230
231
  - lib/miteru/crawler.rb
231
232
  - lib/miteru/downloader.rb