dnsutils 2.0.4 → 2.0.5
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 +4 -4
- data/README.md +20 -3
- data/lib/dnslazy.rb +54 -23
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e342d86f9c03fe3ac1f9dba461b500c43885c1a7
|
4
|
+
data.tar.gz: 0d86ec7f4236080a7f0fbc329383a22d3b6b0416
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86c4ac6a06d0147b8b7a658d6d9b1e5b715bc5a08e98604575c8fb1629b8c73341d635e3b47712f77b08defa61c60b79ecda691af380cb5d63c0f7c86b7d6ec2
|
7
|
+
data.tar.gz: df8db7e0f6e0000f5ffb34ec4369a6de472dc15633d377ee58e8f0fc50fdf05310fb8f33452f6669a12b0f58e6b4ab1fed8b25c48bd5ef9664b947888bd802e8
|
data/README.md
CHANGED
@@ -184,13 +184,29 @@ And that's pretty much all there is to it!
|
|
184
184
|
### dnslazy
|
185
185
|
|
186
186
|
A simple utility that lets you put the IP address you want in the domain name.
|
187
|
-
For example, 1.2.3.4.domain.com will resolve to 1.2.3.4.
|
188
187
|
|
189
|
-
|
188
|
+
Running the tool is simple; use `--help` to get a full list of arguments, but
|
189
|
+
you can usually just run it with no arguments (unless you need a special port):
|
190
190
|
|
191
191
|
$ dnslazy
|
192
192
|
|
193
|
-
|
193
|
+
Once it's up, you can query the DNS server and tell it what to respond with. For
|
194
|
+
example, 1.2.3.4.domain.com will resolve to 1.2.3.4:
|
195
|
+
|
196
|
+
$ dig +short 8.8.8.8.skullseclabs.org
|
197
|
+
8.8.8.8
|
198
|
+
|
199
|
+
As of v2.0.5, ipv6 is supported as well. Unfortunately, because DNS does not
|
200
|
+
support a colon in the names, the colon must be replaced with a hyphen:
|
201
|
+
|
202
|
+
$ dig +short 0--1.skullseclabs.org
|
203
|
+
::1
|
204
|
+
|
205
|
+
$ dig +short 00-11-22-33-44-55-66-77.skullseclabs.org
|
206
|
+
0:11:22:33:44:55:66:77
|
207
|
+
|
208
|
+
I'm not sure if others will find this tool useful, but it solves a quick problem
|
209
|
+
I had!
|
194
210
|
|
195
211
|
### dnsmastermind
|
196
212
|
|
@@ -247,3 +263,4 @@ There are no tests for these utilities, so be warned. :)
|
|
247
263
|
* 2.0.2 - Add support for PTR records (reverse DNS)
|
248
264
|
* 2.0.3 - Added dnslazy
|
249
265
|
* 2.0.4 - Fixed dnslazy
|
266
|
+
* 2.0.5 - Added ipv6 support to dnslazy
|
data/lib/dnslazy.rb
CHANGED
@@ -59,35 +59,66 @@ module DnsUtils
|
|
59
59
|
# Display the long or short version of the request
|
60
60
|
puts("IN: " + request.to_s(brief: !opts[:packet_trace]))
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
name = question.name
|
63
|
+
answer = nil
|
64
|
+
|
65
|
+
# ipv4
|
66
|
+
if name =~ /^\d+\.\d+\.\d+\.\d+\./
|
67
|
+
segments = question.name.split(/\./)[0..3]
|
68
|
+
if not segments.all? { |segment| segment =~ /^\d+$/ && segment.to_i >= 0 && segment.to_i <= 255 }
|
69
|
+
puts("Not sure how to handle name: #{name}")
|
70
|
+
transaction.error!(Nesser::RCODE_NAME_ERROR)
|
71
|
+
next
|
72
|
+
end
|
68
73
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
+
answer = Nesser::Answer.new(
|
75
|
+
name: request.questions[0].name,
|
76
|
+
type: Nesser::TYPE_A,
|
77
|
+
cls: Nesser::CLS_IN,
|
78
|
+
ttl: 10,
|
79
|
+
rr: Nesser::A.new(address: segments.join('.')),
|
80
|
+
)
|
81
|
+
|
82
|
+
# ipv6 (less clean, will have to sanity check within)
|
83
|
+
elsif name =~ /[0-9a-f]*-[0-9a-f]*-.*\./
|
84
|
+
address = name.split(/\./)[0].gsub(/-/, ':')
|
85
|
+
segments = address.split(/:/)
|
86
|
+
|
87
|
+
if not segments.all? { |segment| segment =~ /^[0-9a-f]*$/ && (segment == '' || (segment.to_i(16) >= 0 && segment.to_i(16) <= 255)) }
|
88
|
+
puts("Not sure how to handle name: #{name} (invalid ipv6 address)")
|
89
|
+
transaction.error!(Nesser::RCODE_NAME_ERROR)
|
90
|
+
next
|
74
91
|
end
|
75
|
-
|
76
|
-
|
92
|
+
if segments.length > 8
|
93
|
+
puts("Not sure how to handle name: #{name} (too many ipv6 segments)")
|
94
|
+
transaction.error!(Nesser::RCODE_NAME_ERROR)
|
95
|
+
next
|
96
|
+
end
|
97
|
+
if segments.select { |segment| segment == '' }.length > 1
|
98
|
+
puts("Not sure how to handle name: #{name} (too many empty ipv6 segments)")
|
99
|
+
transaction.error!(Nesser::RCODE_NAME_ERROR)
|
100
|
+
next
|
101
|
+
end
|
102
|
+
if segments.select { |segment| segment == '' }.length == 0 && segments.length < 8
|
103
|
+
puts("Not sure how to handle name: #{name} (incomplete ipv6 address)")
|
104
|
+
transaction.error!(Nesser::RCODE_NAME_ERROR)
|
105
|
+
next
|
106
|
+
end
|
107
|
+
|
108
|
+
answer = Nesser::Answer.new(
|
109
|
+
name: request.questions[0].name,
|
110
|
+
type: Nesser::TYPE_AAAA,
|
111
|
+
cls: Nesser::CLS_IN,
|
112
|
+
ttl: 10,
|
113
|
+
rr: Nesser::AAAA.new(address: segments.join(':')),
|
114
|
+
)
|
115
|
+
|
116
|
+
else
|
117
|
+
puts("Not sure how to handle name: #{name}")
|
77
118
|
transaction.error!(Nesser::RCODE_NAME_ERROR)
|
78
119
|
next
|
79
120
|
end
|
80
121
|
|
81
|
-
ip = segments.join('.')
|
82
|
-
|
83
|
-
answer = Nesser::Answer.new(
|
84
|
-
name: request.questions[0].name,
|
85
|
-
type: Nesser::TYPE_A,
|
86
|
-
cls: Nesser::CLS_IN,
|
87
|
-
ttl: 10,
|
88
|
-
rr: Nesser::A.new(address: ip),
|
89
|
-
)
|
90
|
-
|
91
122
|
transaction.answer!([answer])
|
92
123
|
puts("OUT: " + transaction.response.to_s(brief: !opts[:packet_trace]))
|
93
124
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dnsutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iagox86
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|