rogue_one 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rogue_one.rb +1 -0
- data/lib/rogue_one/cli.rb +4 -1
- data/lib/rogue_one/ping.rb +22 -0
- data/lib/rogue_one/resolver.rb +2 -0
- data/lib/rogue_one/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8a159994892e276c84f9854aea0d1bb1ed915da4d1441e362cd3df81967a029
|
4
|
+
data.tar.gz: aeb889e5a15df10f85822fc78fb285a55f86268f7a6287e34f604698172ad0b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d49d2e63096010fae8beb77c5b0ff0eadcb83b350663a7f048a5f2402378b65ee99bd91ba83c6659a0cac87250d91c4a377d0c1a1f5e924e74b7aa4af670472
|
7
|
+
data.tar.gz: 52f2ea2c904088b2f3c817653427e4d92ca04e1584a11754163a5ade8ee6a5075d4350e5fde3468cb87dc865caadcc6acc3de3edd98005d89dd5386214ed9505
|
data/lib/rogue_one.rb
CHANGED
data/lib/rogue_one/cli.rb
CHANGED
@@ -8,6 +8,8 @@ module RogueOne
|
|
8
8
|
desc "report [DNS_SERVER]", "Show a report of a given DNS server"
|
9
9
|
def report(dns_server)
|
10
10
|
with_error_handling do
|
11
|
+
Ping.pong? dns_server
|
12
|
+
|
11
13
|
detector = Detector.new(target: dns_server)
|
12
14
|
puts JSON.pretty_generate(detector.report)
|
13
15
|
end
|
@@ -17,7 +19,8 @@ module RogueOne
|
|
17
19
|
def with_error_handling
|
18
20
|
yield
|
19
21
|
rescue StandardError => e
|
20
|
-
|
22
|
+
message = { error: e.to_s }
|
23
|
+
puts JSON.pretty_generate(message)
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RogueOne
|
4
|
+
class Ping
|
5
|
+
attr_reader :resolver
|
6
|
+
|
7
|
+
def initialize(nameserver)
|
8
|
+
@resolver = Resolver.new(nameserver: nameserver)
|
9
|
+
end
|
10
|
+
|
11
|
+
def pong?
|
12
|
+
result = resolver.dig("example.com", "A")
|
13
|
+
raise Error, "DNS resolve error: there is no resopnse from #{resolver.nameserver}" unless result
|
14
|
+
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.pong?(target)
|
19
|
+
new(target).pong?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/rogue_one/resolver.rb
CHANGED
data/lib/rogue_one/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.4
|
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-
|
11
|
+
date: 2019-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/rogue_one/cli.rb
|
117
117
|
- lib/rogue_one/data/top_100.yml
|
118
118
|
- lib/rogue_one/detector.rb
|
119
|
+
- lib/rogue_one/ping.rb
|
119
120
|
- lib/rogue_one/resolver.rb
|
120
121
|
- lib/rogue_one/version.rb
|
121
122
|
- rogue_one.gemspec
|