passivedns-client 2.1.12 → 3.0.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/CHANGELOG.md +43 -0
- data/README.md +80 -90
- data/bin/pdnstool +3 -1
- data/lib/passivedns/client/cli.rb +85 -110
- data/lib/passivedns/client/passivedb.rb +44 -9
- data/lib/passivedns/client/provider/circl.rb +54 -50
- data/lib/passivedns/client/provider/dnsdb.rb +65 -52
- data/lib/passivedns/client/provider/osc.rb +147 -0
- data/lib/passivedns/client/provider/passivetotal.rb +53 -49
- data/lib/passivedns/client/provider/virustotal.rb +68 -62
- data/lib/passivedns/client/state.rb +121 -130
- data/lib/passivedns/client/version.rb +3 -1
- data/lib/passivedns/client.rb +93 -91
- metadata +52 -49
- data/.gitignore +0 -18
- data/Gemfile +0 -4
- data/Rakefile +0 -20
- data/lib/passivedns/client/provider/bfk.rb +0 -109
- data/lib/passivedns/client/provider/cn360.rb +0 -122
- data/lib/passivedns/client/provider/mnemonic.rb +0 -112
- data/lib/passivedns/client/provider/riskiq.rb +0 -146
- data/lib/passivedns/client/provider/tcpiputils.rb +0 -129
- data/passivedns-client.gemspec +0 -31
- data/test/helper.rb +0 -6
- data/test/test_cli.rb +0 -234
- data/test/test_passivedns-client.rb +0 -262
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
unless Kernel.respond_to?(:require_relative)
|
|
2
|
-
module Kernel
|
|
3
|
-
def require_relative(path)
|
|
4
|
-
require File.join(File.dirname(caller[0]), path.to_str)
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
require_relative 'helper'
|
|
10
|
-
require 'configparser'
|
|
11
|
-
|
|
12
|
-
class TestPassiveDnsQuery < Minitest::Test
|
|
13
|
-
|
|
14
|
-
def setup
|
|
15
|
-
configfile="#{ENV['HOME']}/.passivedns-client"
|
|
16
|
-
@cp = ConfigParser.new(configfile)
|
|
17
|
-
@class_map = {}
|
|
18
|
-
PassiveDNS.constants.each do |const|
|
|
19
|
-
if PassiveDNS.const_get(const).is_a?(Class) and PassiveDNS.const_get(const).superclass == PassiveDNS::PassiveDB
|
|
20
|
-
@class_map[PassiveDNS.const_get(const).config_section_name] = PassiveDNS.const_get(const)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def test_instantiate_Nonexisting_Client
|
|
26
|
-
assert_raises RuntimeError do
|
|
27
|
-
PassiveDNS::Client.new(['doesnotexist'])
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_instantiate_All_Clients
|
|
32
|
-
PassiveDNS::Client.new()
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def test_instantiate_Passive_DNS_State
|
|
36
|
-
refute_nil(PassiveDNS::PDNSToolState.new)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def test_instantiate_Passive_DNS_State_database
|
|
40
|
-
if File.exist?("test/test.sqlite3")
|
|
41
|
-
File.unlink("test/test.sqlite3")
|
|
42
|
-
end
|
|
43
|
-
refute_nil(PassiveDNS::PDNSToolStateDB.new("test/test.sqlite3"))
|
|
44
|
-
if File.exist?("test/test.sqlite3")
|
|
45
|
-
File.unlink("test/test.sqlite3")
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def test_BFK
|
|
50
|
-
assert_raises RuntimeError do
|
|
51
|
-
PassiveDNS::Client.new(['bfk'])
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
assert_raises RuntimeError do
|
|
55
|
-
PassiveDNS::Provider::BFK.new(@cp['bfk'] || {})
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# refute_nil(d)
|
|
59
|
-
# rows = d.lookup("example.org",3)
|
|
60
|
-
# refute_nil(rows)
|
|
61
|
-
# refute_nil(rows.to_s)
|
|
62
|
-
# refute_nil(rows.to_xml)
|
|
63
|
-
# refute_nil(rows.to_json)
|
|
64
|
-
# refute_nil(rows.to_yaml)
|
|
65
|
-
# assert_equal(3, rows.length)
|
|
66
|
-
# rows = d.lookup("8.8.8.8")
|
|
67
|
-
# refute_nil(rows)
|
|
68
|
-
# refute_nil(rows.to_s)
|
|
69
|
-
# refute_nil(rows.to_xml)
|
|
70
|
-
# refute_nil(rows.to_json)
|
|
71
|
-
# refute_nil(rows.to_yaml)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def test_DNSDB
|
|
75
|
-
PassiveDNS::Client.new(['dnsdb'])
|
|
76
|
-
d = PassiveDNS::Provider::DNSDB.new(@cp['dnsdb'] || {})
|
|
77
|
-
refute_nil(d)
|
|
78
|
-
rows = d.lookup("example.org",3)
|
|
79
|
-
refute_nil(rows)
|
|
80
|
-
refute_nil(rows.to_s)
|
|
81
|
-
refute_nil(rows.to_xml)
|
|
82
|
-
refute_nil(rows.to_json)
|
|
83
|
-
refute_nil(rows.to_yaml)
|
|
84
|
-
assert_equal(3, rows.length) # this will fail since DNSDB has an off by one error
|
|
85
|
-
rows = d.lookup("8.8.8.8")
|
|
86
|
-
refute_nil(rows)
|
|
87
|
-
refute_nil(rows.to_s)
|
|
88
|
-
refute_nil(rows.to_xml)
|
|
89
|
-
refute_nil(rows.to_json)
|
|
90
|
-
refute_nil(rows.to_yaml)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def test_VirusTotal
|
|
94
|
-
PassiveDNS::Client.new(['virustotal'])
|
|
95
|
-
d = PassiveDNS::Provider::VirusTotal.new(@cp['virustotal'] || {})
|
|
96
|
-
refute_nil(d)
|
|
97
|
-
rows = d.lookup("google.com",3)
|
|
98
|
-
refute_nil(rows)
|
|
99
|
-
refute_nil(rows.to_s)
|
|
100
|
-
refute_nil(rows.to_xml)
|
|
101
|
-
refute_nil(rows.to_json)
|
|
102
|
-
refute_nil(rows.to_yaml)
|
|
103
|
-
assert_equal(3, rows.length)
|
|
104
|
-
rows = d.lookup("8.8.8.8")
|
|
105
|
-
refute_nil(rows)
|
|
106
|
-
refute_nil(rows.to_s)
|
|
107
|
-
refute_nil(rows.to_xml)
|
|
108
|
-
refute_nil(rows.to_json)
|
|
109
|
-
refute_nil(rows.to_yaml)
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def test_TCPIPUtils
|
|
113
|
-
PassiveDNS::Client.new(['tcpiputils'])
|
|
114
|
-
d = PassiveDNS::Provider::TCPIPUtils.new(@cp['tcpiputils'] || {})
|
|
115
|
-
refute_nil(d)
|
|
116
|
-
rows = d.lookup("example.org")
|
|
117
|
-
refute_nil(rows)
|
|
118
|
-
refute_nil(rows.to_s)
|
|
119
|
-
refute_nil(rows.to_xml)
|
|
120
|
-
refute_nil(rows.to_json)
|
|
121
|
-
refute_nil(rows.to_yaml)
|
|
122
|
-
rows = d.lookup("example.org",3)
|
|
123
|
-
refute_nil(rows)
|
|
124
|
-
refute_nil(rows.to_s)
|
|
125
|
-
refute_nil(rows.to_xml)
|
|
126
|
-
refute_nil(rows.to_json)
|
|
127
|
-
refute_nil(rows.to_yaml)
|
|
128
|
-
assert_equal(3, rows.length)
|
|
129
|
-
rows = d.lookup("8.8.8.8")
|
|
130
|
-
refute_nil(rows)
|
|
131
|
-
refute_nil(rows.to_s)
|
|
132
|
-
refute_nil(rows.to_xml)
|
|
133
|
-
refute_nil(rows.to_json)
|
|
134
|
-
refute_nil(rows.to_yaml)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
def test_cn360
|
|
138
|
-
PassiveDNS::Client.new(['cn360'])
|
|
139
|
-
d = PassiveDNS::Provider::CN360.new(@cp['cn360'] || {})
|
|
140
|
-
refute_nil(d)
|
|
141
|
-
rows = d.lookup("example.org")
|
|
142
|
-
refute_nil(rows)
|
|
143
|
-
refute_nil(rows.to_s)
|
|
144
|
-
refute_nil(rows.to_xml)
|
|
145
|
-
refute_nil(rows.to_json)
|
|
146
|
-
refute_nil(rows.to_yaml)
|
|
147
|
-
rows = d.lookup("example.org",3)
|
|
148
|
-
refute_nil(rows)
|
|
149
|
-
refute_nil(rows.to_s)
|
|
150
|
-
refute_nil(rows.to_xml)
|
|
151
|
-
refute_nil(rows.to_json)
|
|
152
|
-
refute_nil(rows.to_yaml)
|
|
153
|
-
assert_equal(3, rows.length)
|
|
154
|
-
rows = d.lookup("8.8.8.8")
|
|
155
|
-
refute_nil(rows)
|
|
156
|
-
refute_nil(rows.to_s)
|
|
157
|
-
refute_nil(rows.to_xml)
|
|
158
|
-
refute_nil(rows.to_json)
|
|
159
|
-
refute_nil(rows.to_yaml)
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
def test_nmemonic
|
|
163
|
-
PassiveDNS::Client.new(['mnemonic'])
|
|
164
|
-
d = PassiveDNS::Provider::Mnemonic.new(@cp['mnemonic'] || {})
|
|
165
|
-
refute_nil(d)
|
|
166
|
-
rows = d.lookup("example.org")
|
|
167
|
-
refute_nil(rows)
|
|
168
|
-
refute_nil(rows.to_s)
|
|
169
|
-
refute_nil(rows.to_xml)
|
|
170
|
-
refute_nil(rows.to_json)
|
|
171
|
-
refute_nil(rows.to_yaml)
|
|
172
|
-
rows = d.lookup("example.org",3)
|
|
173
|
-
refute_nil(rows)
|
|
174
|
-
refute_nil(rows.to_s)
|
|
175
|
-
refute_nil(rows.to_xml)
|
|
176
|
-
refute_nil(rows.to_json)
|
|
177
|
-
refute_nil(rows.to_yaml)
|
|
178
|
-
assert_equal(3, rows.length)
|
|
179
|
-
rows = d.lookup("8.8.8.8")
|
|
180
|
-
refute_nil(rows)
|
|
181
|
-
refute_nil(rows.to_s)
|
|
182
|
-
refute_nil(rows.to_xml)
|
|
183
|
-
refute_nil(rows.to_json)
|
|
184
|
-
refute_nil(rows.to_yaml)
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
def test_passivetotal
|
|
188
|
-
PassiveDNS::Client.new(['passivetotal'])
|
|
189
|
-
d = PassiveDNS::Provider::PassiveTotal.new(@cp['passivetotal'] || {})
|
|
190
|
-
refute_nil(d)
|
|
191
|
-
rows = d.lookup("example.org")
|
|
192
|
-
refute_nil(rows)
|
|
193
|
-
refute_nil(rows.to_s)
|
|
194
|
-
refute_nil(rows.to_xml)
|
|
195
|
-
refute_nil(rows.to_json)
|
|
196
|
-
refute_nil(rows.to_yaml)
|
|
197
|
-
rows = d.lookup("example.org", 3)
|
|
198
|
-
refute_nil(rows)
|
|
199
|
-
refute_nil(rows.to_s)
|
|
200
|
-
refute_nil(rows.to_xml)
|
|
201
|
-
refute_nil(rows.to_json)
|
|
202
|
-
refute_nil(rows.to_yaml)
|
|
203
|
-
puts(rows)
|
|
204
|
-
assert_equal(3, rows.length)
|
|
205
|
-
rows = d.lookup("8.8.8.8")
|
|
206
|
-
refute_nil(rows)
|
|
207
|
-
refute_nil(rows.to_s)
|
|
208
|
-
refute_nil(rows.to_xml)
|
|
209
|
-
refute_nil(rows.to_json)
|
|
210
|
-
refute_nil(rows.to_yaml)
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
def test_circl
|
|
214
|
-
PassiveDNS::Client.new(['circl'])
|
|
215
|
-
d = PassiveDNS::Provider::CIRCL.new(@cp['circl'] || {})
|
|
216
|
-
refute_nil(d)
|
|
217
|
-
rows = d.lookup("example.org")
|
|
218
|
-
refute_nil(rows)
|
|
219
|
-
refute_nil(rows.to_s)
|
|
220
|
-
refute_nil(rows.to_xml)
|
|
221
|
-
refute_nil(rows.to_json)
|
|
222
|
-
refute_nil(rows.to_yaml)
|
|
223
|
-
rows = d.lookup("example.org",3)
|
|
224
|
-
refute_nil(rows)
|
|
225
|
-
refute_nil(rows.to_s)
|
|
226
|
-
refute_nil(rows.to_xml)
|
|
227
|
-
refute_nil(rows.to_json)
|
|
228
|
-
refute_nil(rows.to_yaml)
|
|
229
|
-
assert_equal(3, rows.length)
|
|
230
|
-
rows = d.lookup("8.8.8.8")
|
|
231
|
-
refute_nil(rows)
|
|
232
|
-
refute_nil(rows.to_s)
|
|
233
|
-
refute_nil(rows.to_xml)
|
|
234
|
-
refute_nil(rows.to_json)
|
|
235
|
-
refute_nil(rows.to_yaml)
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
def test_riskiq
|
|
239
|
-
PassiveDNS::Client.new(['riskiq'])
|
|
240
|
-
d = PassiveDNS::Provider::RiskIQ.new(@cp['riskiq'] || {})
|
|
241
|
-
refute_nil(d)
|
|
242
|
-
rows = d.lookup("example.org")
|
|
243
|
-
refute_nil(rows)
|
|
244
|
-
refute_nil(rows.to_s)
|
|
245
|
-
refute_nil(rows.to_xml)
|
|
246
|
-
refute_nil(rows.to_json)
|
|
247
|
-
refute_nil(rows.to_yaml)
|
|
248
|
-
rows = d.lookup("example.org",3)
|
|
249
|
-
refute_nil(rows)
|
|
250
|
-
refute_nil(rows.to_s)
|
|
251
|
-
refute_nil(rows.to_xml)
|
|
252
|
-
refute_nil(rows.to_json)
|
|
253
|
-
refute_nil(rows.to_yaml)
|
|
254
|
-
assert_equal(3, rows.length)
|
|
255
|
-
rows = d.lookup("8.8.8.8")
|
|
256
|
-
refute_nil(rows)
|
|
257
|
-
refute_nil(rows.to_s)
|
|
258
|
-
refute_nil(rows.to_xml)
|
|
259
|
-
refute_nil(rows.to_json)
|
|
260
|
-
refute_nil(rows.to_yaml)
|
|
261
|
-
end
|
|
262
|
-
end
|