passivedns-client 2.1.8 → 2.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/passivedns/client.rb +3 -1
- data/lib/passivedns/client/cli.rb +6 -3
- data/lib/passivedns/client/provider/bfk.rb +1 -0
- data/lib/passivedns/client/version.rb +1 -1
- data/test/test_cli.rb +23 -1
- data/test/test_passivedns-client.rb +22 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2b6b0dc4227f010b9fc53b01f2307f49b405db80
|
4
|
+
data.tar.gz: 1e3b0abb99ceddee325ee4245f9924500127089d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d638e8dba5e9af5476c626dca055925c702bd41c3b836ba876d914d8d2e609a9ed042983da8987b0d1ae7af41316c1ad5d3a4f559f5db2bf694a96d2bae06547
|
7
|
+
data.tar.gz: 22b0c684739e932b646f2bd7a508f9e8a53c4c2ff8ba69c5623f36a51d7d4931f83d317dcc2fbab9df3b8944f84101c854596c32a6c07486adaaad445404c028
|
data/lib/passivedns/client.rb
CHANGED
@@ -12,7 +12,9 @@ provider_path = File.dirname(__FILE__)+"/client/provider/*.rb"
|
|
12
12
|
Dir.glob(provider_path).each do |provider|
|
13
13
|
name = File.basename(provider, '.rb')
|
14
14
|
require "passivedns/client/provider/#{name}.rb"
|
15
|
-
|
15
|
+
if name != 'bfk'
|
16
|
+
$passivedns_providers << name
|
17
|
+
end
|
16
18
|
end
|
17
19
|
|
18
20
|
require 'configparser'
|
@@ -58,7 +58,8 @@ module PassiveDNS # :nodoc:
|
|
58
58
|
[ '--sqlite3', '-f', GetoptLong::REQUIRED_ARGUMENT ],
|
59
59
|
[ '--recurse', '-r', GetoptLong::REQUIRED_ARGUMENT ],
|
60
60
|
[ '--wait', '-w', GetoptLong::REQUIRED_ARGUMENT ],
|
61
|
-
[ '--limit', '-l', GetoptLong::REQUIRED_ARGUMENT ]
|
61
|
+
[ '--limit', '-l', GetoptLong::REQUIRED_ARGUMENT ],
|
62
|
+
[ '--config', GetoptLong::REQUIRED_ARGUMENT ]
|
62
63
|
)
|
63
64
|
|
64
65
|
letter_map = get_letter_map
|
@@ -121,6 +122,8 @@ module PassiveDNS # :nodoc:
|
|
121
122
|
options[:sqlitedb] = arg
|
122
123
|
when '--limit'
|
123
124
|
options[:limit] = arg.to_i
|
125
|
+
when '--config'
|
126
|
+
options[:configfile] = arg
|
124
127
|
else
|
125
128
|
options[:help] = true
|
126
129
|
end
|
@@ -158,7 +161,7 @@ module PassiveDNS # :nodoc:
|
|
158
161
|
def self.usage(letter_map)
|
159
162
|
databases = letter_map.keys.sort.join("")
|
160
163
|
help_text = ""
|
161
|
-
help_text << "Usage: #{$0} [-d [#{databases}]] [-g|-v|-m|-c|-x|-y|-j|-t] [-os <sep>] [-f <file>] [-r#|-w#|-v] [-l <count>] <ip|domain|cidr>\n"
|
164
|
+
help_text << "Usage: #{$0} [-d [#{databases}]] [-g|-v|-m|-c|-x|-y|-j|-t] [-os <sep>] [-f <file>] [-r#|-w#|-v] [-l <count>] [--config <file>] <ip|domain|cidr>\n"
|
162
165
|
help_text << "Passive DNS Providers\n"
|
163
166
|
help_text << " -d#{databases} uses all of the available passive dns database\n"
|
164
167
|
letter_map.keys.sort.each do |l|
|
@@ -264,7 +267,7 @@ module PassiveDNS # :nodoc:
|
|
264
267
|
state = create_state(options[:sqlitedb])
|
265
268
|
state.debug = options[:debug]
|
266
269
|
|
267
|
-
pdnsclient = PassiveDNS::Client.new(options[:pdnsdbs])
|
270
|
+
pdnsclient = PassiveDNS::Client.new(options[:pdnsdbs], options[:configfile])
|
268
271
|
pdnsclient.debug = options[:debug]
|
269
272
|
|
270
273
|
if items.length > 0
|
@@ -37,6 +37,7 @@ module PassiveDNS #:nodoc: don't document this
|
|
37
37
|
def initialize(options={})
|
38
38
|
@debug = options[:debug] || false
|
39
39
|
@base = options["URL"] || "http://www.bfk.de/bfk_dnslogger.html?query="
|
40
|
+
raise "Due to the EU GDPR policy, this service has been shut down until further notice."
|
40
41
|
end
|
41
42
|
|
42
43
|
# Takes a label (either a domain or an IP address) and returns
|
data/test/test_cli.rb
CHANGED
@@ -20,7 +20,7 @@ class TestCLI < Minitest::Test
|
|
20
20
|
helptext = PassiveDNS::CLI.run(["--help"])
|
21
21
|
helptext.gsub!(/Usage: .*?\[/, "Usage: [")
|
22
22
|
assert_equal(
|
23
|
-
"Usage: [-d [3bcdmprtv]] [-g|-v|-m|-c|-x|-y|-j|-t] [-os <sep>] [-f <file>] [-r#|-w#|-v] [-l <count>] <ip|domain|cidr>
|
23
|
+
"Usage: [-d [3bcdmprtv]] [-g|-v|-m|-c|-x|-y|-j|-t] [-os <sep>] [-f <file>] [-r#|-w#|-v] [-l <count>] [--config <file>] <ip|domain|cidr>
|
24
24
|
Passive DNS Providers
|
25
25
|
-d3bcdmprtv uses all of the available passive dns database
|
26
26
|
-d3 use 360.cn
|
@@ -202,4 +202,26 @@ Getting Help
|
|
202
202
|
assert_equal(options_target, options)
|
203
203
|
assert_equal(["8.8.8.8"], items)
|
204
204
|
end
|
205
|
+
|
206
|
+
def test_configuration_file
|
207
|
+
options_target = {
|
208
|
+
:pdnsdbs => ["bfk"],
|
209
|
+
:format => "text",
|
210
|
+
:sep => "\t",
|
211
|
+
:recursedepth => 1,
|
212
|
+
:wait => 0,
|
213
|
+
:res => nil,
|
214
|
+
:debug => false,
|
215
|
+
:sqlitedb => nil,
|
216
|
+
:limit => nil,
|
217
|
+
:help => false,
|
218
|
+
:configfile => ".passivedns-client"
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
options, items = PassiveDNS::CLI.parse_command_line(["--config", ".passivedns-client"])
|
223
|
+
assert_equal(options_target, options)
|
224
|
+
assert_equal([], items)
|
225
|
+
|
226
|
+
end
|
205
227
|
end
|
@@ -47,22 +47,28 @@ class TestPassiveDnsQuery < Minitest::Test
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_BFK
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
refute_nil(rows)
|
62
|
-
refute_nil(rows.
|
63
|
-
refute_nil(rows.
|
64
|
-
refute_nil(rows.
|
65
|
-
|
50
|
+
assert_raises RuntimeError do
|
51
|
+
PassiveDNS::Client.new(['bfk'])
|
52
|
+
end
|
53
|
+
|
54
|
+
assert_raises RuntimeError do
|
55
|
+
d = 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)
|
66
72
|
end
|
67
73
|
|
68
74
|
def test_DNSDB
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passivedns-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrislee35
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02
|
11
|
+
date: 2018-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.4.6
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Query passive DNS databases
|