miteru 0.6.1 → 0.7.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: cc8a49cc98035612ecb5f3a085b885175ca8c69d426f6a9b059a4db7b79ab9fa
4
- data.tar.gz: 268d4db3a53946e56fdaa796a6664928fe49ef8a80c9337bd7cdc0221fb0c684
3
+ metadata.gz: aab5b29928c45f80d099e6c12dee3606fd3002696814c3ea1d937221a28dc2d0
4
+ data.tar.gz: eba0390423b107ac8d1df75bc39f47db8b182070aeadee56396cc24f174d6e70
5
5
  SHA512:
6
- metadata.gz: c9a7685eb8b46fb553472a10d3fa4efe8252be5aef403f69ad7e92d37225352df528070039763f53389182405f5e19df72a24ffb17e63bf336c3af9d378e244c
7
- data.tar.gz: e7e4959a8d6db5ca19b8fa670117b3e1206d8ebbe0ec185c5c18db0be74175a07f0dfb9207b8c631d43f67037099b5e12151ba2f91df9a35ef8dfbdc110342e6
6
+ metadata.gz: 00f9affdcae054c0570965f60afbfcf3c25fcdf57ad4a26b7d9411a54d917593b37bc861f3f3ef1d467817c00e18c88648b52cd15bd0fac087213adb722a3cb4
7
+ data.tar.gz: 49a9618ee2aa8f7914cc8341b04f8803c965ce5e2cb3f53469f27568e73ca2ccdc9a26a3b70a7bc576c2fe95049f7837bccdc74352eb6d4529e57fe7e2da70da
data/README.md CHANGED
@@ -33,16 +33,17 @@ Usage:
33
33
  miteru execute
34
34
 
35
35
  Options:
36
- [--auto-download], [--no-auto-download] # Enable or disable auto-download of *.zip file(s)
37
- [--download-to=DOWNLOAD_TO] # Directory to download file(s)
38
- # Default: /tmp
39
- [--post-to-slack], [--no-post-to-slack] # Post a message to Slack if it detects a phishing kit
40
- [--size=N] # Number of urlscan.io's results. (Max: 100,000)
41
- # Default: 100
42
- [--threads=N] # Number of threads to use
43
- # Default: 10
36
+ [--auto-download], [--no-auto-download] # Enable or disable auto-download of *.zip file(s)
37
+ [--directory-traveling], [--no-directory-traveling] # Enable or disable directory traveling
38
+ [--download-to=DOWNLOAD_TO] # Directory to download file(s)
39
+ # Default: /tmp
40
+ [--post-to-slack], [--no-post-to-slack] # Post a message to Slack if it detects a phishing kit
41
+ [--size=N] # Number of urlscan.io's results. (Max: 100,000)
42
+ # Default: 100
43
+ [--threads=N] # Number of threads to use
44
+ # Default: 10
44
45
  [--verbose], [--no-verbose]
45
- # Default: true
46
+ # Default: true
46
47
 
47
48
  Execute the crawler
48
49
  ```
@@ -9,6 +9,7 @@ require "thor"
9
9
  module Miteru
10
10
  class CLI < Thor
11
11
  method_option :auto_download, type: :boolean, default: false, desc: "Enable or disable auto-download of *.zip file(s)"
12
+ method_option :directory_traveling, type: :boolean, default: false, desc: "Enable or disable directory traveling"
12
13
  method_option :download_to, type: :string, default: "/tmp", desc: "Directory to download file(s)"
13
14
  method_option :post_to_slack, type: :boolean, default: false, desc: "Post a message to Slack if it detects a phishing kit"
14
15
  method_option :size, type: :numeric, default: 100, desc: "Number of urlscan.io's results. (Max: 100,000)"
@@ -16,7 +17,12 @@ module Miteru
16
17
  method_option :verbose, type: :boolean, default: true
17
18
  desc "execute", "Execute the crawler"
18
19
  def execute
19
- websites = Crawler.execute(size: options[:size], threads: options[:threads], verbose: options[:verbose])
20
+ websites = Crawler.execute(
21
+ directory_traveling: options[:directory_traveling],
22
+ size: options[:size],
23
+ threads: options[:threads],
24
+ verbose: options[:verbose]
25
+ )
20
26
  websites.each do |website|
21
27
  next unless website.has_kit?
22
28
 
@@ -7,14 +7,16 @@ require "uri"
7
7
 
8
8
  module Miteru
9
9
  class Crawler
10
- attr_reader :threads
10
+ attr_reader :directory_traveling
11
11
  attr_reader :size
12
+ attr_reader :threads
12
13
  attr_reader :verbose
13
14
 
14
15
  URLSCAN_ENDPOINT = "https://urlscan.io/api/v1"
15
16
  OPENPHISH_ENDPOINT = "https://openphish.com"
16
17
 
17
- def initialize(size: 100, threads: 10, verbose: false)
18
+ def initialize(directory_traveling: false, size: 100, threads: 10, verbose: false)
19
+ @directory_traveling = directory_traveling
18
20
  @size = size
19
21
  @threads = threads
20
22
  @verbose = verbose
@@ -39,14 +41,16 @@ module Miteru
39
41
  return []
40
42
  end
41
43
  base = "#{uri.scheme}://#{uri.hostname}"
42
- [base]
43
- # TODO: Should add a option for burute force directory
44
- # segments = uri.path.split("/")
45
- # if segments.length.zero?
46
- # [base]
47
- # else
48
- # (0...segments.length).map { |idx| "#{base}#{segments[0..idx].join('/')}" }
49
- # end
44
+ return [base] unless directory_traveling
45
+
46
+ segments = uri.path.split("/")
47
+ return [base] if segments.length.zero?
48
+
49
+ urls = (0...segments.length).map { |idx| "#{base}#{segments[0..idx].join('/')}" }
50
+ urls.reject do |breakdowned_url|
51
+ # Reject a url which ends with specific extension names
52
+ %w(.htm .html .php .asp .aspx).any? { |ext| breakdowned_url.end_with? ext }
53
+ end
50
54
  end
51
55
 
52
56
  def suspicious_urls
@@ -73,8 +77,8 @@ module Miteru
73
77
  websites
74
78
  end
75
79
 
76
- def self.execute(size: 100, threads: 10, verbose: false)
77
- new(size: size, threads: threads, verbose: verbose).execute
80
+ def self.execute(directory_traveling: false, size: 100, threads: 10, verbose: false)
81
+ new(directory_traveling: directory_traveling, size: size, threads: threads, verbose: verbose).execute
78
82
  end
79
83
 
80
84
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miteru
4
- VERSION = "0.6.1"
4
+ VERSION = "0.7.0"
5
5
  end
@@ -36,7 +36,7 @@ module Miteru
36
36
  end
37
37
 
38
38
  def has_kit?
39
- ok? && index? && zip_files?
39
+ @has_kit ||= ok? && index? && zip_files?
40
40
  end
41
41
 
42
42
  def build
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.6.1
4
+ version: 0.7.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: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2018-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler