opendns-dnsdb 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -2
- data/docs/index.rst +18 -3
- data/lib/opendns-dnsdb/dnsdb.rb +4 -3
- data/lib/opendns-dnsdb/dnsdb/related.rb +5 -3
- data/lib/opendns-dnsdb/version.rb +1 -1
- data/spec/spec_helper.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: b6ffc6fbdbd3300935d4bbedcfa0a9c6fabb2c2d
|
4
|
+
data.tar.gz: 5636e568eee7c925f5b2a2713f5394df5a3a4ce3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e0e80f6dba1e3445af8f10d8a8a46c3368a3e015624279d98bdd9902f49bd4c1f210640ec8a91ba384f4b773a9b99c8d378d0ff4a94c10aee355d25c2e0e21a
|
7
|
+
data.tar.gz: 70985d6a478bf5248520c316ec6b51642133fce350f4b51357b9c17804f39fc93a374c3b48d3affed9668fa85fb392c626dda626947b571a5f25593d6fd5ffec
|
data/README.md
CHANGED
@@ -12,14 +12,15 @@ building classifiers and reputation systems.
|
|
12
12
|
Documentation
|
13
13
|
-------------
|
14
14
|
|
15
|
-
[Click here to read the full documentation of the
|
15
|
+
[Click here to read the full documentation of the Security Graph library](http://opendns-dnsdb-client-for-ruby.readthedocs.org/en/latest/).
|
16
16
|
|
17
17
|
Example
|
18
18
|
-------
|
19
19
|
|
20
20
|
```ruby
|
21
21
|
# Setup
|
22
|
-
db = OpenDNS::DNSDB.new(sslcert: 'client.
|
22
|
+
db = OpenDNS::DNSDB.new(sslcert: 'client.pem',
|
23
|
+
sslcerttype: 'pem', sslcertpasswd: 'opendns')
|
23
24
|
|
24
25
|
# A short list of known spam domains using a fast-flux infrastructure
|
25
26
|
spam_names = ['com-garciniac.net', 'bbc-global.co.uk', 'com-october.net']
|
@@ -62,3 +63,19 @@ traffic = db.high_pass_filter(traffic, cutoff: 10)
|
|
62
63
|
traffic_is_suspicious =
|
63
64
|
db.relative_standard_deviation(traffic['www.github.io']) > 90
|
64
65
|
```
|
66
|
+
|
67
|
+
Note on certificates format
|
68
|
+
---------------------------
|
69
|
+
|
70
|
+
The curl library currently has some major issues dealing with
|
71
|
+
certificates stored in the PKCS12 format.
|
72
|
+
|
73
|
+
If the certificate you have been given is in PKCS12 format (`.p12`
|
74
|
+
file extension), just convert it to a `.pem` certificate file:
|
75
|
+
|
76
|
+
openssl pkcs12 -in client.p12 -out client.pem -clcerts
|
77
|
+
|
78
|
+
And supply the path to the `.pem` file to the library.
|
79
|
+
|
80
|
+
Also make sure that the version of the curl library you are using is
|
81
|
+
up-to-date. Old versions had major bugs with concurrent queries.
|
data/docs/index.rst
CHANGED
@@ -9,7 +9,7 @@ Installation
|
|
9
9
|
|
10
10
|
.. code-block:: bash
|
11
11
|
|
12
|
-
$
|
12
|
+
$ gem install opendns-dnsdb
|
13
13
|
|
14
14
|
Example
|
15
15
|
=======
|
@@ -78,16 +78,31 @@ Setup
|
|
78
78
|
.. code-block:: ruby
|
79
79
|
|
80
80
|
require 'opendns-dnsdb'
|
81
|
-
db = OpenDNS::DNSDB.new(sslcert: 'client.
|
81
|
+
db = OpenDNS::DNSDB.new(sslcert: 'client.pem', sslcertpasswd: 'opendns')
|
82
82
|
|
83
83
|
Supported options:
|
84
84
|
|
85
85
|
* ``timeout``: timeout for each query, in seconds (default: 15 seconds)
|
86
86
|
* ``sslcert``: path to the SSL certificate
|
87
|
-
* ``sslcerttype``: SSL certificate type, defaults to ``
|
87
|
+
* ``sslcerttype``: SSL certificate type, defaults to ``pem``.
|
88
88
|
* ``sslcertpasswd``: SSL certificate password
|
89
89
|
* ``maxconnects``: max number of parallel operations (default: 10)
|
90
90
|
|
91
|
+
Note on certificates format
|
92
|
+
===========================
|
93
|
+
|
94
|
+
The curl library currently has some major issues dealing with
|
95
|
+
certificates stored in the PKCS12 format.
|
96
|
+
|
97
|
+
If the certificate you have been given is in PKCS12 format (`.p12`
|
98
|
+
file extension), just convert it to a `.pem` certificate file:
|
99
|
+
|
100
|
+
.. code-block:: bash
|
101
|
+
|
102
|
+
openssl pkcs12 -in client.p12 -out client.pem -clcerts
|
103
|
+
|
104
|
+
And supply the path to the ``.pem`` file to the library.
|
105
|
+
|
91
106
|
Operations
|
92
107
|
==========
|
93
108
|
|
data/lib/opendns-dnsdb/dnsdb.rb
CHANGED
@@ -37,14 +37,15 @@ module OpenDNS
|
|
37
37
|
@timeout = params[:timeout].to_f if params[:timeout]
|
38
38
|
@maxconnects = DEFAULT_MAXCONNECTS
|
39
39
|
@maxconnects = params[:maxconnects].to_i if params[:maxconnects]
|
40
|
-
@sslcerttype = params[:sslcerttype] || '
|
41
|
-
@sslcertpasswd = params[:sslcertpasswd] || ''
|
40
|
+
@sslcerttype = params[:sslcerttype] || 'pem'
|
41
|
+
@sslcertpasswd = params[:sslcertpasswd] || 'opendns'
|
42
42
|
@options = {
|
43
43
|
followlocation: true,
|
44
44
|
timeout: @timeout,
|
45
45
|
sslcert: @sslcert,
|
46
46
|
sslcerttype: @sslcerttype,
|
47
|
-
sslcertpasswd: @sslcertpasswd
|
47
|
+
sslcertpasswd: @sslcertpasswd,
|
48
|
+
maxconnects: @maxconnects
|
48
49
|
}
|
49
50
|
end
|
50
51
|
|
@@ -76,13 +76,15 @@ module OpenDNS
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def distinct_related_names(names, options = { }, &filter)
|
79
|
-
|
80
|
-
res =
|
79
|
+
names = [ names ] unless names.kind_of?(Enumerable)
|
80
|
+
res = Response::Distinct.new(distinct_rrs(related_names(names, &filter))) - names
|
81
|
+
return res[0...options[:max_names]] if options[:max_names] && res.length >= options[:max_names]
|
81
82
|
if (options[:max_depth] || 1) > 1
|
82
83
|
options0 = options.clone
|
83
84
|
options0[:max_depth] -= 1
|
84
85
|
related = distinct_related_names(res, options0, &filter)
|
85
|
-
res
|
86
|
+
res += related - names
|
87
|
+
res.uniq!
|
86
88
|
res = res[0...options[:max_names]] if options[:max_names]
|
87
89
|
end
|
88
90
|
res
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opendns-dnsdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Denis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|