passivedns-client 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -22
- data/lib/passivedns/client/cli.rb +1 -0
- data/lib/passivedns/client/{bfk.rb → providers/bfk.rb} +0 -1
- data/lib/passivedns/client/{circl.rb → providers/circl.rb} +1 -2
- data/lib/passivedns/client/{cn360.rb → providers/cn360.rb} +0 -1
- data/lib/passivedns/client/{dnsdb.rb → providers/dnsdb.rb} +0 -1
- data/lib/passivedns/client/{mnemonic.rb → providers/mnemonic.rb} +0 -0
- data/lib/passivedns/client/{passivetotal.rb → providers/passivetotal.rb} +0 -0
- data/lib/passivedns/client/{tcpiputils.rb → providers/tcpiputils.rb} +0 -0
- data/lib/passivedns/client/{virustotal.rb → providers/virustotal.rb} +0 -0
- data/lib/passivedns/client/version.rb +1 -1
- data/lib/passivedns/client.rb +9 -10
- data/test/test_passivedns-client.rb +0 -19
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47032e96af18547a42a6f394a674c15d304bdb90
|
4
|
+
data.tar.gz: 9ac2529bfa59e287053789922bca5075d094e689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6365b198cdfe54f1f2dfedbbead44141e9b4d810370a7dce786131006e06f120b47b41c72b430527ff27c0391098c71fe2a87a3185d993205471cd1036ebad90
|
7
|
+
data.tar.gz: b8cbf892878c90cb0bbe7bbf29d24ebf7f0512bfa7721bc4cfbec674268b42cc50423af4a4d39b3800fa8639870f8b2435a23b18b58b01fb01a51c63bc5a9ad6
|
data/README.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# PassiveDNS::Client
|
2
2
|
|
3
|
-
This rubygem queries
|
3
|
+
This rubygem queries the following Passive DNS databases:
|
4
|
+
|
5
|
+
* BFK.de
|
6
|
+
* CIRCL
|
7
|
+
* DNSDB (FarSight)
|
8
|
+
* Mnemonic
|
9
|
+
* PassiveDNS.cn (Qihoo 360 Technology Co.,Ltd)
|
10
|
+
* PassiveTotal
|
11
|
+
* TCPIPUtils
|
12
|
+
* VirusTotal
|
13
|
+
|
4
14
|
Passive DNS is a technique where IP to hostname mappings are made by recording the answers of other people's queries.
|
5
15
|
|
6
16
|
There is a tool included, pdnstool, that wraps a lot of the functionality that you would need.
|
@@ -39,13 +49,24 @@ From version 2.0.0 on, all configuration keys for passive DNS providers are in o
|
|
39
49
|
APIKEY = 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
40
50
|
[mnemonic]
|
41
51
|
APIKEY = 01234567890abcdef01234567890abcdef012345
|
52
|
+
[passivetotal]
|
53
|
+
APIKEY = 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
54
|
+
[CIRCL]
|
55
|
+
USERNAME = circl_user
|
56
|
+
PASSWORD = circl_pass
|
57
|
+
|
58
|
+
CIRCL also can use and authorization token. In that case, you should drop the USERNAME and PASSWORD options and change the section to something like the following:
|
59
|
+
|
60
|
+
[CIRCL]
|
61
|
+
AUTH_TOKEN = 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
42
62
|
|
43
63
|
## Getting Access
|
44
64
|
* 360.cn : http://www.passivedns.cn
|
45
65
|
* BFK.de : No registration required, but please, please ready their usage policy at http://www.bfk.de/bfk_dnslogger.html
|
46
|
-
*
|
66
|
+
* CIRCL : https://www.circl.lu/services/passive-dns/
|
47
67
|
* DNSDB (Farsight Security) : https://api.dnsdb.info/
|
48
68
|
* Mnemonic : mss .at. mnemonic.no
|
69
|
+
* PassiveTotal : https://www.passivetotal.org
|
49
70
|
* TCPIPUtils : http://www.tcpiputils.com/premium-access
|
50
71
|
* VirusTotal : https://www.virustotal.com
|
51
72
|
|
@@ -56,34 +77,40 @@ From version 2.0.0 on, all configuration keys for passive DNS providers are in o
|
|
56
77
|
c = PassiveDNS::Client.new(['bfk','dnsdb']) # providers: bfk, tcpiputils, certee, dnsdb, virustotal, passivedns.cn, mnemonic
|
57
78
|
results = c.query("example.com")
|
58
79
|
|
59
|
-
Or use the included tool!
|
60
80
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
-
|
66
|
-
-
|
81
|
+
Or use the included tool...
|
82
|
+
|
83
|
+
Usage: bin/pdnstool [-d [3bcdmptv]] [-g|-v|-m|-c|-x|-y|-j|-t] [-os <sep>] [-f <file>] [-r#|-w#|-v] [-l <count>] <ip|domain|cidr>
|
84
|
+
Passive DNS Providers -d3bcdmptv uses all of the available passive dns database
|
85
|
+
-d3 use 360.cn
|
86
|
+
-db use BFK.de
|
87
|
+
-dc use CIRCL
|
88
|
+
-dd use DNSDB
|
89
|
+
-dm use Mnemonic
|
90
|
+
-dp use PassiveTotal
|
67
91
|
-dt use TCPIPUtils
|
68
|
-
-
|
69
|
-
-dm uses Mnemonic (passivedns.mnemonic.no)
|
92
|
+
-dv use VirusTotal
|
70
93
|
-dvt uses VirusTotal and TCPIPUtils (for example)
|
71
|
-
|
72
|
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
94
|
+
|
95
|
+
Output Formatting
|
96
|
+
-g link-nodal GDF visualization definition
|
97
|
+
-v link-nodal graphviz visualization definition
|
98
|
+
-m link-nodal graphml visualization definition
|
99
|
+
-c CSV
|
100
|
+
-x XML
|
101
|
+
-y YAML
|
102
|
+
-j JSON
|
103
|
+
-t ASCII text (default)
|
80
104
|
-s <sep> specifies a field separator for text output, default is tab
|
81
|
-
|
105
|
+
|
106
|
+
State and Recusion
|
82
107
|
-f[file] specifies a sqlite3 database used to read the current state - useful for large result sets and generating graphs of previous runs.
|
83
108
|
-r# specifies the levels of recursion to pull. **WARNING** This is quite taxing on the pDNS servers, so use judiciously (never more than 3 or so) or find yourself blocked!
|
84
109
|
-w# specifies the amount of time to wait, in seconds, between queries (Default: 0)
|
85
|
-
-v outputs debugging information
|
86
110
|
-l <count> limits the number of records returned per passive dns database queried.
|
111
|
+
|
112
|
+
Getting Help
|
113
|
+
-v debugging information
|
87
114
|
|
88
115
|
## Writing Your Own Database Adaptor
|
89
116
|
|
@@ -156,6 +156,7 @@ module PassiveDNS
|
|
156
156
|
help_text << " -l <count> limits the number of records returned per passive dns database queried.\n"
|
157
157
|
help_text << "\n"
|
158
158
|
help_text << "Getting Help\n"
|
159
|
+
help_text << " -h hello there. This option produces this helpful help information on how to access help.\n"
|
159
160
|
help_text << " -v debugging information\n"
|
160
161
|
|
161
162
|
help_text
|
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'net/https'
|
5
5
|
require 'openssl'
|
6
|
-
require 'pp'
|
7
6
|
|
8
7
|
module PassiveDNS
|
9
8
|
class Circl < PassiveDB
|
@@ -22,7 +21,7 @@ module PassiveDNS
|
|
22
21
|
|
23
22
|
attr_accessor :debug
|
24
23
|
def initialize(options={})
|
25
|
-
@debug = options[:debug] ||
|
24
|
+
@debug = options[:debug] || false
|
26
25
|
@username = options["USERNAME"]
|
27
26
|
@password = options["PASSWORD"]
|
28
27
|
@auth_token = options["AUTH_TOKEN"]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/passivedns/client.rb
CHANGED
@@ -6,24 +6,23 @@ require "passivedns/client/version"
|
|
6
6
|
require 'passivedns/client/state'
|
7
7
|
require 'passivedns/client/passivedb'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
require
|
15
|
-
|
16
|
-
|
9
|
+
# load all the providers
|
10
|
+
$passivedns_providers = Array.new
|
11
|
+
provider_path = File.dirname(__FILE__)+"/client/providers/*.rb"
|
12
|
+
Dir.glob(provider_path).each do |provider|
|
13
|
+
name = File.basename(provider, '.rb')
|
14
|
+
require "passivedns/client/providers/#{name}.rb"
|
15
|
+
$passivedns_providers << name
|
16
|
+
end
|
17
17
|
|
18
18
|
require 'configparser'
|
19
|
-
require 'pp'
|
20
19
|
|
21
20
|
module PassiveDNS
|
22
21
|
|
23
22
|
class PDNSResult < Struct.new(:source, :response_time, :query, :answer, :rrtype, :ttl, :firstseen, :lastseen, :count); end
|
24
23
|
|
25
24
|
class Client
|
26
|
-
def initialize(pdns
|
25
|
+
def initialize(pdns=$passivedns_providers, configfile="#{ENV['HOME']}/.passivedns-client")
|
27
26
|
cp = ConfigParser.new(configfile)
|
28
27
|
# this creates a map of all the PassiveDNS provider names and their classes
|
29
28
|
class_map = {}
|
@@ -65,25 +65,6 @@ class TestPassiveDnsQuery < Minitest::Test
|
|
65
65
|
refute_nil(rows.to_yaml)
|
66
66
|
end
|
67
67
|
|
68
|
-
def test_CERTEE
|
69
|
-
PassiveDNS::Client.new(['certee'])
|
70
|
-
d = PassiveDNS::CERTEE.new(@cp['certee'] || {})
|
71
|
-
refute_nil(d)
|
72
|
-
rows = d.lookup("sim.cert.ee",3)
|
73
|
-
refute_nil(rows)
|
74
|
-
refute_nil(rows.to_s)
|
75
|
-
refute_nil(rows.to_xml)
|
76
|
-
refute_nil(rows.to_json)
|
77
|
-
refute_nil(rows.to_yaml)
|
78
|
-
assert_equal(3, rows.length)
|
79
|
-
rows = d.lookup("8.8.8.8")
|
80
|
-
refute_nil(rows)
|
81
|
-
refute_nil(rows.to_s)
|
82
|
-
refute_nil(rows.to_xml)
|
83
|
-
refute_nil(rows.to_json)
|
84
|
-
refute_nil(rows.to_yaml)
|
85
|
-
end
|
86
|
-
|
87
68
|
def test_DNSDB
|
88
69
|
PassiveDNS::Client.new(['dnsdb'])
|
89
70
|
d = PassiveDNS::DNSDB.new(@cp['dnsdb'] || {})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passivedns-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrislee35
|
@@ -125,18 +125,18 @@ files:
|
|
125
125
|
- Rakefile
|
126
126
|
- bin/pdnstool
|
127
127
|
- lib/passivedns/client.rb
|
128
|
-
- lib/passivedns/client/bfk.rb
|
129
|
-
- lib/passivedns/client/circl.rb
|
130
128
|
- lib/passivedns/client/cli.rb
|
131
|
-
- lib/passivedns/client/cn360.rb
|
132
|
-
- lib/passivedns/client/dnsdb.rb
|
133
|
-
- lib/passivedns/client/mnemonic.rb
|
134
129
|
- lib/passivedns/client/passivedb.rb
|
135
|
-
- lib/passivedns/client/
|
130
|
+
- lib/passivedns/client/providers/bfk.rb
|
131
|
+
- lib/passivedns/client/providers/circl.rb
|
132
|
+
- lib/passivedns/client/providers/cn360.rb
|
133
|
+
- lib/passivedns/client/providers/dnsdb.rb
|
134
|
+
- lib/passivedns/client/providers/mnemonic.rb
|
135
|
+
- lib/passivedns/client/providers/passivetotal.rb
|
136
|
+
- lib/passivedns/client/providers/tcpiputils.rb
|
137
|
+
- lib/passivedns/client/providers/virustotal.rb
|
136
138
|
- lib/passivedns/client/state.rb
|
137
|
-
- lib/passivedns/client/tcpiputils.rb
|
138
139
|
- lib/passivedns/client/version.rb
|
139
|
-
- lib/passivedns/client/virustotal.rb
|
140
140
|
- passivedns-client.gemspec
|
141
141
|
- test/helper.rb
|
142
142
|
- test/test_passivedns-client.rb
|