ukemi 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: ad938a7cb405569da9b6ba12dfe4c1bfa7eb382a4e08d2b204a8a6705572c1b9
4
- data.tar.gz: d9b4a43bc7837c92b8fa692f7ecd12ba0f6de5aeda82f5066ea868b8b01b73e3
3
+ metadata.gz: 772366e3c49f7e5795e5725ca5535662c1626c9fa9522499aae4393b16c4d989
4
+ data.tar.gz: 13e976f1cc0e16c1e0e0b4cf96baeaefe848a963c827079616898564ad370732
5
5
  SHA512:
6
- metadata.gz: 31c864b566fe92d6ca5b71691c3517d95e29922ba704a7cd483c4df96a6731a7b42523d8102ea76b946ec1bc5068684475b4f60648064a2f466a41e70f014952
7
- data.tar.gz: 561d1bd6ed05ec3392c2137a1b73df0a95ad1e20e0ccc66f354ce1a7725603fa7a50572bcbecb96edf4f932f9717b8520a35cd0879ff7e801d60e4dcc16e5486
6
+ metadata.gz: e15595740c568adc0b5c6feed7b881492afc1a3166f43b0f9a5aaff4e4a00dba9161e7d6a1decba2d71b900edd32fb969c341972ff82aa4a9dc21d9c6a771b57
7
+ data.tar.gz: a1ebc0af8b442e49f46204c40ee121317da97c4e4598adeb2724a4083c09c9e2b2647f80e152913ae6025ed8ae9fa4ba769e6defbeb2576c7493f712f6e7d3d2
data/README.md CHANGED
@@ -10,6 +10,7 @@ Ukemi is a CIL tool for querying passive DNS services.
10
10
  It supports the following services.
11
11
 
12
12
  - [CIRCL passive DNS](https://www.circl.lu/services/passive-dns/)
13
+ - [DNSDB](https://api.dnsdb.info/)
13
14
  - [PassiveTotal](https://community.riskiq.com/)
14
15
  - [SecurityTrails](https://securitytrails.com/)
15
16
  - [VirusTotal](http://virustotal.com)
@@ -30,6 +31,7 @@ Configuration is done via environment variables.
30
31
  |------------------------|----------------------------|
31
32
  | CIRCL_PASSIVE_PASSWORD | CIRCL passive DNS password |
32
33
  | CIRCL_PASSIVE_USERNAME | CIRCL passive DNS username |
34
+ | DNSDB_API_KEY | DNSDB API key |
33
35
  | PASSIVETOTAL_API_KEY | PassiveTotal API key |
34
36
  | PASSIVETOTAL_USERNAME | PassiveTotal username |
35
37
  | SECURITYTRAILS_API_KEY | SecurityTrails API key |
@@ -43,7 +45,7 @@ Commands:
43
45
  ukemi help [COMMAND] # Describe available commands or one specific command
44
46
  ukemi lookup [IP|DOMAIN] # Lookup passive DNS services
45
47
 
46
- $ ukemi help looup
48
+ $ ukemi help lookup
47
49
  Usage:
48
50
  ukemi lookup [IP|DOMAIN]
49
51
 
@@ -22,6 +22,7 @@ require "ukemi/record"
22
22
  require "ukemi/services/service"
23
23
 
24
24
  require "ukemi/services/circl"
25
+ require "ukemi/services/dnsdb"
25
26
  require "ukemi/services/passivetotal"
26
27
  require "ukemi/services/securitytrails"
27
28
  require "ukemi/services/virustotal"
@@ -13,7 +13,7 @@ module Ukemi
13
13
 
14
14
  begin
15
15
  service.lookup data
16
- rescue ::PassiveTotal::Error, ::VirusTotal::Error, ::SecurityTrails::Error, PassiveCIRCL::Error
16
+ rescue ::PassiveTotal::Error, ::VirusTotal::Error, ::SecurityTrails::Error, PassiveCIRCL::Error, DNSDB::Error
17
17
  nil
18
18
  end
19
19
  end.flatten.compact
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require "dnsdb"
5
+
6
+ module Ukemi
7
+ module Services
8
+ class DNSDB < Service
9
+ private
10
+
11
+ def config_keys
12
+ %w(DNSDB_API_KEY)
13
+ end
14
+
15
+ def api
16
+ @api ||= ::DNSDB::API.new
17
+ end
18
+
19
+ def lookup_by_ip(data)
20
+ results = api.lookup.rdata(type: "ip", value: data, rrtype: "A")
21
+ results.map do |result|
22
+ rrname = result.dig("rrname")
23
+ # Remove the last dot (e.g. "example.com.")
24
+ data = rrname[0..-2]
25
+ Record.new(
26
+ data: data,
27
+ first_seen: Time.at(result.dig("time_first")).to_date.to_s,
28
+ last_seen: Time.at(result.dig("time_last")).to_date.to_s,
29
+ source: name
30
+ )
31
+ end
32
+ end
33
+
34
+ def lookup_by_domain(data)
35
+ results = api.lookup.rrset(owner_name: data, rrtype: "A")
36
+ results.map do |result|
37
+ first_seen = Time.at(result.dig("time_first")).to_date.to_s
38
+ last_seen = Time.at(result.dig("time_last")).to_date.to_s
39
+
40
+ values = result.dig("rdata") || []
41
+ values.map do |value|
42
+ Record.new(
43
+ data: value,
44
+ first_seen: first_seen,
45
+ last_seen: last_seen,
46
+ source: name
47
+ )
48
+ end
49
+ end.flatten
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ukemi
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "webmock", "~> 3.8"
34
34
 
35
35
  spec.add_dependency "addressable", "~> 2.7"
36
+ spec.add_dependency "dnsdb", "~> 0.1"
36
37
  spec.add_dependency "mem", "~> 0.1"
37
38
  spec.add_dependency "parallel", "~> 1.19"
38
39
  spec.add_dependency "passive_circl", "~> 0.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ukemi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-16 00:00:00.000000000 Z
11
+ date: 2020-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: dnsdb
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.1'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.1'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: mem
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -245,6 +259,7 @@ files:
245
259
  - lib/ukemi/moderator.rb
246
260
  - lib/ukemi/record.rb
247
261
  - lib/ukemi/services/circl.rb
262
+ - lib/ukemi/services/dnsdb.rb
248
263
  - lib/ukemi/services/passivetotal.rb
249
264
  - lib/ukemi/services/securitytrails.rb
250
265
  - lib/ukemi/services/service.rb