miteru 0.12.3 → 0.12.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92dd51ba5b114cdc84e97aa356c235c9f534332cc1d17c0fd7ebdffc9f9d1d02
4
- data.tar.gz: 226ae4c89212677e7cc4a99e86ce978f7ee1b1f1c050732aa89ae307a8c3533b
3
+ metadata.gz: e9e6b96b39d329d3003d0cec2d06f99814f7f9fb518cb80f8c465999a548e88f
4
+ data.tar.gz: 5fb646c603f612f09de5c9da2cce8a0c3b379af7d9e3a31994ea2403da37e35a
5
5
  SHA512:
6
- metadata.gz: c04bc650fdd9adaedafd9a0cd99374966ec94c8bbb1f2e61c0cb175f5836fdeea7f78218480dbef26bcbd73c703695c808d4b4f6e2bf5bd61ba841c86480c8f1
7
- data.tar.gz: 2b774f64092138fbe2119b2439a23a3710ae461b628da07b7a59b35c11f67bd9ef6bb035d5c85486e63fb02154c44a84d7557f3eaff26b986f4595edcf25b76f
6
+ metadata.gz: 173f0e24dba5aee1e5cfb126bc70d2e7ae0e7ebf13c59a55f60a023ce9705e84e86f645770c27f5026a48029124355ffa54e68f0b0dfc1675b397f7e6c9544ca
7
+ data.tar.gz: c8c46730a108355c70696b2034cfd4bbf0a71c144e295c774cc214abb01600e97ecfb6747114bcec904a0852eb5db56fbe7b35aa45d4244f2763e4dff0cf0223
@@ -9,33 +9,65 @@ module Miteru
9
9
  @url = url
10
10
  end
11
11
 
12
- def to_h
12
+ def to_a
13
+ [
14
+ {
15
+ text: defanged_url,
16
+ fallback: "VT & urlscan.io links",
17
+ actions: actions
18
+ }
19
+ ]
20
+ end
21
+
22
+ private
23
+
24
+ def actions
25
+ [vt_link, urlscan_link].compact
26
+ end
27
+
28
+ def vt_link
29
+ return nil unless _vt_link
30
+
13
31
  {
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"
32
+ type: "button",
33
+ text: "Lookup on VirusTotal",
34
+ url: _vt_link,
19
35
  }
20
36
  end
21
37
 
22
- private
38
+ def urlscan_link
39
+ return nil unless _urlscan_link
23
40
 
24
- def title_link
25
- domain ? "https://urlscan.io/domain/#{domain}" : "https://urlscan.io"
41
+ {
42
+ type: "button",
43
+ text: "Lookup on urlscan.io",
44
+ url: _urlscan_link,
45
+ }
26
46
  end
27
47
 
28
- def title
29
- domain || "N/A"
48
+ def defanged_url
49
+ @defanged_url ||= url.to_s.gsub /\./, "[.]"
30
50
  end
31
51
 
32
52
  def domain
33
53
  @domain ||=
34
54
  [].tap do |out|
35
55
  out << URI(url).hostname
36
- rescue URI::Error => _
56
+ rescue URI::Error => _e
37
57
  out << nil
38
58
  end.first
39
59
  end
60
+
61
+ def _urlscan_link
62
+ return nil unless domain
63
+
64
+ "https://urlscan.io/domain/#{domain}"
65
+ end
66
+
67
+ def _vt_link
68
+ return nil unless domain
69
+
70
+ "https://www.virustotal.com/#/domain/#{domain}"
71
+ end
40
72
  end
41
73
  end
@@ -29,7 +29,7 @@ module Miteru
29
29
  def breakdown(url)
30
30
  begin
31
31
  uri = URI.parse(url)
32
- rescue URI::InvalidURIError => _
32
+ rescue URI::InvalidURIError => _e
33
33
  return []
34
34
  end
35
35
 
@@ -16,6 +16,8 @@ module Miteru
16
16
  end
17
17
 
18
18
  def extname
19
+ return ".tar.gz" if link.end_with?("tar.gz")
20
+
19
21
  File.extname(link)
20
22
  end
21
23
 
@@ -15,11 +15,8 @@ module Miteru
15
15
  if post_to_slack? && !kits.empty?
16
16
  slack = Slack::Incoming::Webhooks.new(slack_webhook_url, channel: slack_channel)
17
17
  slack.post(
18
- url,
19
- attachments: [
20
- { text: message },
21
- attachement.to_h
22
- ]
18
+ message,
19
+ attachments: attachement.to_a
23
20
  )
24
21
  end
25
22
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miteru
4
- VERSION = "0.12.3"
4
+ VERSION = "0.12.4"
5
5
  end
@@ -43,7 +43,7 @@ module Miteru
43
43
 
44
44
  kit_names = kits.map(&:basename).join(", ")
45
45
  noun = kits.length == 1 ? "kit" : "kits"
46
- "It might contain phishing #{noun}: (#{kit_names})."
46
+ "It might contain phishing #{noun}: #{kit_names}."
47
47
  end
48
48
 
49
49
  private
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.3
4
+ version: 0.12.4
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-05-05 00:00:00.000000000 Z
11
+ date: 2019-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler