doorknock 0.1.2 → 0.2.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: d25dd268540ca72f5803f536e918ac372a49cd1ddc95b08022b29d5823a3c613
4
- data.tar.gz: '08943a51bf554653ce5dedb413527fb75aa35914abf215b47fb5820ef942dcc8'
3
+ metadata.gz: 5c3da2c18b5f42d55d2c5861b5daf5629226190557f35852bd43439e16ee7529
4
+ data.tar.gz: 9647fc9574a142ff05733f8f89036c64cd44aaea062b0c074391469c0d7b6af0
5
5
  SHA512:
6
- metadata.gz: f351a16a266ebf1bfe7cb0e4794f8826e3c85a86480686ce383470d4be654224ac5ecaaf13403c1d03319cc9fe3970baa3405990d51ce317981af090d882a47b
7
- data.tar.gz: 25f134409c03d42ee4dc87dfd0d1750d645dc47a33dc5e2290acb0cfcf4562e0df441e11168c62014938f17a7ab0a1958b91bbebad241bec8912d2eededd47e9
6
+ metadata.gz: 84280f5c5e02b70305b04019e1878da8dcf83e5db14f8d15968cb62ccfc52f30e93f4018c5077004f92302f90b1d361dbb48b1dc8797b973a1f8d9fb72c92808
7
+ data.tar.gz: 50b782ed11569064c7514d9307172d62636795162dcd23993de80e6480c4f3034e9eacb7ed08d0d3cc40a1b74c81b4e51b4f003f62606da8e1264803cecc3180
data/README.md CHANGED
@@ -16,18 +16,25 @@ A doorknocking tool targeting phishing admin panels.
16
16
  ```bash
17
17
  % doorknock
18
18
  Commands:
19
+ doorknock crawl # crawl & knock phishing websites
19
20
  doorknock help [COMMAND] # Describe available commands or one specific command
20
- doorknock knock # knock phishing websites
21
+ doorknock knock URL # knock a given URLs
21
22
 
22
- % doorknock help knock
23
+ % doorknock help crawl
23
24
  Usage:
24
- doorknock knock
25
+ doorknock crawl
25
26
 
26
27
  Options:
27
28
  [--size=N] # Number of urlscan.io's search results to check. (Max: 10,000)
28
29
  # Default: 100
29
30
 
30
- knock phishing websites
31
+ crawl & knock phishing websites
32
+
33
+ % doorknock help knock
34
+ Usage:
35
+ doorknock knock URL
36
+
37
+ knock a given URL
31
38
  ```
32
39
 
33
40
  ## License
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "vcr", "~> 4.0"
33
33
  spec.add_development_dependency "webmock", "~> 3.5"
34
34
 
35
- spec.add_dependency "http", "~> 4.0"
35
+ spec.add_dependency "http", "~> 4.1"
36
36
  spec.add_dependency "oga", "~> 2.15"
37
37
  spec.add_dependency "parallel", "~> 1.14"
38
38
  spec.add_dependency "thor", "~> 0.19.0"
@@ -4,11 +4,16 @@ require "thor"
4
4
 
5
5
  module DoorKnock
6
6
  class CLI < Thor
7
- desc "knock", "knock phishing websites"
7
+ desc "knock URL", "knock a given URL"
8
+ def knock(url)
9
+ Monitor.knock(url)
10
+ end
11
+
12
+ desc "crawl", "crawl & knock phishing websites"
8
13
  method_option :size, type: :numeric, default: 100, desc: "Number of urlscan.io's search results to check. (Max: 10,000)"
9
- def knock
14
+ def crawl
10
15
  size = options.dig(:size) || 100
11
- Monitor.check(size)
16
+ Monitor.crawl(size)
12
17
  end
13
18
  end
14
19
  end
@@ -11,14 +11,21 @@ module DoorKnock
11
11
  end
12
12
 
13
13
  def base_url
14
- "#{url.scheme}://#{url.host}:#{url.port}"
14
+ case [url.scheme, url.port]
15
+ when ["http", 80]
16
+ "#{url.scheme}://#{url.host}"
17
+ when ["https", 443]
18
+ "#{url.scheme}://#{url.host}"
19
+ else
20
+ "#{url.scheme}://#{url.host}:#{url.port}"
21
+ end
15
22
  end
16
23
 
17
24
  def second_last_url
18
25
  parts = url.path.split("/")
19
26
  parts.pop if parts.length > 2
20
27
 
21
- "#{url.scheme}://#{url.host}:#{url.port}" + parts.join("/")
28
+ base_url + parts.join("/")
22
29
  end
23
30
 
24
31
  def admin_panel_urls
@@ -8,18 +8,22 @@ module DoorKnock
8
8
  @memo = {}
9
9
  end
10
10
 
11
- def check(size = 100)
11
+ def knock(url)
12
+ generator = Generator.new(url)
13
+ generator.admin_panel_urls.each do |panel_url|
14
+ website = Website.new(panel_url)
15
+ next if marked?(website.url)
16
+ next unless website.ok? && website.panel?
17
+
18
+ puts [website.url, website.title].join(",")
19
+ mark(website.url)
20
+ break
21
+ end
22
+ end
23
+
24
+ def crawl(size = 100)
12
25
  Parallel.each(Feed.phishy_urls(size)) do |phishy_url|
13
- generator = Generator.new phishy_url
14
- generator.admin_panel_urls.each do |panel_url|
15
- website = Website.new(panel_url)
16
- next if marked?(website.url)
17
- next unless website.ok? && website.panel?
18
-
19
- puts [website.url, website.title].join(",")
20
- mark(website.url)
21
- break
22
- end
26
+ knock phishy_url
23
27
  end
24
28
  end
25
29
 
@@ -31,8 +35,12 @@ module DoorKnock
31
35
  @memo.fetch(url, false)
32
36
  end
33
37
 
34
- def self.check(size = 100)
35
- new.check(size)
38
+ def self.crawl(size = 100)
39
+ new.crawl(size)
40
+ end
41
+
42
+ def self.knock(url)
43
+ new.knock(url)
36
44
  end
37
45
  end
38
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DoorKnock
4
- VERSION = "0.1.2"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorknock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.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-03-09 00:00:00.000000000 Z
11
+ date: 2019-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '4.0'
117
+ version: '4.1'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '4.0'
124
+ version: '4.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: oga
127
127
  requirement: !ruby/object:Gem::Requirement