miteru 0.12.13 → 0.13.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: feb9c62c511e26e85a86755680ed77ddb34aca15c6d17d8c57dd2c60aa84becf
4
- data.tar.gz: d9e86a727e12e171b65accb829b07602847986ba81ea6457400ad8527b862324
3
+ metadata.gz: 16f41a7076d910face109e154bbc1a90b3d5a5e1e964be7236b8c798939dee7b
4
+ data.tar.gz: d16c59e0e78897c96d78a2e51f84903449c53355eb2436b4e700ba7eb4a07887
5
5
  SHA512:
6
- metadata.gz: 8402163c1decbcee1c352a2ca9004f52b8c0262c5adc18d10866abe190151c8bf56d1e7ed03018f33539d1f108a1ccfc265d289dcaeb167606a10217ec112d6a
7
- data.tar.gz: 6ecde10d8a4d1842995a2281e1b30663cb25c3fdd9edefa5c8f883c94f2da3b973372a84adfa70bd8537c126ab12b870b2bf6046f3021e329129428974fc96c0
6
+ metadata.gz: e83f7f493b2f1015ccfed05b8b1acde61fc093a3e75f29dcb6a1be8f20203f10ccbddbfd4f770277821821bf0ec31eab4e1bcf5587d77c435510a3b583302fc9
7
+ data.tar.gz: c9b68154de357f2563fc80ca0059e476e1c919cffa6b67ff4d1a2658d317b6ce7277c168717a26be2b020716da94c0b751dc1e9a6ebac085dc3e2729847c7b0e
@@ -3,6 +3,4 @@ language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
5
  - 2.6
6
- before_install:
7
- - gem update --system
8
- - gem install bundler
6
+ before_install: gem install bundler -v 2.1
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/miteru.svg)](https://badge.fury.io/rb/miteru)
4
4
  [![Build Status](https://travis-ci.com/ninoseki/miteru.svg?branch=master)](https://travis-ci.com/ninoseki/miteru)
5
- ![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/ninoseki/miteru)
5
+ [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/ninoseki/miteru)](https://hub.docker.com/repository/docker/ninoseki/miteru)
6
6
  [![CodeFactor](https://www.codefactor.io/repository/github/ninoseki/miteru/badge)](https://www.codefactor.io/repository/github/ninoseki/miteru)
7
7
  [![Coverage Status](https://coveralls.io/repos/github/ninoseki/miteru/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/miteru?branch=master)
8
8
 
@@ -15,6 +15,7 @@ Miteru is an experimental phishing kit detection tool.
15
15
  - [OpenPhish feed via urlscan.io](https://urlscan.io/search/#OpenPhish)
16
16
  - [PhishTank feed via urlscan.io](https://urlscan.io/search/#PhishTank)
17
17
  - [URLhaus feed via urlscan.io](https://urlscan.io/search/#URLHaus)
18
+ - urlscan.io phish feed (available for Pro users)
18
19
  - [Ayashige feed](https://github.com/ninoseki/ayashige)
19
20
  - It checks each phishy URL whether it enables directory listing and contains a phishing kit (compressed file) or not.
20
21
  - Note: compressed file = `*.zip`, `*.rar`, `*.7z`, `*.tar` and `*.gz`.
@@ -85,6 +86,10 @@ For using `--post-to-slack` feature, you should set the following environment va
85
86
  - `SLACK_WEBHOOK_URL`: Your Slack Webhook URL.
86
87
  - `SLACK_CHANNEL`: Slack channel to post a message (default: "#general").
87
88
 
89
+ If you are a urlscan.io Pro user, set your API key as an environment variable `URLSCAN_API_KEY`.
90
+
91
+ It enables you to subscribe the urlscan.io phish feed.
92
+
88
93
  ## Examples
89
94
 
90
95
  ### Aasciinema cast
@@ -3,6 +3,7 @@
3
3
  require_relative "./feeds/feed"
4
4
  require_relative "./feeds/ayashige"
5
5
  require_relative "./feeds/urlscan"
6
+ require_relative "./feeds/urlscan_pro"
6
7
 
7
8
  module Miteru
8
9
  class Feeds
@@ -11,6 +12,7 @@ module Miteru
11
12
  def initialize
12
13
  @feeds = [
13
14
  UrlScan.new(Miteru.configuration.size),
15
+ UrlScanPro.new,
14
16
  Miteru.configuration.ayashige? ? Ayashige.new : nil
15
17
  ].compact
16
18
  end
@@ -1,39 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "json"
4
- require "uri"
3
+ require "urlscan"
5
4
 
6
5
  module Miteru
7
6
  class Feeds
8
7
  class UrlScan < Feed
9
- HOST = "urlscan.io"
10
- VERSION = 1
11
- URL = "https://#{HOST}/api/v#{VERSION}"
12
-
13
8
  attr_reader :size
9
+
14
10
  def initialize(size = 100)
15
11
  @size = size
16
12
  raise ArgumentError, "size must be less than 10,000" if size > 10_000
17
13
  end
18
14
 
15
+ def api
16
+ @api ||= ::UrlScan::API.new
17
+ end
18
+
19
19
  def urls
20
- url = url_for("/search/")
21
- url.query = URI.encode_www_form(
22
- q: "task.method:automatic",
23
- size: size
24
- )
25
-
26
- res = JSON.parse(get(url))
27
- res["results"].map { |result| result.dig("task", "url") }
28
- rescue HTTPResponseError, HTTP::Error, JSON::ParserError => e
20
+ urls_from_community_feed
21
+ rescue ::UrlScan::ResponseError => e
29
22
  puts "Failed to load urlscan.io feed (#{e})"
30
23
  []
31
24
  end
32
25
 
33
26
  private
34
27
 
35
- def url_for(path)
36
- URI(URL + path)
28
+ def urls_from_community_feed
29
+ res = api.search("task.method:automatic", size: size)
30
+
31
+ results = res["results"] || []
32
+ results.map { |result| result.dig("task", "url") }
37
33
  end
38
34
  end
39
35
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "urlscan"
4
+
5
+ module Miteru
6
+ class Feeds
7
+ class UrlScanPro < Feed
8
+ def api
9
+ @api ||= ::UrlScan::API.new
10
+ end
11
+
12
+ def urls
13
+ urls_from_pro_feed
14
+ rescue ::UrlScan::ResponseError => e
15
+ puts "Failed to load urlscan.io pro feed (#{e})"
16
+ []
17
+ end
18
+
19
+ private
20
+
21
+ def api_key?
22
+ ENV.key? "URLSCAN_API_KEY"
23
+ end
24
+
25
+ def urls_from_pro_feed
26
+ return [] unless api_key?
27
+
28
+ res = api.pro.phishfeed
29
+ results = res["results"] || []
30
+ results.map { |result| result.dig("page_url") }
31
+ rescue ArgumentError => _e
32
+ []
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miteru
4
- VERSION = "0.12.13"
4
+ VERSION = "0.13.0"
5
5
  end
@@ -35,8 +35,9 @@ Gem::Specification.new do |spec|
35
35
  spec.add_dependency "colorize", "~> 0.8"
36
36
  spec.add_dependency "down", "~> 5.0"
37
37
  spec.add_dependency "http", "~> 4.2"
38
- spec.add_dependency "oga", "~> 2.15"
38
+ spec.add_dependency "oga", "~> 3.0"
39
39
  spec.add_dependency "parallel", "~> 1.19"
40
40
  spec.add_dependency "slack-notifier", "~> 2.3"
41
- spec.add_dependency "thor", "~> 0.20"
41
+ spec.add_dependency "thor", "~> 1.0"
42
+ spec.add_dependency "urlscan", "~> 0.5"
42
43
  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.12.13
4
+ version: 0.13.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-11-27 00:00:00.000000000 Z
11
+ date: 2019-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '2.15'
159
+ version: '3.0'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '2.15'
166
+ version: '3.0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: parallel
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -198,14 +198,28 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0.20'
201
+ version: '1.0'
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0.20'
208
+ version: '1.0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: urlscan
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '0.5'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '0.5'
209
223
  description: An experimental phishing kit detector
210
224
  email:
211
225
  - manabu.niseki@gmail.com
@@ -236,6 +250,7 @@ files:
236
250
  - lib/miteru/feeds/ayashige.rb
237
251
  - lib/miteru/feeds/feed.rb
238
252
  - lib/miteru/feeds/urlscan.rb
253
+ - lib/miteru/feeds/urlscan_pro.rb
239
254
  - lib/miteru/http_client.rb
240
255
  - lib/miteru/kit.rb
241
256
  - lib/miteru/notifier.rb