rogue_one 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yaml +23 -0
- data/Gemfile +2 -0
- data/README.md +2 -2
- data/Rakefile +3 -1
- data/bin/console +1 -0
- data/exe/rogue_one +3 -1
- data/lib/rogue_one/cli.rb +1 -0
- data/lib/rogue_one/detector.rb +18 -21
- data/lib/rogue_one/ping.rb +1 -2
- data/lib/rogue_one/version.rb +1 -1
- data/rogue_one.gemspec +5 -5
- metadata +15 -15
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b93f5fd8739dbb15739809bba1f391a913d5e7e3a8822a07487f9942ee307ac6
|
4
|
+
data.tar.gz: c413a952f102a75f3bbf7db003373eebe1ecd8b0f92c52db345dbda3d562bff1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 477c391a0c54c2889ff000048c24952355e2e9c26116a68c7748e6e64d16ca0657264c81a6ce6c56d2251c5d830c8075efd81ccfb3a6151d03914e083927c9a3
|
7
|
+
data.tar.gz: 3c4ebc1b64c51d0299c969363fd5d51223f4ef21912c4957ac8d8db1666295f3f070919674687935d48f2e45334f7d4e66fabb96ef4a39e36ef0a7b56c9f903e
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on: [pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
fail-fast: false
|
11
|
+
matrix:
|
12
|
+
ruby: [2.7, "3.0"]
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
bundler-cache: true
|
21
|
+
- name: Build and test with Rake
|
22
|
+
run: |
|
23
|
+
bundle exec rake
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Rogue one
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rogue_one.svg)](https://badge.fury.io/rb/rogue_one)
|
4
|
-
[![
|
4
|
+
[![Ruby CI](https://github.com/ninoseki/rogue_one/actions/workflows/test.yaml/badge.svg)](https://github.com/ninoseki/rogue_one/actions/workflows/test.yaml)
|
5
5
|
[![CodeFactor](https://www.codefactor.io/repository/github/ninoseki/rogue_one/badge)](https://www.codefactor.io/repository/github/ninoseki/rogue_one)
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/github/ninoseki/rogue_one/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/rogue_one?branch=master)
|
7
7
|
|
@@ -75,7 +75,7 @@ $ rogue_one report 171.244.3.111 --custom-list tmp/roaming.yml
|
|
75
75
|
"58.82.243.9"
|
76
76
|
]
|
77
77
|
}
|
78
|
-
# Note: a custom list should be an array of domains in YAML
|
78
|
+
# Note: a custom list should be an array of domains in a YAML file.
|
79
79
|
```
|
80
80
|
|
81
81
|
| Key | Desc. |
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/exe/rogue_one
CHANGED
data/lib/rogue_one/cli.rb
CHANGED
data/lib/rogue_one/detector.rb
CHANGED
@@ -11,21 +11,18 @@ require "etc"
|
|
11
11
|
|
12
12
|
module RogueOne
|
13
13
|
class Detector
|
14
|
-
attr_reader :custom_list
|
15
|
-
attr_reader :default_list
|
16
|
-
attr_reader :max_concurrency
|
17
|
-
attr_reader :record_type
|
18
|
-
attr_reader :target
|
19
|
-
attr_reader :verbose
|
14
|
+
attr_reader :custom_list, :default_list, :max_concurrency, :record_type, :target, :verbose
|
20
15
|
|
21
16
|
GOOGLE_PUBLIC_DNS = "8.8.8.8"
|
22
17
|
|
23
|
-
def initialize(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
def initialize(
|
19
|
+
target:,
|
20
|
+
custom_list: nil,
|
21
|
+
default_list: "alexa",
|
22
|
+
record_type: "A",
|
23
|
+
threshold: nil,
|
24
|
+
verbose: false
|
25
|
+
)
|
29
26
|
@target = target
|
30
27
|
|
31
28
|
@custom_list = custom_list
|
@@ -74,9 +71,9 @@ module RogueOne
|
|
74
71
|
end
|
75
72
|
|
76
73
|
def landing_pages
|
77
|
-
@memo.
|
74
|
+
@memo.filter_map do |ip, count|
|
78
75
|
count > threshold ? ip : nil
|
79
|
-
end.
|
76
|
+
end.sort
|
80
77
|
end
|
81
78
|
|
82
79
|
def results
|
@@ -105,13 +102,13 @@ module RogueOne
|
|
105
102
|
normal_resolutions = bulk_resolve(normal_resolver, domains)
|
106
103
|
resolutions = bulk_resolve(target_resolver, domains)
|
107
104
|
|
108
|
-
results = resolutions.
|
109
|
-
normal_addresses = normal_resolutions
|
105
|
+
results = resolutions.filter_map do |domain, addresses|
|
106
|
+
normal_addresses = normal_resolutions[domain] || []
|
110
107
|
address = (addresses || []).first
|
111
108
|
[domain, address] if address && !normal_addresses.include?(address)
|
112
|
-
end.
|
109
|
+
end.to_h
|
113
110
|
|
114
|
-
@memo = results.values.group_by(&:itself).
|
111
|
+
@memo = results.values.group_by(&:itself).transform_values(&:length)
|
115
112
|
@verbose_memo = results if verbose
|
116
113
|
end
|
117
114
|
|
@@ -140,8 +137,8 @@ module RogueOne
|
|
140
137
|
list = DomainList.new(path)
|
141
138
|
return list.domains if list.valid?
|
142
139
|
|
143
|
-
raise ArgumentError, "Inputted an invalid list. #{path}
|
144
|
-
raise ArgumentError, "Inputted an invalid list. Please input a list
|
140
|
+
raise ArgumentError, "Inputted an invalid list. #{path} does not eixst." unless list.exists?
|
141
|
+
raise ArgumentError, "Inputted an invalid list. Please input a list via a YAML file." unless list.valid_format?
|
145
142
|
end
|
146
143
|
|
147
144
|
def bulk_resolve(resolver, domains)
|
@@ -175,7 +172,7 @@ module RogueOne
|
|
175
172
|
end
|
176
173
|
|
177
174
|
def dns_resource_by_record_type
|
178
|
-
@dns_resource_by_record_type ||= dns_resources
|
175
|
+
@dns_resource_by_record_type ||= dns_resources[record_type]
|
179
176
|
end
|
180
177
|
|
181
178
|
def dns_resources
|
data/lib/rogue_one/ping.rb
CHANGED
data/lib/rogue_one/version.rb
CHANGED
data/rogue_one.gemspec
CHANGED
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_development_dependency "bundler", "~> 2.
|
28
|
-
spec.add_development_dependency "
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.2"
|
28
|
+
spec.add_development_dependency "coveralls_reborn", "~> 0.23"
|
29
29
|
spec.add_development_dependency "rake", "~> 13.0"
|
30
|
-
spec.add_development_dependency "rspec", "~> 3.
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.10"
|
31
31
|
|
32
|
-
spec.add_dependency "async-dns", "~> 1.
|
33
|
-
spec.add_dependency "thor", "~> 1.
|
32
|
+
spec.add_dependency "async-dns", "~> 1.3"
|
33
|
+
spec.add_dependency "thor", "~> 1.1"
|
34
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.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manabu Niseki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: coveralls_reborn
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.23'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.23'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,42 +58,42 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.10'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
68
|
+
version: '3.10'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: async-dns
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.3'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: thor
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.1'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.1'
|
97
97
|
description: A rogue DNS detector
|
98
98
|
email:
|
99
99
|
- manabu.niseki@gmail.com
|
@@ -102,9 +102,9 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ".github/workflows/test.yaml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".rspec"
|
107
|
-
- ".travis.yml"
|
108
108
|
- Gemfile
|
109
109
|
- LICENSE
|
110
110
|
- README.md
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
145
|
+
rubygems_version: 3.2.22
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: A rogue DNS detector
|