nesser 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/lib/nesser/examples/client.rb +4 -0
- data/lib/nesser/packets/answer.rb +2 -0
- data/lib/nesser/packets/constants.rb +2 -0
- data/lib/nesser/packets/rr_types.rb +30 -2
- data/lib/nesser/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: dc1d02c1db20cd839649b20cd8d066c6060afddc
|
4
|
+
data.tar.gz: 79ac270b89167dfa2e095a7909cad9ea4b7c04b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a312b3dd971426587e3aeda68e0fe17a6437076b682e4d1910f41cb8a80656c7a95771c12471ce088c2c4111f56bf7e10fc86430c6effbd4f03376068bd9ccc4
|
7
|
+
data.tar.gz: 4371fb4c53dd8ce446b04eea6013527aa5572124763c387792395f54b922f20e01940bf3a8e5ef3cffafbdcc665ab9589889f7766be008465bab9e918046f4bc
|
data/README.md
CHANGED
@@ -174,9 +174,14 @@ when necessary!
|
|
174
174
|
|
175
175
|
## Version history / changelog
|
176
176
|
|
177
|
-
* 0.0.1
|
178
|
-
|
179
|
-
* 0.0.
|
177
|
+
* 0.0.1
|
178
|
+
** Test deploy
|
179
|
+
* 0.0.2
|
180
|
+
** Basically code complete
|
181
|
+
* 0.0.3
|
182
|
+
** First actual release
|
180
183
|
* 0.0.4
|
181
184
|
** Implement transaction.passthrough!()
|
182
185
|
** Fix a bug where numbers would cause a validation error in DNS names
|
186
|
+
* 0.0.5
|
187
|
+
** Implement PTR records (reverse lookups)
|
@@ -24,3 +24,7 @@ result = Nesser::Nesser.query(s: s, hostname: 'google.com', type: Nesser::TYPE_A
|
|
24
24
|
|
25
25
|
# Print the result
|
26
26
|
puts result
|
27
|
+
|
28
|
+
# Perform a reverse query for 8.8.4.4 and print the result
|
29
|
+
result = Nesser::Nesser.query(s: s, hostname: '4.4.8.8.in-addr.arpa', type: Nesser::TYPE_PTR)
|
30
|
+
puts result
|
@@ -71,6 +71,7 @@ module Nesser
|
|
71
71
|
TYPE_NS = 0x0002
|
72
72
|
TYPE_CNAME = 0x0005
|
73
73
|
TYPE_SOA = 0x0006
|
74
|
+
TYPE_PTR = 0x000c
|
74
75
|
TYPE_MX = 0x000f
|
75
76
|
TYPE_TXT = 0x0010
|
76
77
|
TYPE_AAAA = 0x001c
|
@@ -80,6 +81,7 @@ module Nesser
|
|
80
81
|
TYPE_NS => "NS",
|
81
82
|
TYPE_CNAME => "CNAME",
|
82
83
|
TYPE_SOA => "SOA",
|
84
|
+
TYPE_PTR => "PTR",
|
83
85
|
TYPE_MX => "MX",
|
84
86
|
TYPE_TXT => "TXT",
|
85
87
|
TYPE_AAAA => "AAAA",
|
@@ -78,7 +78,7 @@ module Nesser
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def self.unpack(unpacker)
|
81
|
-
# We don't really need the
|
81
|
+
# We don't really need the length for anything, so just discard it
|
82
82
|
unpacker.unpack('n')
|
83
83
|
|
84
84
|
return self.new(name: unpacker.unpack_name())
|
@@ -107,7 +107,7 @@ module Nesser
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def self.unpack(unpacker)
|
110
|
-
# We don't really need the
|
110
|
+
# We don't really need the length for anything, so just discard it
|
111
111
|
unpacker.unpack('n')
|
112
112
|
|
113
113
|
return self.new(name: unpacker.unpack_name())
|
@@ -177,6 +177,34 @@ module Nesser
|
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
180
|
+
##
|
181
|
+
# PTR record - ie, reverse DNS
|
182
|
+
##
|
183
|
+
class PTR
|
184
|
+
attr_accessor :name
|
185
|
+
|
186
|
+
def initialize(name:)
|
187
|
+
@name = name
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.unpack(unpacker)
|
191
|
+
# We don't really need the length for anything, so just discard it
|
192
|
+
unpacker.unpack('n')
|
193
|
+
|
194
|
+
return self.new(name: unpacker.unpack_name())
|
195
|
+
end
|
196
|
+
|
197
|
+
def pack(packer)
|
198
|
+
length = packer.pack_name(@name, dry_run: true)
|
199
|
+
packer.pack('n', length)
|
200
|
+
packer.pack_name(@name)
|
201
|
+
end
|
202
|
+
|
203
|
+
def to_s()
|
204
|
+
return "#{@name} [PTR]"
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
180
208
|
##
|
181
209
|
# Mail exchange record - eg, 'mail.google.com' 10.
|
182
210
|
##
|
data/lib/nesser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nesser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iagox86
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|