nslookupot 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -9
- data/lib/nslookupot/cli.rb +28 -2
- data/lib/nslookupot/version.rb +1 -1
- data/spec/cli_spec.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c9de045df30e3e73273f0da9950c06e2e716ced7dee7fbbf55589c8c57067ee
|
4
|
+
data.tar.gz: ce164bc5a05df2681fd6afda4848262e4bcad328818a81941b53a4f777c6bc4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d836124c778fb60d8107d92ca53676af6e1a701881808894215ea435a7d3d33ad6138f260255c1b9bb202b25bef2588c97ed352e70a6f3739343d7ce098e7cd
|
7
|
+
data.tar.gz: acf065bdad8c0dfa20f7d6bb5a6a1efb6f040434baed88578f98fba07afeca222c5be540062f5650d7ba2349b3fdf054bb77435d1c636d270e4bf8f427b6512e
|
data/README.md
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
nslookupot is CLI that is `nslookup` over TLS (version 1.3 or 1.2).
|
8
8
|
|
9
|
+
- https://datatracker.ietf.org/doc/html/rfc7858
|
10
|
+
|
9
11
|
|
10
12
|
## Installation
|
11
13
|
|
@@ -26,17 +28,19 @@ Usage: nslookupot [options] name
|
|
26
28
|
-h, --hostname VALUE the name server hostname (default cloudflare-dns.com)
|
27
29
|
-n, --no-check-sni no check SNI (default false)
|
28
30
|
-t, --type VALUE the type of the information query (default A)
|
31
|
+
--types print the list of query types
|
29
32
|
```
|
30
33
|
|
31
34
|
You can run it the following:
|
32
35
|
|
33
36
|
```sh-session
|
34
37
|
$ nslookupot example.com
|
38
|
+
Server: 1.1.1.1
|
35
39
|
Address: 1.1.1.1#853
|
36
|
-
|
40
|
+
|
37
41
|
Name: example.com
|
38
42
|
Address: 93.184.216.34
|
39
|
-
Ttl:
|
43
|
+
Ttl: 83289
|
40
44
|
|
41
45
|
```
|
42
46
|
|
@@ -44,11 +48,12 @@ If you need to resolve other than A type, you can run it the following:
|
|
44
48
|
|
45
49
|
```sh-session
|
46
50
|
$ nslookupot --type=cname www.youtube.com
|
51
|
+
Server: 1.1.1.1
|
47
52
|
Address: 1.1.1.1#853
|
48
|
-
|
53
|
+
|
49
54
|
Name: www.youtube.com
|
50
55
|
Name: youtube-ui.l.google.com
|
51
|
-
Ttl:
|
56
|
+
Ttl: 86400
|
52
57
|
|
53
58
|
```
|
54
59
|
|
@@ -56,11 +61,12 @@ If you need to query to `8.8.8.8`, you can run it the following:
|
|
56
61
|
|
57
62
|
```sh-session
|
58
63
|
$ nslookupot --server=8.8.8.8 --port=853 --hostname=dns.google www.google.com
|
64
|
+
Server: 8.8.8.8
|
59
65
|
Address: 8.8.8.8#853
|
60
|
-
|
66
|
+
|
61
67
|
Name: www.google.com
|
62
|
-
Address:
|
63
|
-
Ttl:
|
68
|
+
Address: 142.250.196.132
|
69
|
+
Ttl: 175
|
64
70
|
|
65
71
|
```
|
66
72
|
|
@@ -68,14 +74,22 @@ If you need to query to `9.9.9.9`, you can run it the following:
|
|
68
74
|
|
69
75
|
```sh-session
|
70
76
|
$ nslookupot --server=9.9.9.9 --port=853 --hostname=quad9.net www.quad9.net
|
77
|
+
Server: 9.9.9.9
|
71
78
|
Address: 9.9.9.9#853
|
72
|
-
|
79
|
+
|
73
80
|
Name: www.quad9.net
|
74
81
|
Address: 216.21.3.77
|
75
|
-
Ttl:
|
82
|
+
Ttl: 100
|
76
83
|
|
77
84
|
```
|
78
85
|
|
86
|
+
Supported query types are:
|
87
|
+
|
88
|
+
```sh-session
|
89
|
+
$ nslookupot --types
|
90
|
+
** A, AAAA, CAA, CNAME, HINFO, HTTPS, LOC, MINFO, MX, NS, PTR, SOA, SRV, SVCB, TXT, WKS
|
91
|
+
```
|
92
|
+
|
79
93
|
|
80
94
|
## License
|
81
95
|
|
data/lib/nslookupot/cli.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'optparse'
|
4
4
|
|
5
5
|
module Nslookupot
|
6
|
+
# rubocop: disable Metrics/ClassLength
|
6
7
|
class CLI
|
7
8
|
# rubocop: disable Metrics/AbcSize
|
8
9
|
# rubocop: disable Metrics/MethodLength
|
@@ -17,6 +18,7 @@ module Nslookupot
|
|
17
18
|
check_sni: true
|
18
19
|
}
|
19
20
|
type = 'A'
|
21
|
+
print_types = false
|
20
22
|
|
21
23
|
op.on(
|
22
24
|
'-s',
|
@@ -58,15 +60,28 @@ module Nslookupot
|
|
58
60
|
type = v
|
59
61
|
end
|
60
62
|
|
63
|
+
op.on(
|
64
|
+
'',
|
65
|
+
'--types',
|
66
|
+
'print the list of query types'
|
67
|
+
) do |v|
|
68
|
+
print_types = v
|
69
|
+
end
|
70
|
+
|
61
71
|
op.banner += ' name'
|
62
72
|
begin
|
63
73
|
args = op.parse(argv)
|
64
|
-
rescue OptionParser::InvalidOption => e
|
74
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
65
75
|
warn op.to_s
|
66
76
|
warn "** #{e.message}"
|
67
77
|
exit 1
|
68
78
|
end
|
69
79
|
|
80
|
+
if print_types
|
81
|
+
warn "** #{types.sort.join(', ')}"
|
82
|
+
exit 1
|
83
|
+
end
|
84
|
+
|
70
85
|
begin
|
71
86
|
type = s2typeclass(type)
|
72
87
|
rescue NameError
|
@@ -92,6 +107,15 @@ module Nslookupot
|
|
92
107
|
rr
|
93
108
|
end
|
94
109
|
|
110
|
+
def types
|
111
|
+
Resolv::DNS::Resource::IN.constants.filter do |const|
|
112
|
+
c = Resolv::DNS::Resource::IN.const_get(const)
|
113
|
+
c < Resolv::DNS::Resource
|
114
|
+
rescue ArgumentError
|
115
|
+
false
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
95
119
|
# rubocop: disable Metrics/AbcSize
|
96
120
|
def run
|
97
121
|
opts, name, type = parse_options
|
@@ -116,7 +140,8 @@ module Nslookupot
|
|
116
140
|
result.each do |rr|
|
117
141
|
puts 'Name:'.ljust(16) + name
|
118
142
|
rr.instance_variables.each do |var|
|
119
|
-
k =
|
143
|
+
k = var.to_s.delete('@').split('_').map(&:capitalize).join
|
144
|
+
k = "#{k}:".ljust(16)
|
120
145
|
v = rr.instance_variable_get(var).to_s
|
121
146
|
puts k + v
|
122
147
|
end
|
@@ -125,4 +150,5 @@ module Nslookupot
|
|
125
150
|
end
|
126
151
|
# rubocop: enable Metrics/AbcSize
|
127
152
|
end
|
153
|
+
# rubocop: enable Metrics/ClassLength
|
128
154
|
end
|
data/lib/nslookupot/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative 'spec_helper'
|
4
4
|
|
5
|
+
# rubocop: disable Metrics/BlockLength
|
5
6
|
RSpec.describe Nslookupot::CLI do
|
6
7
|
context 'Resource Record (RR) TYPEs' do
|
7
8
|
let(:cli) do
|
@@ -21,6 +22,8 @@ RSpec.describe Nslookupot::CLI do
|
|
21
22
|
expect(cli.s2typeclass('TXT')).to eq Resolv::DNS::Resource::IN::TXT
|
22
23
|
expect(cli.s2typeclass('WKS')).to eq Resolv::DNS::Resource::IN::WKS
|
23
24
|
expect(cli.s2typeclass('CAA')).to eq Resolv::DNS::Resource::IN::CAA
|
25
|
+
expect(cli.s2typeclass('SVCB')).to eq Resolv::DNS::Resource::IN::SVCB
|
26
|
+
expect(cli.s2typeclass('HTTPS')).to eq Resolv::DNS::Resource::IN::HTTPS
|
24
27
|
end
|
25
28
|
|
26
29
|
it 'could raise NameError' do
|
@@ -30,3 +33,4 @@ RSpec.describe Nslookupot::CLI do
|
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
36
|
+
# rubocop: enable Metrics/BlockLength.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nslookupot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekuwayama
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
113
|
+
rubygems_version: 3.4.6
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: nslookup over TLS
|