dnslookup 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/dnslookup +5 -0
- data/lib/dnslookup.rb +82 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2e683614d37d05443ec7cba2b3a3ffae5b14e561
|
4
|
+
data.tar.gz: d433029bd387f697241a7012b97165ea9a1e857e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ba198c13849e32867c64961a5094f5c69ec23a0137ebd5de27597a12c50b85e0d25cf5d7502d07b4870ad42997c43bc8b421c66497ded7abe23af66331fd932
|
7
|
+
data.tar.gz: b93ad335893171c468804ef31eec08cb6a0481d6be74dda6b9a110fd76e9ad5ccbdb92434866159c5a4b67cb2ebc1e22c52bdc97024cd8916f31eb0ba0af0ea5
|
data/bin/dnslookup
ADDED
data/lib/dnslookup.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
class DNSLookup
|
4
|
+
def initialize
|
5
|
+
@type = ''
|
6
|
+
@domain = ARGV.shift
|
7
|
+
|
8
|
+
parse_options
|
9
|
+
setup_query_servers
|
10
|
+
lookup_with_options
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse_options
|
14
|
+
OptionParser.new do |opt|
|
15
|
+
opt.banner = "Usage lookup [options]"
|
16
|
+
|
17
|
+
opt.on("-mx", "--email", "Return MX records") do |v|
|
18
|
+
@type = 'mx'
|
19
|
+
end
|
20
|
+
|
21
|
+
opt.on("-a", "--address", "Return A type records") do |v|
|
22
|
+
@type = 'a'
|
23
|
+
end
|
24
|
+
|
25
|
+
opt.on("-c", "--alias", "Return C type records") do |v|
|
26
|
+
@type = 'c'
|
27
|
+
end
|
28
|
+
|
29
|
+
opt.on("-txt", "--text", "Return TXT type records") do |v|
|
30
|
+
@type = 'txt'
|
31
|
+
end
|
32
|
+
|
33
|
+
opt.on("-s", "--server=SERVER", "Specify specific name server to query") do |v|
|
34
|
+
@single_server = v
|
35
|
+
end
|
36
|
+
|
37
|
+
opt.on("-h", "--help", "Prints this help") do
|
38
|
+
puts opt
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
end.parse!
|
42
|
+
end
|
43
|
+
|
44
|
+
def setup_query_servers
|
45
|
+
@servers = []
|
46
|
+
|
47
|
+
if @single_server
|
48
|
+
@servers << @single_server
|
49
|
+
else
|
50
|
+
@servers = ['8.8.8.8', '8.8.4.4']
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def lookup_with_options
|
55
|
+
case @type
|
56
|
+
when 'mx'
|
57
|
+
query_command('mx')
|
58
|
+
when 'a'
|
59
|
+
query_command('a')
|
60
|
+
when 'c'
|
61
|
+
query_command('c')
|
62
|
+
when 'txt'
|
63
|
+
query_command('txt')
|
64
|
+
else
|
65
|
+
query_command('any')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def query_command(type)
|
70
|
+
@servers.each do |server|
|
71
|
+
if type == 'any'
|
72
|
+
check = `dig @#{server} #{type} #{@domain}`
|
73
|
+
else
|
74
|
+
check = `dig @#{server} #{@domain} #{type} +short`
|
75
|
+
end
|
76
|
+
|
77
|
+
puts "Checking servers: #{server}"
|
78
|
+
puts check
|
79
|
+
puts
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dnslookup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Victor S. Keenan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple gem that allows you to query private, public, or specified DNS
|
14
|
+
servers.
|
15
|
+
email: me@victorkeenan.com
|
16
|
+
executables:
|
17
|
+
- dnslookup
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/dnslookup
|
22
|
+
- lib/dnslookup.rb
|
23
|
+
homepage: http://victorkeenan.com/projects/dnslookup/
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata:
|
27
|
+
Twitter: https://twitter.com/victorsk
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.6.1
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: DNS record query tool.
|
48
|
+
test_files: []
|