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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e141cbc5d84ea9c25ee8c207db9c7758869117e
4
- data.tar.gz: 81c70c9a9a4c272133c4e33a2e043fab650fd00a
3
+ metadata.gz: 47032e96af18547a42a6f394a674c15d304bdb90
4
+ data.tar.gz: 9ac2529bfa59e287053789922bca5075d094e689
5
5
  SHA512:
6
- metadata.gz: fffadc8b47040b55d25255cf62ab2b8f2498a8a39d89caa1812da37944da266f411cf9b384cb1f6ab70718ac106811313a0d4987c792487919f239ad388bc4ed
7
- data.tar.gz: d0592a94d6f4cec71afdf55d3cccedf1cfc1fe8ecf17cc3f3d746d92b184a694e3c1e1655c17d03f3972a63bc56de433d3cb7ec9eb067172d02183f7c7ff4a5b
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 7 major Passive DNS databases: BFK, CERTEE, DNSParse, DNSDB, VirusTotal, PassiveDNS.cn, and Mnemonic.
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
- * CERT-EE : No registration required
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
- Usage: bin/pdnstool [-d [bedvt3m]] [-g|-v|-m|-c|-x|-y|-j|-t] [-os <sep>] [-f <file>] [-r#|-w#|-v] [-l <count>] <ip|domain|cidr>
62
- -dbedvt3m uses all of the available passive dns databases
63
- -db use BFK
64
- -de use CERT-EE (default)
65
- -dd use DNSDB (formerly ISC)
66
- -dv use VirusTotal
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
- -d3 use 360.cn (www.passivedns.cn)
69
- -dm uses Mnemonic (passivedns.mnemonic.no)
92
+ -dv use VirusTotal
70
93
  -dvt uses VirusTotal and TCPIPUtils (for example)
71
-
72
- -g outputs a link-nodal GDF visualization definition
73
- -v outputs a link-nodal graphviz visualization definition
74
- -m output a link-nodal graphml visualization definition
75
- -c outputs CSV
76
- -x outputs XML
77
- -y outputs YAML
78
- -j outputs JSON
79
- -t outputs ASCII text (default)
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
@@ -1,5 +1,4 @@
1
1
  require 'open-uri'
2
- require_relative 'passivedb'
3
2
 
4
3
  module PassiveDNS
5
4
  class BFK < PassiveDB
@@ -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] || true
24
+ @debug = options[:debug] || false
26
25
  @username = options["USERNAME"]
27
26
  @password = options["PASSWORD"]
28
27
  @auth_token = options["AUTH_TOKEN"]
@@ -3,7 +3,6 @@ require 'net/https'
3
3
  require 'openssl'
4
4
  require 'json'
5
5
  require 'digest/md5'
6
- require_relative 'passivedb'
7
6
 
8
7
  module PassiveDNS
9
8
  class CN360 < PassiveDB
@@ -3,7 +3,6 @@
3
3
  # to request an API key, please email dnsdb-api at farsightsecurity dot com.
4
4
  require 'net/http'
5
5
  require 'net/https'
6
- require_relative 'passivedb'
7
6
 
8
7
  module PassiveDNS
9
8
  class DNSDB < PassiveDB
@@ -1,5 +1,5 @@
1
1
  module PassiveDNS
2
2
  class Client
3
- VERSION = "2.0.2"
3
+ VERSION = "2.0.3"
4
4
  end
5
5
  end
@@ -6,24 +6,23 @@ require "passivedns/client/version"
6
6
  require 'passivedns/client/state'
7
7
  require 'passivedns/client/passivedb'
8
8
 
9
- require 'passivedns/client/bfk'
10
- require 'passivedns/client/circl'
11
- require 'passivedns/client/cn360'
12
- require 'passivedns/client/dnsdb'
13
- require 'passivedns/client/mnemonic'
14
- require 'passivedns/client/passivetotal'
15
- require 'passivedns/client/tcpiputils'
16
- require 'passivedns/client/virustotal'
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=['bfk','dnsdb','virustotal','tcpiputils','cn360','mnemonic','passivetotal','CIRCL'], configfile="#{ENV['HOME']}/.passivedns-client")
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.2
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/passivetotal.rb
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