nesser 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/nesser.rb +1 -1
- data/lib/nesser/packets/constants.rb +1 -1
- data/lib/nesser/packets/packer.rb +1 -1
- data/lib/nesser/transaction.rb +38 -29
- 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: 268e527319ed6991bec2ba743f29b161cf759ef9
|
4
|
+
data.tar.gz: 451ee70bbc0032ff146f19eaff3ab97b4dbe400c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29782f61da9adf57d73bc80aa750459abb02a5f74b654410793b6bf5637240da703b88f08affd3d31b0015e940fd64f62126c0c1246064c7e0dcb9b1c41abbb0
|
7
|
+
data.tar.gz: af31ebdbce5c02e2f58a4804b4d400be0d0b9b52ebfdba45cf4e47590a2b433a1d7a44bf469f238de3eae3f6b0327bb6244fb4836ec64dd611446626cb6e5ba6
|
data/README.md
CHANGED
@@ -175,5 +175,8 @@ when necessary!
|
|
175
175
|
## Version history / changelog
|
176
176
|
|
177
177
|
* 0.0.1 - Test deploy
|
178
|
-
* 0.0.2 -
|
178
|
+
* 0.0.2 - Basically code complete
|
179
179
|
* 0.0.3 - First actual release
|
180
|
+
* 0.0.4
|
181
|
+
** Implement transaction.passthrough!()
|
182
|
+
** Fix a bug where numbers would cause a validation error in DNS names
|
data/lib/nesser.rb
CHANGED
@@ -39,7 +39,7 @@ module Nesser
|
|
39
39
|
private
|
40
40
|
def validate!(name)
|
41
41
|
if name.chars.detect { |ch| !LEGAL_CHARACTERS.include?(ch) }
|
42
|
-
raise(DnsException, "DNS name contains illegal characters")
|
42
|
+
raise(DnsException, "DNS name contains illegal characters: #{name}")
|
43
43
|
end
|
44
44
|
if name.length > 253
|
45
45
|
raise(DnsException, "DNS name can't be longer than 253 characters")
|
data/lib/nesser/transaction.rb
CHANGED
@@ -22,6 +22,8 @@
|
|
22
22
|
# complex and generally not needed.
|
23
23
|
##
|
24
24
|
|
25
|
+
require 'socket'
|
26
|
+
|
25
27
|
module Nesser
|
26
28
|
class Transaction
|
27
29
|
attr_reader :request, :sent
|
@@ -87,35 +89,42 @@ module Nesser
|
|
87
89
|
reply!()
|
88
90
|
end
|
89
91
|
|
90
|
-
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
#
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
92
|
+
##
|
93
|
+
# Send the request upstream.
|
94
|
+
#
|
95
|
+
# Note that this requires a socket, and that it can't be the same socket
|
96
|
+
# as the rest of the transaction (since we don't do any kind of
|
97
|
+
# multiplexing). If you don't specify a socket, one will be provided to
|
98
|
+
# you at no extra cost (financially, anyways).
|
99
|
+
##
|
100
|
+
public
|
101
|
+
def passthrough!(host:'8.8.8.8', port:53)
|
102
|
+
not_sent!()
|
103
|
+
|
104
|
+
# Get a local handle to the socket
|
105
|
+
s = @s
|
106
|
+
|
107
|
+
Thread.new() do
|
108
|
+
begin
|
109
|
+
response = Nesser.query(
|
110
|
+
s: s,
|
111
|
+
hostname: @request.questions[0].name,
|
112
|
+
server: host,
|
113
|
+
port: port,
|
114
|
+
type: @request.questions[0].type,
|
115
|
+
cls: @request.questions[0].cls,
|
116
|
+
)
|
117
|
+
|
118
|
+
if response.rcode != RCODE_SUCCESS
|
119
|
+
error!(response.rcode)
|
120
|
+
else
|
121
|
+
answer!(response.answers)
|
122
|
+
end
|
123
|
+
rescue StandardError
|
124
|
+
error!(RCODE_SERVER_FAILURE)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
119
128
|
|
120
129
|
##
|
121
130
|
# Reply with the response packet, in whatever state it's in. While this is
|
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.4
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|