passivedns-client 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/passivedns/client/provider/bfk.rb +4 -1
- data/lib/passivedns/client/provider/circl.rb +3 -1
- data/lib/passivedns/client/provider/cn360.rb +23 -19
- data/lib/passivedns/client/provider/dnsdb.rb +13 -4
- data/lib/passivedns/client/provider/mnemonic.rb +8 -1
- data/lib/passivedns/client/provider/passivetotal.rb +4 -2
- data/lib/passivedns/client/provider/riskiq.rb +8 -6
- data/lib/passivedns/client/provider/tcpiputils.rb +22 -12
- data/lib/passivedns/client/provider/virustotal.rb +3 -2
- data/lib/passivedns/client/version.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: d8943fdb2df184fb90081be44049edc69a35ac80
|
4
|
+
data.tar.gz: 409d45d5b94c4ab0c1d3d3e7caa57d2e192add8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b4d1bee2454906a09b5af88a48a3792ad0e9bdb032512362c7803f66ee12352bbe9ccf36e476fe5a406498d89e413588d2778650151480bb01d66a8e295dec3
|
7
|
+
data.tar.gz: 086a9fdf306f2c67c8ff7ace94fa36e14d07a1d8631931d8d22c32c5b9295bcb79d20b433e3e074de3d1a7ed2e2c13930ec8305104b90c23dd9b3c88b0bbb0f3
|
@@ -88,7 +88,10 @@ module PassiveDNS #:nodoc: don't document this
|
|
88
88
|
######### FIX BLANKS FOR MX
|
89
89
|
|
90
90
|
end
|
91
|
-
|
91
|
+
query = r[0]
|
92
|
+
answer = r[2]
|
93
|
+
rrtype = r[1]
|
94
|
+
res << PDNSResult.new(self.class.name,response_time,query,answer,rrtype)
|
92
95
|
end
|
93
96
|
end
|
94
97
|
res
|
@@ -95,9 +95,11 @@ module PassiveDNS #:nodoc: don't document this
|
|
95
95
|
# need to remove the json_class tag or the parser will crap itself trying to find a class to align it to
|
96
96
|
page.split(/\n/).each do |line|
|
97
97
|
row = JSON.parse(line)
|
98
|
+
firstseen = Time.at(row['time_first'].to_i)
|
99
|
+
lastseen = Time.at(row['time_last'].to_i)
|
98
100
|
res << PDNSResult.new(self.class.name,response_time,
|
99
101
|
row['rrname'], row['rdata'], row['rrtype'], 0,
|
100
|
-
|
102
|
+
firstseen, lastseen, row['count'])
|
101
103
|
end
|
102
104
|
res
|
103
105
|
rescue Exception => e
|
@@ -82,27 +82,31 @@ module PassiveDNS #:nodoc: don't document this
|
|
82
82
|
else
|
83
83
|
recs
|
84
84
|
end
|
85
|
+
end
|
85
86
|
|
86
|
-
|
87
|
+
private
|
87
88
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
89
|
+
# parses the response of 360.cn's JSON reply to generate an array of PDNSResult
|
90
|
+
def parse_json(page,query,response_time=0)
|
91
|
+
res = []
|
92
|
+
# need to remove the json_class tag or the parser will crap itself trying to find a class to align it to
|
93
|
+
data = JSON.parse(page)
|
94
|
+
data.each do |row|
|
95
|
+
time_first = (row["time_first"]) ? Time.at(row["time_first"].to_i) : nil
|
96
|
+
time_last = (row["time_last"]) ? Time.at(row["time_last"].to_i) : nil
|
97
|
+
count = row["count"] || 0
|
98
|
+
query = row["rrname"]
|
99
|
+
answers = row["rdata"].gsub(/;$/,'').split(/;/)
|
100
|
+
rrtype = row["rrtype"]
|
101
|
+
answers.each do |answer|
|
102
|
+
res << PDNSResult.new(self.class.name, response_time, query, answer, rrtype, time_first, time_last, count)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
res
|
106
|
+
rescue Exception => e
|
107
|
+
$stderr.puts "#{self.class.name} Exception: #{e}"
|
108
|
+
raise e
|
109
|
+
end
|
106
110
|
end
|
107
111
|
end
|
108
112
|
end
|
@@ -90,12 +90,21 @@ module PassiveDNS #:nodoc: don't document this
|
|
90
90
|
rows = page.split(/\n/)
|
91
91
|
rows.each do |row|
|
92
92
|
record = JSON.parse(row)
|
93
|
-
|
94
|
-
record['rdata'].
|
93
|
+
answers = record['rdata']
|
94
|
+
answers = [record['rdata']] if record['rdata'].class == String
|
95
|
+
query = record['rrname'].gsub!(/\.$/,'')
|
96
|
+
rrtype = record['rrtype']
|
97
|
+
firstseen = Time.at(record['time_first'].to_i)
|
98
|
+
lastseen = Time.at(record['time_last'].to_i)
|
99
|
+
count = record['count']
|
100
|
+
|
101
|
+
answers.each do |answer|
|
102
|
+
answer.gsub!(/\.$/,'')
|
95
103
|
if record['time_first']
|
96
|
-
res << PDNSResult.new(self.class.name,response_time,
|
104
|
+
res << PDNSResult.new(self.class.name,response_time,query,answer,rrtype,
|
105
|
+
0,firstseen,lastseen,count)
|
97
106
|
else
|
98
|
-
res << PDNSResult.new(self.class.name,response_time,
|
107
|
+
res << PDNSResult.new(self.class.name,response_time,query,answer,rrtype)
|
99
108
|
end
|
100
109
|
end
|
101
110
|
end
|
@@ -83,7 +83,14 @@ module PassiveDNS #:nodoc: don't document this
|
|
83
83
|
if data['result']
|
84
84
|
data['result'].each do |row|
|
85
85
|
if row['query']
|
86
|
-
|
86
|
+
query = row['query']
|
87
|
+
answer = row['answer']
|
88
|
+
rrtype = row['type'].upcase
|
89
|
+
tty = row['ttl'].to_i
|
90
|
+
firstseen = row['first']
|
91
|
+
lastseen = row['last']
|
92
|
+
res << PDNSResult.new(self.class.name,response_time,
|
93
|
+
query, answer, rrtype, ttl, firstseen, lastseen)
|
87
94
|
end
|
88
95
|
end
|
89
96
|
end
|
@@ -84,8 +84,10 @@ module PassiveDNS #:nodoc: don't document this
|
|
84
84
|
if data['results']
|
85
85
|
query = data['results']['value']
|
86
86
|
data['results']['resolutions'].each do |row|
|
87
|
-
|
88
|
-
|
87
|
+
#p row['firstSeen']
|
88
|
+
#p row['lastSeen']
|
89
|
+
first_seen = (row['firstSeen'] == "None") ? nil : Time.parse(row['firstSeen']+" +0000")
|
90
|
+
last_seen = (row['lastSeen'] == "None") ? nil : Time.parse(row['lastSeen']+" +0000")
|
89
91
|
value = row['value']
|
90
92
|
source = row['source'].join(",")
|
91
93
|
res << PDNSResult.new(self.class.name+"/"+source,response_time,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'net/https'
|
5
5
|
require 'openssl'
|
6
|
-
|
6
|
+
require 'pp'
|
7
7
|
|
8
8
|
module PassiveDNS #:nodoc: don't document this
|
9
9
|
# The Provider module contains all the Passive DNS provider client code
|
@@ -103,19 +103,21 @@ module PassiveDNS #:nodoc: don't document this
|
|
103
103
|
|
104
104
|
# parses the response of riskiq's JSON reply to generate an array of PDNSResult
|
105
105
|
def parse_json(page,query,response_time=0)
|
106
|
-
#pp page
|
107
106
|
res = []
|
108
107
|
# need to remove the json_class tag or the parser will crap itself trying to find a class to align it to
|
109
108
|
data = JSON.parse(page)
|
109
|
+
#pp data
|
110
110
|
if data['records']
|
111
111
|
data['records'].each do |record|
|
112
|
-
name = record['name']
|
112
|
+
name = record['name'].gsub!(/\.$/,'')
|
113
113
|
type = record['rrtype']
|
114
|
-
last_seen = record['lastSeen']
|
115
|
-
first_seen = record['firstSeen']
|
114
|
+
last_seen = Time.parse(record['lastSeen'])
|
115
|
+
first_seen = Time.parse(record['firstSeen'])
|
116
|
+
count = record['count']
|
116
117
|
record['data'].each do |datum|
|
118
|
+
datum.gsub!(/\.$/,'')
|
117
119
|
res << PDNSResult.new(self.class.name,response_time,
|
118
|
-
name, datum, type, 0, first_seen, last_seen)
|
120
|
+
name, datum, type, 0, first_seen, last_seen, count)
|
119
121
|
end
|
120
122
|
end
|
121
123
|
end
|
@@ -86,29 +86,39 @@ module PassiveDNS #:nodoc: don't document this
|
|
86
86
|
# translates the data structure derived from of tcpiputils's JSON reply
|
87
87
|
def format_recs(reply_data, question, delta)
|
88
88
|
recs = []
|
89
|
+
fieldname = nil
|
90
|
+
rrtype = nil
|
91
|
+
add_records = false
|
89
92
|
reply_data.each do |key, data|
|
90
93
|
case key
|
91
94
|
when "ipv4"
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
+
fieldname = "ip"
|
96
|
+
rrtype = "A"
|
97
|
+
add_records = true
|
95
98
|
when "ipv6"
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
+
fieldname = "ip"
|
100
|
+
rrtype = "AAAA"
|
101
|
+
add_records = true
|
99
102
|
when "dns"
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
+
fieldname = "dns"
|
104
|
+
rrtype = "NS"
|
105
|
+
add_records = true
|
103
106
|
when "mx"
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
+
fieldname = "dns"
|
108
|
+
rrtype = "MX"
|
109
|
+
add_records = true
|
107
110
|
when "domains"
|
108
111
|
data.each do |rec|
|
112
|
+
lastseen = (rec["updatedate"]) ? Date.parse(rec["updatedate"]) : nil
|
109
113
|
recs << PDNSResult.new(self.class.name, delta, rec, question, "A", nil, nil, nil, nil)
|
110
114
|
end
|
111
115
|
end
|
116
|
+
if add_records
|
117
|
+
data.each do |rec|
|
118
|
+
lastseen = (rec["updatedate"]) ? Date.parse(rec["updatedate"]) : nil
|
119
|
+
recs << PDNSResult.new(self.class.name, delta, question, rec[fieldname], rrtype, nil, nil, lastseen, nil)
|
120
|
+
end
|
121
|
+
end
|
112
122
|
end
|
113
123
|
recs
|
114
124
|
end
|
@@ -87,10 +87,11 @@ module PassiveDNS #:nodoc: don't document this
|
|
87
87
|
data = JSON.parse(page)
|
88
88
|
if data['resolutions']
|
89
89
|
data['resolutions'].each do |row|
|
90
|
+
lastseen = Time.parse(row['last_resolved']+" +0000")
|
90
91
|
if row['ip_address']
|
91
|
-
res << PDNSResult.new(self.class.name,response_time,query,row['ip_address'],'A',nil,nil,
|
92
|
+
res << PDNSResult.new(self.class.name,response_time,query,row['ip_address'],'A',nil,nil,lastseen)
|
92
93
|
elsif row['hostname']
|
93
|
-
res << PDNSResult.new(self.class.name,response_time,row['hostname'],query,'A',nil,nil,
|
94
|
+
res << PDNSResult.new(self.class.name,response_time,row['hostname'],query,'A',nil,nil,lastseen)
|
94
95
|
end
|
95
96
|
end
|
96
97
|
end
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrislee35
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|