doorknock 0.1.0 → 0.1.2

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: aca3b8073e39239084ca55a182739b6a4a72c0584f3478a4ade145cf518231ca
4
- data.tar.gz: 3e03f71f011352c19ce507c6eae125a21bf3365fdcd1f3e3094707e690d02155
3
+ metadata.gz: d25dd268540ca72f5803f536e918ac372a49cd1ddc95b08022b29d5823a3c613
4
+ data.tar.gz: '08943a51bf554653ce5dedb413527fb75aa35914abf215b47fb5820ef942dcc8'
5
5
  SHA512:
6
- metadata.gz: 9ce840c798ea4d6922f579f4e2a7f573b9d748cc641889e79c6833f2056cb6704885bdee0d9e5fe3a56e32fbbf9904bf11e5c3bb5236d29fb9e2126080b00078
7
- data.tar.gz: d8707270fc5824f030f713542e9b65d19e1c59d75594b0e36ca066e593b9d3e52718bb06738fa14793eeb7c8fec6cb53af40dbe46d4175e68fc3643249f13066
6
+ metadata.gz: f351a16a266ebf1bfe7cb0e4794f8826e3c85a86480686ce383470d4be654224ac5ecaaf13403c1d03319cc9fe3970baa3405990d51ce317981af090d882a47b
7
+ data.tar.gz: 25f134409c03d42ee4dc87dfd0d1750d645dc47a33dc5e2290acb0cfcf4562e0df441e11168c62014938f17a7ab0a1958b91bbebad241bec8912d2eededd47e9
data/README.md CHANGED
@@ -14,12 +14,12 @@ A doorknocking tool targeting phishing admin panels.
14
14
  ## Usage
15
15
 
16
16
  ```bash
17
- $ doorknock
17
+ % doorknock
18
18
  Commands:
19
19
  doorknock help [COMMAND] # Describe available commands or one specific command
20
20
  doorknock knock # knock phishing websites
21
21
 
22
- $ doorknock help knock
22
+ % doorknock help knock
23
23
  Usage:
24
24
  doorknock knock
25
25
 
@@ -34,5 +34,6 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  spec.add_dependency "http", "~> 4.0"
36
36
  spec.add_dependency "oga", "~> 2.15"
37
+ spec.add_dependency "parallel", "~> 1.14"
37
38
  spec.add_dependency "thor", "~> 0.19.0"
38
39
  end
@@ -5,32 +5,26 @@ require "uri"
5
5
 
6
6
  module DoorKnock
7
7
  class Generator
8
- attr_reader :urls
9
- def initialize(urls = [])
10
- @urls = urls.map do |url|
11
- URI(url)
12
- end.compact
8
+ attr_reader :url
9
+ def initialize(url)
10
+ @url = URI(url)
13
11
  end
14
12
 
15
- def base_urls
16
- urls.map do |url|
17
- "#{url.scheme}://#{url.host}:#{url.port}"
18
- end
13
+ def base_url
14
+ "#{url.scheme}://#{url.host}:#{url.port}"
19
15
  end
20
16
 
21
- def second_last_urls
22
- urls.map do |url|
23
- parts = url.path.split("/")
24
- parts.pop if parts.length > 2
17
+ def second_last_url
18
+ parts = url.path.split("/")
19
+ parts.pop if parts.length > 2
25
20
 
26
- "#{url.scheme}://#{url.host}:#{url.port}" + parts.join("/")
27
- end
21
+ "#{url.scheme}://#{url.host}:#{url.port}" + parts.join("/")
28
22
  end
29
23
 
30
24
  def admin_panel_urls
31
- (base_urls + second_last_urls).uniq.sort.map do |url|
25
+ [base_url, second_last_url].uniq.sort.map do |target_url|
32
26
  paths.map do |path|
33
- "#{url}/#{path}"
27
+ "#{target_url}/#{path}"
34
28
  end
35
29
  end.flatten.sort
36
30
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "parallel"
4
+
3
5
  module DoorKnock
4
6
  class Monitor
5
7
  def initialize
@@ -7,21 +9,26 @@ module DoorKnock
7
9
  end
8
10
 
9
11
  def check(size = 100)
10
- phishy_urls = Feed.phishy_urls(size)
11
- generator = Generator.new(phishy_urls)
12
+ 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?
12
18
 
13
- generator.admin_panel_urls.map do |url|
14
- Website.new url
15
- end.each do |website|
16
- next unless website.ok? && website.panel?
19
+ puts [website.url, website.title].join(",")
20
+ mark(website.url)
21
+ break
22
+ end
23
+ end
24
+ end
17
25
 
18
- puts [
19
- website.url,
20
- website.title
21
- ].join(",")
26
+ def mark(url)
27
+ @memo[url] = true
28
+ end
22
29
 
23
- break
24
- end
30
+ def marked?(url)
31
+ @memo.fetch(url, false)
25
32
  end
26
33
 
27
34
  def self.check(size = 100)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DoorKnock
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
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.0
4
+ version: 0.1.2
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-06 00:00:00.000000000 Z
11
+ date: 2019-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '2.15'
139
+ - !ruby/object:Gem::Dependency
140
+ name: parallel
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '1.14'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '1.14'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: thor
141
155
  requirement: !ruby/object:Gem::Requirement