dert 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,69 @@
1
+ module Dert
2
+
3
+ class BRT
4
+ @res = Dnsruby::Resolver.new
5
+
6
+ def self.query(domain, wordlist, dns_type)
7
+ results = []
8
+ default_ip = ''
9
+ wildcard = false
10
+
11
+ # Check if domain has wildcard DNS enabled.
12
+ if self.wildcard?(domain)
13
+ wildcard = true
14
+ rendsub = rand(10000).to_s
15
+ ret = @res.query("#{rendsub}.#{domain}", dns_type)
16
+ default_ip = ret.answer[0].address.to_s
17
+ end
18
+
19
+ wordlist.each do |a|
20
+
21
+ # A
22
+ begin
23
+ Timeout::timeout(5) {
24
+ ret = @res.query("#{a}.#{domain}", dns_type)
25
+ ret.answer.each do |x|
26
+ unless x.address.to_s == default_ip
27
+ results << {
28
+ address: x.address.to_s,
29
+ type: x.type.to_s,
30
+ hostname: x.name.to_s,
31
+ ttl: x.ttl.to_s,
32
+ klass: x.klass.to_s
33
+ }
34
+ end
35
+ end
36
+ }
37
+ rescue => e
38
+ #
39
+ end
40
+ end
41
+
42
+ if wildcard
43
+ results << {
44
+ address: default_ip,
45
+ type: 'A',
46
+ hostname: "*.#{domain}"
47
+ }
48
+ end
49
+
50
+ results
51
+ end
52
+
53
+ def self.wildcard?(domain)
54
+ rendsub = rand(10000).to_s
55
+ # A
56
+ begin
57
+ ret = @res.query("#{rendsub}.#{domain}", Dnsruby::Types.A)
58
+ rescue
59
+ return false
60
+ end
61
+
62
+ if ret.answer.length != 0
63
+ true
64
+ else
65
+ false
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,9 @@
1
+ path = File.dirname(__FILE__)
2
+ require "#{path}/arin"
3
+ require "#{path}/axfr"
4
+ require "#{path}/brt"
5
+ require "#{path}/ipv6"
6
+ require "#{path}/rvl"
7
+ require "#{path}/srv"
8
+ require "#{path}/std"
9
+ require "#{path}/tld"
@@ -0,0 +1,27 @@
1
+ module Dert
2
+
3
+ class IPV6
4
+ @res = Dnsruby::Resolver.new
5
+
6
+ def self.query(domain, wordlist)
7
+ results = []
8
+ # AAAA
9
+ begin
10
+ ret = @res.query(domain, Dnsruby::Types.AAAA)
11
+ ret.answer.each do |x|
12
+ results << {
13
+ address: x.address.to_s,
14
+ type: x.type,
15
+ hostname: x.name.to_s,
16
+ ttl: x.ttl,
17
+ klass: x.klass,
18
+ }
19
+ end
20
+ rescue => e
21
+ #
22
+ end
23
+ results
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,33 @@
1
+ module Dert
2
+
3
+ class RVL
4
+
5
+ @res = Dnsruby::Resolver.new
6
+
7
+ def self.query(domain)
8
+
9
+ results = []
10
+
11
+ default_address = Resolv.getaddress(domain)
12
+
13
+ begin
14
+ ret = @res.query(default_address, Dnsruby::Types.PTR)
15
+ ret.answer.each do |x|
16
+ results << {
17
+ address: default_address,
18
+ type: x.type.to_s,
19
+ hostname: x.domainname.to_s,
20
+ ttl: x.ttl.to_s,
21
+ klass: x.klass.to_s
22
+ }
23
+ end
24
+ rescue => e
25
+ #
26
+ end
27
+
28
+ results
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,44 @@
1
+ module Dert
2
+
3
+ class SRV
4
+
5
+ @res = Dnsruby::Resolver.new
6
+
7
+ def self.query(domain)
8
+ results = []
9
+ default_address = Resolv.getaddress(domain)
10
+
11
+ common = %w(
12
+ _gc._tcp. _kerberos._tcp. _kerberos._udp. _ldap._tcp _test._tcp. _sips._tcp. _sip._udp. _sip._tcp.
13
+ _aix._tcp. _aix._tcp. _finger._tcp. _ftp._tcp. _http._tcp. _nntp._tcp. _telnet._tcp. _whois._tcp.
14
+ _h323cs._tcp. _h323cs._udp. _h323be._tcp. _h323be._udp. _h323ls._tcp. _h323ls._udp. _sipinternal._tcp.
15
+ _sipinternaltls._tcp. _sip._tls. _sipfederationtls._tcp. _jabber._tcp. _xmpp-server._tcp.
16
+ _xmpp-client._tcp. _imap._tcp. _certificates._tcp. _crls._tcp. _pgpkeys._tcp. _pgprevokations._tcp.
17
+ _cmp._tcp. _svcp._tcp. _crl._tcp. _ocsp._tcp. _PKIXREP._tcp. _smtp._tcp. _hkp._tcp. _hkps._tcp.
18
+ _jabber._udp. _xmpp-server._udp. _xmpp-client._udp. _jabber-client._tcp. _jabber-client._udp.
19
+ )
20
+
21
+ # SRV
22
+ common.each do |a|
23
+ begin
24
+ ret = @res.query("#{a}#{domain}", Dnsruby::Types.SRV)
25
+ ret.answer.each do |x|
26
+ results << {
27
+ address: default_address,
28
+ type: x.type,
29
+ hostname: x.name.to_s,
30
+ target: x.target.to_s,
31
+ ttl: x.ttl,
32
+ klass: x.klass,
33
+ }
34
+ end
35
+ rescue => e
36
+ #
37
+ end
38
+ end
39
+
40
+ results
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,82 @@
1
+ module Dert
2
+
3
+ class STD
4
+
5
+ @res = Dnsruby::Resolver.new
6
+
7
+ def self.query(domain)
8
+
9
+ default_address = Resolv.getaddress(domain)
10
+ results = []
11
+
12
+ # SOA
13
+ begin
14
+ ret = @res.query(domain, Dnsruby::Types.SOA)
15
+ ret.answer.each do |x|
16
+ results << {
17
+ address: default_address,
18
+ type: x.type.to_s,
19
+ hostname: x.name.to_s,
20
+ ttl: x.ttl.to_s,
21
+ klass: x.klass.to_s
22
+ }
23
+ end
24
+
25
+ # A
26
+ ret = @res.query(domain, Dnsruby::Types.A)
27
+ ret.answer.each do |x|
28
+ results << {
29
+ address: (x.address.to_s || default_address),
30
+ type: x.type.to_s,
31
+ hostname: x.name.to_s,
32
+ ttl: x.ttl.to_s,
33
+ klass: x.klass.to_s
34
+ }
35
+ end
36
+
37
+ # MX
38
+ ret = @res.query(domain, Dnsruby::Types.MX)
39
+ ret.answer.each do |x|
40
+ results << {
41
+ address: default_address,
42
+ type: x.type.to_s,
43
+ hostname: x.exchange.to_s,
44
+ ttl: x.ttl.to_s,
45
+ klass: x.klass.to_s,
46
+ preference: x.preference.to_s
47
+ }
48
+ end
49
+
50
+ # NS
51
+ ret = @res.query(domain, Dnsruby::Types.NS)
52
+ ret.answer.each do |x|
53
+ results << {
54
+ address: default_address,
55
+ type: x.type.to_s,
56
+ hostname: x.domainname.to_s,
57
+ ttl: x.ttl.to_s,
58
+ klass: x.klass.to_s
59
+ }
60
+ end
61
+
62
+ # TXT
63
+ ret = @res.query(domain, Dnsruby::Types.TXT)
64
+ ret.answer.each do |x|
65
+ results << {
66
+ address: default_address,
67
+ type: x.type.to_s,
68
+ hostname: x.name.to_s,
69
+ ttl: x.ttl.to_s,
70
+ klass: x.klass.to_s
71
+ }
72
+ end
73
+ rescue
74
+ #
75
+ end
76
+
77
+ results
78
+ end
79
+
80
+ end
81
+
82
+ end
@@ -0,0 +1,43 @@
1
+ module Dert
2
+ class TLD
3
+
4
+ @res = Dnsruby::Resolver.new
5
+
6
+ def self.query(domain)
7
+ results = []
8
+
9
+ tlds = %w(
10
+ com org net edu mil gov uk af al dz as ad ao ai aq ag ar am aw ac au at az bs bh bd bb by be bz bj bm
11
+ bt bo ba bw bv br io bn bg bf bi kh cm ca cv ky cf td cl cn cx cc co km cd cg ck cr ci hr cu cy cz dk
12
+ dj dm do tp ec eg sv gq er ee et fk fo fj fi fr gf pf tf ga gm ge de gh gi gr gl gd gp gu gt gg gn gw
13
+ gy ht hm va hn hk hu is in id ir iq ie im il it jm jp je jo kz ke ki kp kr kw kg la lv lb ls lr ly li
14
+ lt lu mo mk mg mw my mv ml mt mh mq mr mu yt mx fm md mc mn ms ma mz mm na nr np nl an nc nz ni ne ng
15
+ nu nf mp no om pk pw pa pg py pe ph pn pl pt pr qa re ro ru rw kn lc vc ws sm st sa sn sc sl sg sk si
16
+ sb so za gz es lk sh pm sd sr sj sz se ch sy tw tj tz th tg tk to tt tn tr tm tc tv ug ua ae gb us um
17
+ uy uz vu ve vn vg vi wf eh ye yu za zr zm zw int gs info biz su name coop aero
18
+ )
19
+
20
+ target = domain.scan(/(\S*)[.]\w*\z/).join
21
+ target.chomp!
22
+
23
+ tlds.each do |a|
24
+ # A
25
+ begin
26
+ ret = @res.query("#{target}.#{a}", Dnsruby::Types.A)
27
+ ret.answer.each do |x|
28
+ results << {
29
+ address: x.address.to_s,
30
+ type: x.type,
31
+ hostname: x.name.to_s,
32
+ ttl: x.ttl,
33
+ klass: x.klass,
34
+ }
35
+ end
36
+ rescue
37
+ #
38
+ end
39
+ end
40
+ results
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,3 @@
1
+ module Dert
2
+ VERSION = '1.0.1'
3
+ end
data/lib/dert.rb ADDED
@@ -0,0 +1,3 @@
1
+ path = File.dirname(__FILE__)
2
+ require 'dert/dns'
3
+ require 'dert/version'
data/test/arin.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'minitest/unit'
2
+ require 'minitest/autorun'
3
+
4
+ require 'dert'
5
+ require 'yaml'
6
+
7
+ class TestArin < MiniTest::Unit::TestCase
8
+ def setup
9
+ @options = {}
10
+ @options[:domain] = 'google.com'
11
+ @options[:type] = 'arin'
12
+ @options[:silent] = true
13
+ end
14
+
15
+ def test_equal_results
16
+ results = Dert.run(@options)
17
+ check = YAML.load_file('arin.yml')
18
+ assert_equal results.to_s, check.to_s
19
+ end
20
+ end
data/test/arin.yml ADDED
@@ -0,0 +1,65 @@
1
+ ---
2
+ - :cidr: 64.124.112.24/29
3
+ :handle: NET-64-124-112-24-1
4
+ :customer: GOOGLE
5
+ :zip: '00000'
6
+ - :cidr: 209.249.73.64/29
7
+ :handle: NET-209-249-73-64-1
8
+ :customer: GOOGLE
9
+ :zip: '00000'
10
+ - :cidr: 64.124.229.168/29
11
+ :handle: NET-64-124-229-168-1
12
+ :customer: GOOGLE
13
+ :zip: '94043'
14
+ - :cidr: 65.214.255.96/28
15
+ :handle: NET-65-214-255-96-1
16
+ :customer: GOOGLE
17
+ :zip: 48075-1152
18
+ - :cidr: 65.211.194.96/28
19
+ :handle: NET-65-211-194-96-1
20
+ :customer: GOOGLE
21
+ :zip: 92614-8218
22
+ - :cidr: 65.223.8.48/28
23
+ :handle: NET-65-223-8-48-1
24
+ :customer: GOOGLE
25
+ :zip: 92614-8218
26
+ - :cidr: 65.221.133.176/28
27
+ :handle: NET-65-221-133-176-1
28
+ :customer: Google
29
+ :zip: 60611-3965
30
+ - :cidr: 63.84.190.224/27
31
+ :handle: NET-63-84-190-224-1
32
+ :customer: GOOGLE
33
+ :zip: 60610-6392
34
+ - :cidr: 64.128.207.160/28
35
+ :handle: NET-64-128-207-160-1
36
+ :customer: Google
37
+ :zip: '85016'
38
+ - :cidr: 65.196.235.32/28
39
+ :handle: NET-65-196-235-32-1
40
+ :customer: GOOGLE
41
+ :zip: 94043-1351
42
+ - :cidr: 66.192.134.32/28
43
+ :handle: NET-66-192-134-32-1
44
+ :customer: Google
45
+ :zip: '30309'
46
+ - :cidr: 65.214.112.96/27
47
+ :handle: NET-65-214-112-96-1
48
+ :customer: GOOGLE
49
+ :zip: 94043-1351
50
+ - :cidr: 70.90.219.72/29
51
+ :handle: NET-70-90-219-72-1
52
+ :customer: Google
53
+ :zip: '15213'
54
+ - :cidr: 70.90.219.48/29
55
+ :handle: NET-70-90-219-48-1
56
+ :customer: Google
57
+ :zip: '15213'
58
+ - :cidr: 199.87.241.32/27
59
+ :handle: NET-199-87-241-32-1
60
+ :customer: Google
61
+ :zip: '94043'
62
+ - :cidr: 208.74.177.144/28
63
+ :handle: NET-208-74-177-144-1
64
+ :customer: Google
65
+ :zip: '94043'
data/test/axfr.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'minitest/unit'
2
+ require 'minitest/autorun'
3
+
4
+ require 'dert'
5
+ require 'yaml'
6
+
7
+ class TestAXFR < MiniTest::Unit::TestCase
8
+ def setup
9
+ @options = {}
10
+ @options[:domain] = 'zonetransfer.me'
11
+ @options[:type] = 'axfr'
12
+ @options[:silent] = true
13
+ end
14
+
15
+ def test_equal_results
16
+ results = Dert.run(@options)
17
+ check = YAML.load_file('axfr.yml')
18
+ assert_equal results.to_s, check.to_s
19
+ end
20
+ end
data/test/axfr.yml ADDED
@@ -0,0 +1,148 @@
1
+ ---
2
+ - :address: 217.147.180.162
3
+ :type: SOA
4
+ :hostname: zonetransfer.me
5
+ :ttl: '7200'
6
+ :klass: IN
7
+ - :address: 217.147.180.162
8
+ :type: NS
9
+ :hostname: ns16.zoneedit.com
10
+ :ttl: '7200'
11
+ :klass: IN
12
+ - :address: 217.147.180.162
13
+ :type: NS
14
+ :hostname: ns12.zoneedit.com
15
+ :ttl: '7200'
16
+ :klass: IN
17
+ - :address: 217.147.180.162
18
+ :type: A
19
+ :hostname: zonetransfer.me
20
+ :ttl: '7200'
21
+ :klass: IN
22
+ - :address: 217.147.180.162
23
+ :type: MX
24
+ :hostname: ASPMX.L.GOOGLE.COM
25
+ :ttl: '7200'
26
+ :klass: IN
27
+ :preference: '0'
28
+ - :address: 217.147.180.162
29
+ :type: MX
30
+ :hostname: ALT1.ASPMX.L.GOOGLE.COM
31
+ :ttl: '7200'
32
+ :klass: IN
33
+ :preference: '10'
34
+ - :address: 217.147.180.162
35
+ :type: MX
36
+ :hostname: ALT2.ASPMX.L.GOOGLE.COM
37
+ :ttl: '7200'
38
+ :klass: IN
39
+ :preference: '10'
40
+ - :address: 217.147.180.162
41
+ :type: MX
42
+ :hostname: ASPMX2.GOOGLEMAIL.COM
43
+ :ttl: '7200'
44
+ :klass: IN
45
+ :preference: '20'
46
+ - :address: 217.147.180.162
47
+ :type: MX
48
+ :hostname: ASPMX3.GOOGLEMAIL.COM
49
+ :ttl: '7200'
50
+ :klass: IN
51
+ :preference: '20'
52
+ - :address: 217.147.180.162
53
+ :type: MX
54
+ :hostname: ASPMX4.GOOGLEMAIL.COM
55
+ :ttl: '7200'
56
+ :klass: IN
57
+ :preference: '20'
58
+ - :address: 217.147.180.162
59
+ :type: MX
60
+ :hostname: ASPMX5.GOOGLEMAIL.COM
61
+ :ttl: '7200'
62
+ :klass: IN
63
+ :preference: '20'
64
+ - :address: 217.147.180.162
65
+ :type: TXT
66
+ :hostname: zonetransfer.me
67
+ :ttl: '301'
68
+ :klass: IN
69
+ - :address: 217.147.180.162
70
+ :type: TXT
71
+ :hostname: zonetransfer.me
72
+ :ttl: '301'
73
+ :klass: IN
74
+ - :address: 217.147.180.162
75
+ :type: CNAME
76
+ :hostname: testing.zonetransfer.me
77
+ :ttl: '301'
78
+ :klass: IN
79
+ - :address: 4.23.39.254
80
+ :type: A
81
+ :hostname: office.zonetransfer.me
82
+ :ttl: '7200'
83
+ :klass: IN
84
+ - :address: 207.46.197.32
85
+ :type: A
86
+ :hostname: owa.zonetransfer.me
87
+ :ttl: '7200'
88
+ :klass: IN
89
+ - :address: 217.147.180.162
90
+ :type: TXT
91
+ :hostname: info.zonetransfer.me
92
+ :ttl: '7200'
93
+ :klass: IN
94
+ - :address: 127.0.0.1
95
+ :type: A
96
+ :hostname: asfdbbox.zonetransfer.me
97
+ :ttl: '7200'
98
+ :klass: IN
99
+ - :address: 202.14.81.230
100
+ :type: A
101
+ :hostname: canberra_office.zonetransfer.me
102
+ :ttl: '7200'
103
+ :klass: IN
104
+ - :address: 217.147.180.162
105
+ :type: TXT
106
+ :hostname: dzc.zonetransfer.me
107
+ :ttl: '7200'
108
+ :klass: IN
109
+ - :address: 217.147.180.162
110
+ :type: LOC
111
+ :hostname: dr.zonetransfer.me
112
+ :ttl: '300'
113
+ :klass: IN
114
+ - :address: 127.0.0.1
115
+ :type: A
116
+ :hostname: alltcpportsopen.firewall.test.zonetransfer.me
117
+ :ttl: '301'
118
+ :klass: IN
119
+ - :address: 217.147.180.162
120
+ :type: A
121
+ :hostname: www.zonetransfer.me
122
+ :ttl: '7200'
123
+ :klass: IN
124
+ - :address: 217.147.180.162
125
+ :type: CNAME
126
+ :hostname: staging.zonetransfer.me
127
+ :ttl: '7200'
128
+ :klass: IN
129
+ - :address: 217.147.180.162
130
+ :type: TXT
131
+ :hostname: robinwood.zonetransfer.me
132
+ :ttl: '302'
133
+ :klass: IN
134
+ - :address: 174.36.59.154
135
+ :type: A
136
+ :hostname: vpn.zonetransfer.me
137
+ :ttl: '4000'
138
+ :klass: IN
139
+ - :address: 217.147.180.162
140
+ :type: SRV
141
+ :hostname: _sip._tcp.zonetransfer.me
142
+ :ttl: '14000'
143
+ :klass: IN
144
+ - :address: 143.228.181.132
145
+ :type: A
146
+ :hostname: dc_office.zonetransfer.me
147
+ :ttl: '7200'
148
+ :klass: IN
data/test/brt.rb ADDED
@@ -0,0 +1,12 @@
1
+ path = File.dirname(__FILE__)
2
+ require 'dert'
3
+
4
+ options = {}
5
+ options[:domain] = 'rfizzle.ch'
6
+ options[:type] = 'brt'
7
+ options[:output] = 'brt.txt'
8
+ options[:threads] = 1
9
+ options[:wordlist] = "#{path}/wordlists/short_hosts.txt"
10
+ options[:silent] = true
11
+
12
+ Dert.run(options)
data/test/ipv6.rb ADDED
@@ -0,0 +1,12 @@
1
+ path = File.dirname(__FILE__)
2
+ require 'dert'
3
+
4
+ options = {}
5
+ options[:domain] = 'google.com'
6
+ options[:type] = 'ipv6'
7
+ options[:output] = 'ipv6.txt'
8
+ options[:threads] = 1
9
+ options[:wordlist] = "#{path}/wordlists/short_hosts.txt"
10
+ options[:silent] = true
11
+
12
+ Dert.run(options)
data/test/rvl.rb ADDED
@@ -0,0 +1,11 @@
1
+ path = File.dirname(__FILE__)
2
+ require 'dert'
3
+
4
+ options = {}
5
+ options[:wordlist] = "#{path}/wordlists/ips.txt"
6
+ options[:type] = 'rvl'
7
+ options[:output] = 'rvl.txt'
8
+ options[:threads] = 1
9
+ options[:silent] = true
10
+
11
+ Dert.run(options)
data/test/srv.rb ADDED
@@ -0,0 +1,10 @@
1
+ path = File.dirname(__FILE__)
2
+ require 'dert'
3
+
4
+ options = {}
5
+ options[:domain] = 'google.com'
6
+ options[:type] = 'srv'
7
+ options[:output] = 'srv.txt'
8
+ options[:silent] = true
9
+
10
+ Dert.run(options)
data/test/std.rb ADDED
@@ -0,0 +1,10 @@
1
+ path = File.dirname(__FILE__)
2
+ require 'dert'
3
+
4
+ options = {}
5
+ options[:domain] = 'google.com'
6
+ options[:type] = 'std'
7
+ options[:output] = 'std.txt'
8
+ options[:silent] = true
9
+
10
+ Dert.run(options)
data/test/tdl.rb ADDED
@@ -0,0 +1,10 @@
1
+ path = File.dirname(__FILE__)
2
+ require 'dert'
3
+
4
+ options = {}
5
+ options[:domain] = 'google.com'
6
+ options[:type] = 'tdl'
7
+ options[:output] = 'tdl.txt'
8
+ options[:silent] = true
9
+
10
+ Dert.run(options)