dnsruby 1.55 → 1.56.0
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 +96 -0
- data/Rakefile +30 -29
- data/demo/axfr.rb +93 -93
- data/demo/check_soa.rb +99 -99
- data/demo/check_zone.rb +59 -59
- data/demo/digdlv.rb +43 -43
- data/demo/digroot.rb +34 -34
- data/demo/example_recurse.rb +14 -14
- data/demo/mresolv.rb +30 -30
- data/demo/mx.rb +31 -31
- data/demo/rubydig.rb +37 -37
- data/demo/to_resolve.txt +3088 -3088
- data/demo/trace_dns.rb +46 -46
- data/lib/dnsruby.rb +161 -526
- data/lib/dnsruby/DNS.rb +305 -0
- data/lib/{Dnsruby/Cache.rb → dnsruby/cache.rb} +152 -152
- data/lib/{Dnsruby → dnsruby}/code_mapper.rb +48 -52
- data/lib/dnsruby/code_mappers.rb +295 -0
- data/lib/{Dnsruby/Config.rb → dnsruby/config.rb} +454 -454
- data/lib/{Dnsruby → dnsruby}/dnssec.rb +91 -91
- data/lib/{Dnsruby/Hosts.rb → dnsruby/hosts.rb} +125 -125
- data/lib/{Dnsruby → dnsruby}/ipv4.rb +26 -26
- data/lib/{Dnsruby → dnsruby}/ipv6.rb +42 -42
- data/lib/{Dnsruby → dnsruby}/key_cache.rb +29 -29
- data/lib/dnsruby/message/decoder.rb +164 -0
- data/lib/dnsruby/message/encoder.rb +75 -0
- data/lib/dnsruby/message/header.rb +249 -0
- data/lib/dnsruby/message/message.rb +629 -0
- data/lib/dnsruby/message/question.rb +86 -0
- data/lib/dnsruby/message/section.rb +96 -0
- data/lib/{Dnsruby → dnsruby}/name.rb +141 -141
- data/lib/dnsruby/packet_sender.rb +661 -0
- data/lib/{Dnsruby/Recursor.rb → dnsruby/recursor.rb} +235 -233
- data/lib/dnsruby/resolv.rb +113 -0
- data/lib/dnsruby/resolver.rb +1192 -0
- data/lib/dnsruby/resource/A.rb +56 -0
- data/lib/dnsruby/resource/AAAA.rb +54 -0
- data/lib/{Dnsruby → dnsruby}/resource/AFSDB.rb +68 -68
- data/lib/{Dnsruby → dnsruby}/resource/CERT.rb +105 -105
- data/lib/{Dnsruby → dnsruby}/resource/DHCID.rb +54 -54
- data/lib/dnsruby/resource/DLV.rb +27 -0
- data/lib/{Dnsruby → dnsruby}/resource/DNSKEY.rb +372 -372
- data/lib/{Dnsruby → dnsruby}/resource/DS.rb +255 -255
- data/lib/{Dnsruby → dnsruby}/resource/HINFO.rb +71 -71
- data/lib/{Dnsruby → dnsruby}/resource/HIP.rb +29 -29
- data/lib/{Dnsruby → dnsruby}/resource/IN.rb +30 -30
- data/lib/{Dnsruby → dnsruby}/resource/IPSECKEY.rb +31 -31
- data/lib/{Dnsruby → dnsruby}/resource/ISDN.rb +62 -62
- data/lib/{Dnsruby → dnsruby}/resource/KX.rb +65 -65
- data/lib/{Dnsruby → dnsruby}/resource/LOC.rb +263 -263
- data/lib/{Dnsruby → dnsruby}/resource/MINFO.rb +69 -69
- data/lib/{Dnsruby → dnsruby}/resource/MX.rb +65 -65
- data/lib/{Dnsruby → dnsruby}/resource/NAPTR.rb +98 -98
- data/lib/{Dnsruby → dnsruby}/resource/NSAP.rb +171 -171
- data/lib/dnsruby/resource/NSEC.rb +275 -0
- data/lib/dnsruby/resource/NSEC3.rb +332 -0
- data/lib/dnsruby/resource/NSEC3PARAM.rb +135 -0
- data/lib/dnsruby/resource/OPT.rb +272 -0
- data/lib/{Dnsruby → dnsruby}/resource/PX.rb +70 -70
- data/lib/{Dnsruby → dnsruby}/resource/RP.rb +75 -75
- data/lib/dnsruby/resource/RR.rb +421 -0
- data/lib/dnsruby/resource/RRSIG.rb +275 -0
- data/lib/dnsruby/resource/RRSet.rb +190 -0
- data/lib/{Dnsruby → dnsruby}/resource/RT.rb +67 -67
- data/lib/{Dnsruby → dnsruby}/resource/SOA.rb +94 -94
- data/lib/dnsruby/resource/SPF.rb +29 -0
- data/lib/dnsruby/resource/SRV.rb +112 -0
- data/lib/{Dnsruby → dnsruby}/resource/SSHFP.rb +14 -14
- data/lib/dnsruby/resource/TKEY.rb +163 -0
- data/lib/dnsruby/resource/TSIG.rb +593 -0
- data/lib/{Dnsruby → dnsruby}/resource/TXT.rb +191 -191
- data/lib/dnsruby/resource/X25.rb +55 -0
- data/lib/{Dnsruby → dnsruby}/resource/domain_name.rb +25 -25
- data/lib/{Dnsruby → dnsruby}/resource/generic.rb +80 -80
- data/lib/dnsruby/resource/resource.rb +25 -0
- data/lib/{Dnsruby → dnsruby}/select_thread.rb +148 -148
- data/lib/{Dnsruby/SingleResolver.rb → dnsruby/single_resolver.rb} +60 -60
- data/lib/{Dnsruby → dnsruby}/single_verifier.rb +344 -344
- data/lib/dnsruby/the_log.rb +44 -0
- data/lib/dnsruby/update.rb +278 -0
- data/lib/dnsruby/validator_thread.rb +124 -0
- data/lib/dnsruby/version.rb +3 -0
- data/lib/{Dnsruby → dnsruby}/zone_reader.rb +93 -93
- data/lib/{Dnsruby → dnsruby}/zone_transfer.rb +377 -377
- data/test/spec_helper.rb +16 -0
- data/test/tc_axfr.rb +31 -34
- data/test/tc_cache.rb +32 -32
- data/test/tc_dlv.rb +28 -28
- data/test/tc_dns.rb +73 -76
- data/test/tc_dnskey.rb +31 -32
- data/test/tc_dnsruby.rb +50 -44
- data/test/tc_ds.rb +36 -36
- data/test/tc_escapedchars.rb +252 -255
- data/test/tc_hash.rb +17 -21
- data/test/tc_header.rb +48 -57
- data/test/tc_hip.rb +19 -22
- data/test/tc_ipseckey.rb +18 -21
- data/test/tc_keith.rb +300 -0
- data/test/tc_message.rb +87 -0
- data/test/tc_misc.rb +83 -87
- data/test/tc_name.rb +81 -84
- data/test/tc_naptr.rb +18 -21
- data/test/tc_nsec.rb +55 -55
- data/test/tc_nsec3.rb +23 -24
- data/test/tc_nsec3param.rb +20 -21
- data/test/tc_packet.rb +90 -93
- data/test/tc_packet_unique_push.rb +48 -51
- data/test/tc_question.rb +30 -33
- data/test/tc_queue.rb +16 -17
- data/test/tc_recur.rb +16 -17
- data/test/tc_res_config.rb +38 -41
- data/test/tc_res_env.rb +29 -32
- data/test/tc_res_file.rb +26 -29
- data/test/tc_res_opt.rb +62 -65
- data/test/tc_resolver.rb +287 -242
- data/test/tc_rr-opt.rb +70 -63
- data/test/tc_rr-txt.rb +68 -71
- data/test/tc_rr-unknown.rb +45 -48
- data/test/tc_rr.rb +76 -70
- data/test/tc_rrset.rb +21 -22
- data/test/tc_rrsig.rb +19 -20
- data/test/tc_single_resolver.rb +294 -297
- data/test/tc_soak.rb +199 -202
- data/test/tc_soak_base.rb +29 -34
- data/test/tc_sshfp.rb +20 -23
- data/test/tc_tcp.rb +32 -35
- data/test/tc_tkey.rb +41 -44
- data/test/tc_tsig.rb +81 -84
- data/test/tc_update.rb +108 -111
- data/test/tc_validator.rb +29 -29
- data/test/tc_verifier.rb +81 -82
- data/test/ts_dnsruby.rb +16 -15
- data/test/ts_offline.rb +62 -63
- data/test/ts_online.rb +115 -115
- metadata +155 -90
- data/README +0 -59
- data/lib/Dnsruby/DNS.rb +0 -305
- data/lib/Dnsruby/PacketSender.rb +0 -656
- data/lib/Dnsruby/Resolver.rb +0 -1189
- data/lib/Dnsruby/TheLog.rb +0 -44
- data/lib/Dnsruby/message.rb +0 -1230
- data/lib/Dnsruby/resource/A.rb +0 -56
- data/lib/Dnsruby/resource/AAAA.rb +0 -54
- data/lib/Dnsruby/resource/DLV.rb +0 -27
- data/lib/Dnsruby/resource/NSEC.rb +0 -298
- data/lib/Dnsruby/resource/NSEC3.rb +0 -340
- data/lib/Dnsruby/resource/NSEC3PARAM.rb +0 -135
- data/lib/Dnsruby/resource/OPT.rb +0 -213
- data/lib/Dnsruby/resource/RRSIG.rb +0 -275
- data/lib/Dnsruby/resource/SPF.rb +0 -29
- data/lib/Dnsruby/resource/SRV.rb +0 -112
- data/lib/Dnsruby/resource/TKEY.rb +0 -163
- data/lib/Dnsruby/resource/TSIG.rb +0 -593
- data/lib/Dnsruby/resource/X25.rb +0 -55
- data/lib/Dnsruby/resource/resource.rb +0 -678
- data/lib/Dnsruby/update.rb +0 -278
- data/lib/Dnsruby/validator_thread.rb +0 -124
data/demo/digdlv.rb
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
#digdlv - Ruby script to perform DNS queries, validated against the ISC DLV
|
|
20
|
-
#registry.
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
#
|
|
24
|
-
#digdlv name [ type [ class ] ]
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
#Performs a DNS query on the given name. The record type
|
|
29
|
-
#and class can also be specified; if left blank they default
|
|
30
|
-
#to A and IN.
|
|
31
|
-
#The program firstly loads the DLV zone signing key. Then, the
|
|
32
|
-
#requested DNS query is performed recursively. The response is then validated
|
|
33
|
-
|
|
34
|
-
#of the query name, and the chain of trust is followed to prove
|
|
35
|
-
#that the DNSSEC records are correct, or that we do not expect the
|
|
36
|
-
#response to be signed.
|
|
37
|
-
#
|
|
38
|
-
|
|
39
|
-
#
|
|
40
|
-
#Michael Fuhr <mike@fuhr.org>
|
|
41
|
-
#Alex D <alexd@nominet.org.uk>
|
|
17
|
+
# = NAME
|
|
18
|
+
#
|
|
19
|
+
# digdlv - Ruby script to perform DNS queries, validated against the ISC DLV
|
|
20
|
+
# registry.
|
|
21
|
+
#
|
|
22
|
+
# = SYNOPSIS
|
|
23
|
+
#
|
|
24
|
+
# digdlv name [ type [ class ] ]
|
|
25
|
+
#
|
|
26
|
+
# = DESCRIPTION
|
|
27
|
+
#
|
|
28
|
+
# Performs a DNS query on the given name. The record type
|
|
29
|
+
# and class can also be specified; if left blank they default
|
|
30
|
+
# to A and IN.
|
|
31
|
+
# The program firstly loads the DLV zone signing key. Then, the
|
|
32
|
+
# requested DNS query is performed recursively. The response is then validated
|
|
33
|
+
# - the DLV registry is searched for the keys of the closest ancestor
|
|
34
|
+
# of the query name, and the chain of trust is followed to prove
|
|
35
|
+
# that the DNSSEC records are correct, or that we do not expect the
|
|
36
|
+
# response to be signed.
|
|
37
|
+
#
|
|
38
|
+
# = AUTHOR
|
|
39
|
+
#
|
|
40
|
+
# Michael Fuhr <mike@fuhr.org>
|
|
41
|
+
# Alex D <alexd@nominet.org.uk>
|
|
42
42
|
|
|
43
43
|
begin
|
|
44
44
|
require 'rubygems'
|
|
@@ -52,7 +52,7 @@ raise RuntimeError, "Usage: #{$0} name [ type [ class ] ]\n" unless (ARGV.lengt
|
|
|
52
52
|
|
|
53
53
|
res = Dnsruby::Recursor.new
|
|
54
54
|
zt=Dnsruby::ZoneTransfer.new
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
dlv_key = RR.create("dlv.isc.org. IN DNSKEY 257 3 5 BEAAAAPHMu/5onzrEE7z1egmhg/WPO0+juoZrW3euWEn4MxDCE1+lLy2 brhQv5rN32RKtMzX6Mj70jdzeND4XknW58dnJNPCxn8+jAGl2FZLK8t+ 1uq4W+nnA3qO2+DL+k6BD4mewMLbIYFwe0PG73Te9fZ2kJb56dhgMde5 ymX4BI/oQ+cAK50/xvJv00Frf8kw6ucMTwFlgPe+jnGxPPEmHAte/URk Y62ZfkLoBAADLHQ9IrS2tryAe7mbBZVcOwIeU/Rw/mRx/vwwMCTgNboM QKtUdvNXDrYJDSHZws3xiRXF1Rf+al9UmZfSav/4NWLKjHzpT59k/VSt TDN0YUuWrBNh")
|
|
57
57
|
Dnssec.add_dlv_key(dlv_key)
|
|
58
58
|
|
|
@@ -60,10 +60,10 @@ Dnssec.add_dlv_key(dlv_key)
|
|
|
60
60
|
name, type, klass = ARGV
|
|
61
61
|
type ||= "A"
|
|
62
62
|
klass ||= "IN"
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
if (type.upcase == "AXFR")
|
|
65
65
|
rrs = zt.transfer(name) # , klass)
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
if (rrs)
|
|
68
68
|
rrs.each do |rr|
|
|
69
69
|
print rr.to_s + "\n"
|
|
@@ -71,7 +71,7 @@ if (type.upcase == "AXFR")
|
|
|
71
71
|
else
|
|
72
72
|
raise RuntimeError, "zone transfer failed: ", res.errorstring, "\n"
|
|
73
73
|
end
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
else
|
|
76
76
|
|
|
77
77
|
# Dnsruby::TheLog.level=Logger::DEBUG
|
data/demo/digroot.rb
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
#digitar - Ruby script to perform DNS queries, validated against the IANA TAR
|
|
20
|
-
#(trust anchor repository).
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
#
|
|
24
|
-
#digroot name [ type [ class ] ]
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
#Performs a DNS query on the given name. The record type
|
|
29
|
-
#and class can also be specified; if left blank they default
|
|
30
|
-
#to A and IN. The program firstly performs the requested DNS
|
|
17
|
+
# = NAME
|
|
18
|
+
#
|
|
19
|
+
# digitar - Ruby script to perform DNS queries, validated against the IANA TAR
|
|
20
|
+
# (trust anchor repository).
|
|
21
|
+
#
|
|
22
|
+
# = SYNOPSIS
|
|
23
|
+
#
|
|
24
|
+
# digroot name [ type [ class ] ]
|
|
25
|
+
#
|
|
26
|
+
# = DESCRIPTION
|
|
27
|
+
#
|
|
28
|
+
# Performs a DNS query on the given name. The record type
|
|
29
|
+
# and class can also be specified; if left blank they default
|
|
30
|
+
# to A and IN. The program firstly performs the requested DNS
|
|
31
31
|
# query. The response is then validated from the signed root.
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
#
|
|
35
|
-
#Michael Fuhr <mike@fuhr.org>
|
|
36
|
-
#Alex D <alexd@nominet.org.uk>
|
|
32
|
+
#
|
|
33
|
+
# = AUTHOR
|
|
34
|
+
#
|
|
35
|
+
# Michael Fuhr <mike@fuhr.org>
|
|
36
|
+
# Alex D <alexd@nominet.org.uk>
|
|
37
37
|
|
|
38
38
|
begin
|
|
39
39
|
require 'rubygems'
|
|
@@ -53,7 +53,7 @@ res = Dnsruby::Recursor.new(resolver)
|
|
|
53
53
|
name, type, klass = ARGV
|
|
54
54
|
type ||= "A"
|
|
55
55
|
klass ||= "IN"
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
begin
|
|
58
58
|
answer = nil
|
|
59
59
|
answer = res.query(name, type, klass)
|
data/demo/example_recurse.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
16
|
|
|
17
17
|
# Example usage for Net::DNS::Resolver::Recurse
|
|
18
18
|
# Performs recursion for a query.
|
data/demo/mresolv.rb
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
#mresolv [ -d ] [ -n number ] [ -t timeout ] [ filename... ]
|
|
19
|
-
#
|
|
20
|
-
#mresolv performs multiple DNS lookups in parallel. Names to query
|
|
21
|
-
#are read from the list of files given on the command line, or from the
|
|
22
|
-
#standard input.
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
|
|
18
|
+
# mresolv [ -d ] [ -n number ] [ -t timeout ] [ filename... ]
|
|
19
|
+
#
|
|
20
|
+
# mresolv performs multiple DNS lookups in parallel. Names to query
|
|
21
|
+
# are read from the list of files given on the command line, or from the
|
|
22
|
+
# standard input.
|
|
23
|
+
#
|
|
24
|
+
# = OPTIONS
|
|
25
|
+
#
|
|
26
|
+
# *-d : Turn on debugging output.
|
|
27
|
+
#
|
|
28
|
+
# *-n number : Set the number of queries to have in progress at any time.
|
|
29
|
+
#
|
|
30
|
+
# *-t timeout : Set the query timeout for each name in seconds.
|
|
31
31
|
|
|
32
32
|
require 'dnsruby'
|
|
33
33
|
require 'getoptLong'
|
|
@@ -58,7 +58,7 @@ in_progress = 0
|
|
|
58
58
|
q = Queue.new
|
|
59
59
|
eof = false
|
|
60
60
|
while (!eof)
|
|
61
|
-
#
|
|
61
|
+
# Have the thread loop round, send queries until max_num are outstanding.
|
|
62
62
|
while (!eof && in_progress < max_outstanding)
|
|
63
63
|
print("DEBUG: reading...") if debug
|
|
64
64
|
unless (name = gets)
|
|
@@ -71,13 +71,13 @@ while (!eof)
|
|
|
71
71
|
in_progress += 1
|
|
72
72
|
print("name = #{name}, outstanding = #{in_progress}\n") if debug
|
|
73
73
|
end
|
|
74
|
-
#
|
|
74
|
+
# Keep receiving while the query pool is full, or the list has been queried
|
|
75
75
|
while (in_progress >= max_outstanding || (eof && in_progress > 0))
|
|
76
76
|
id, result, error = q.pop
|
|
77
77
|
in_progress -= 1
|
|
78
78
|
if (error)
|
|
79
79
|
print("#{id}:\t#{error}\n")
|
|
80
|
-
else
|
|
80
|
+
else
|
|
81
81
|
print("#{result.answer.join("\n")}\n")
|
|
82
82
|
end
|
|
83
83
|
end
|
data/demo/mx.rb
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
16
|
|
|
17
17
|
require 'dnsruby'
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
#
|
|
21
|
-
#mx - Print a domain's MX records
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
#
|
|
25
|
-
#mx domain
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
#mx prints a domain's MX records, sorted by preference.
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
#Michael Fuhr <mike@fuhr.org>
|
|
34
|
-
#(Ruby port AlexD, Nominet UK)
|
|
35
|
-
#
|
|
19
|
+
# = NAME
|
|
20
|
+
#
|
|
21
|
+
# mx - Print a domain's MX records
|
|
22
|
+
#
|
|
23
|
+
# = SYNOPSIS
|
|
24
|
+
#
|
|
25
|
+
# mx domain
|
|
26
|
+
#
|
|
27
|
+
# = DESCRIPTION
|
|
28
|
+
#
|
|
29
|
+
# mx prints a domain's MX records, sorted by preference.
|
|
30
|
+
#
|
|
31
|
+
# = AUTHOR
|
|
32
|
+
#
|
|
33
|
+
# Michael Fuhr <mike@fuhr.org>
|
|
34
|
+
# (Ruby port AlexD, Nominet UK)
|
|
35
|
+
#
|
|
36
36
|
|
|
37
37
|
if ARGV.length == 1
|
|
38
38
|
dname = ARGV[0]
|
data/demo/rubydig.rb
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
#Copyright 2007 Nominet UK
|
|
3
|
-
#
|
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
#you may not use this file except in compliance with the License.
|
|
6
|
-
#You may obtain a copy of the License at
|
|
7
|
-
#
|
|
1
|
+
# --
|
|
2
|
+
# Copyright 2007 Nominet UK
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
#See the License for the specific language governing permissions and
|
|
14
|
-
#limitations under the License.
|
|
15
|
-
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
# ++
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
#rubydig - Ruby script to perform DNS queries
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
#
|
|
23
|
-
#rubydig [ @nameserver ] name [ type [ class ] ]
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
#Performs a DNS query on the given name. The record type
|
|
28
|
-
#and class can also be specified; if left blank they default
|
|
29
|
-
#to A and IN.
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
#Michael Fuhr <mike@fuhr.org>
|
|
34
|
-
#
|
|
17
|
+
# = NAME
|
|
18
|
+
#
|
|
19
|
+
# rubydig - Ruby script to perform DNS queries
|
|
20
|
+
#
|
|
21
|
+
# = SYNOPSIS
|
|
22
|
+
#
|
|
23
|
+
# rubydig [ @nameserver ] name [ type [ class ] ]
|
|
24
|
+
#
|
|
25
|
+
# = DESCRIPTION
|
|
26
|
+
#
|
|
27
|
+
# Performs a DNS query on the given name. The record type
|
|
28
|
+
# and class can also be specified; if left blank they default
|
|
29
|
+
# to A and IN.
|
|
30
|
+
#
|
|
31
|
+
# = AUTHOR
|
|
32
|
+
#
|
|
33
|
+
# Michael Fuhr <mike@fuhr.org>
|
|
34
|
+
#
|
|
35
35
|
|
|
36
36
|
require 'dnsruby'
|
|
37
37
|
include Dnsruby
|
|
38
38
|
|
|
39
39
|
res = Dnsruby::Resolver.new
|
|
40
40
|
zt=Dnsruby::ZoneTransfer.new
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
if (ARGV && (ARGV[0] =~ /^@/))
|
|
43
43
|
nameserver = ARGV.shift
|
|
44
44
|
if (nameserver == "@auth")
|
|
@@ -52,14 +52,14 @@ if (ARGV && (ARGV[0] =~ /^@/))
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
raise RuntimeError, "Usage: #{$0} [ \@nameserver ] name [ type [ class ] ]\n" unless (ARGV.length >= 1) && (ARGV.length <= 3)
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
name, type, klass = ARGV
|
|
57
57
|
type ||= "A"
|
|
58
58
|
klass ||= "IN"
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
if (type.upcase == "AXFR")
|
|
61
61
|
rrs = zt.transfer(name) # , klass)
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
if (rrs)
|
|
64
64
|
rrs.each do |rr|
|
|
65
65
|
print rr.to_s + "\n"
|
|
@@ -67,7 +67,7 @@ if (type.upcase == "AXFR")
|
|
|
67
67
|
else
|
|
68
68
|
raise RuntimeError, "zone transfer failed: ", res.errorstring, "\n"
|
|
69
69
|
end
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
else
|
|
72
72
|
|
|
73
73
|
# Dnsruby::TheLog.level=Logger::DEBUG
|