rogue_one 0.1.1 → 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: 86c74a7df8a4bcd245b6f298b96a70b249e173dcb75b0813beb14b128739e11e
4
- data.tar.gz: 8e164de064b6f087d2574ae02fa1ed7ad885da285531c00f2d488ce1f41a08b8
3
+ metadata.gz: 2be63346579c5afc83b8c8a8c04ffaa1a14c1469c2f5d8200c633dfd5b7512bc
4
+ data.tar.gz: f2bf7c83bfe4d19136b74a6994929b65a5cb3ef14296b516c3e52d1cc6d5c10f
5
5
  SHA512:
6
- metadata.gz: c12b466c5fc8b96ab64bd77c2ed8309fbc6497c5d8c831d31e2b850b592446f5eefe68eb5011cf216dc9703bfafde2ff1a2f1c202943dde86b802db47beb1ffc
7
- data.tar.gz: b805443996b4a28c1e6108fcaa1e45f1ea085db24db2428ae9c0a723f1c9017c61508e6d29151e6ae83186242c170546b5f914b6079aa6ee661b483527d8c9d4
6
+ metadata.gz: 23e2e93ef262b70634870673fc12eef1cd65cb7e908aff42d18201d46258026478800ad6e72c6c0e29b876054a2a0b9ede7eebd542cbed59b43b0f807c0a0c6f
7
+ data.tar.gz: bf4b3647dae1a1b198c321d71766774bdca758fb0d39c87a4ea6043159b29c68e9588cd142ae5e7c548b4b796657058f38340b3aae8a8df7e7600c665484cffc
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Rogue one: a rogue DNS detector
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/rogue_one.svg)](https://badge.fury.io/rb/rogue_one)
3
4
  [![Build Status](https://travis-ci.org/ninoseki/rogue_one.svg?branch=master)](https://travis-ci.org/ninoseki/rogue_one)
4
5
  [![Coverage Status](https://coveralls.io/repos/github/ninoseki/rogue_one/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/rogue_one?branch=master)
5
6
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "yaml"
4
+ require "parallel"
4
5
 
5
6
  module RogueOne
6
7
  class Detector
@@ -10,16 +11,15 @@ module RogueOne
10
11
 
11
12
  def initialize(target:)
12
13
  @target = target
13
- @memo = Hash.new(0)
14
+ @memo = {}
14
15
  end
15
16
 
16
17
  def report
17
- inspect
18
+ @report ||= [].tap do |out|
19
+ inspect
18
20
 
19
- {
20
- verdict: verdict,
21
- landing_pages: landing_pages
22
- }
21
+ out << { verdict: verdict, landing_pages: landing_pages }
22
+ end.first
23
23
  end
24
24
 
25
25
  private
@@ -39,14 +39,14 @@ module RogueOne
39
39
  end
40
40
 
41
41
  def inspect
42
- top_100_domains.each do |domain|
42
+ results = Parallel.map(top_100_domains) do |domain|
43
43
  normal_result = normal_resolver.dig(domain, "A")
44
44
  target_result = target_resolver.dig(domain, "A")
45
45
 
46
- if normal_result != target_result
47
- @memo[target_result] += 1 if target_result
48
- end
49
- end
46
+ target_result if target_result && normal_result != target_result
47
+ end.compact
48
+
49
+ @memo = results.group_by(&:itself).map { |k, v| [k, v.length] }.to_h
50
50
  end
51
51
 
52
52
  def top_100_domains
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RogueOne
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/rogue_one.gemspec CHANGED
@@ -29,5 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "rake", "~> 12.3"
30
30
  spec.add_development_dependency "rspec", "~> 3.8"
31
31
 
32
+ spec.add_dependency "parallel", "~> 1.17"
32
33
  spec.add_dependency "thor", "~> 0.19"
33
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rogue_one
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
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-04-25 00:00:00.000000000 Z
11
+ date: 2019-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: parallel
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.17'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.17'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: thor
71
85
  requirement: !ruby/object:Gem::Requirement