dnsbl-client 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +1 -2
- data/lib/dnsbl-client/dnsbl-client.rb +16 -7
- data/lib/dnsbl-client/three-level-tlds +158 -0
- data/test/test_dnsbl-client.rb +25 -0
- metadata +6 -5
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
�0�
|
1
|
+
��TH�nC�bfz��(&:���@'��@�\��i�:���Yd�,h�l/2�r�}�,v���Rzj
|
@@ -27,11 +27,17 @@ module DNSBL
|
|
27
27
|
# initialize a new DNSBL::Client object
|
28
28
|
# the config file automatically points to a YAML file containing the list of DNSBLs and their return codes
|
29
29
|
# the two-level-tlds file lists most of the two level tlds, needed for hostname to domain normalization
|
30
|
-
def initialize(configfile = File.dirname(__FILE__)+"/dnsbl.yaml",
|
30
|
+
def initialize(configfile = File.dirname(__FILE__)+"/dnsbl.yaml",
|
31
|
+
two_level_tldfile = File.dirname(__FILE__)+"/two-level-tlds",
|
32
|
+
three_level_tldfile = File.dirname(__FILE__)+"/three-level-tlds")
|
31
33
|
@dnsbls = YAML.load(File.open(configfile).read)
|
32
|
-
@
|
33
|
-
|
34
|
-
|
34
|
+
@two_level_tld = []
|
35
|
+
@three_level_tld = []
|
36
|
+
File.open(two_level_tldfile).readlines.each do |l|
|
37
|
+
@two_level_tld << l.strip
|
38
|
+
end
|
39
|
+
File.open(three_level_tldfile).readlines.each do |l|
|
40
|
+
@three_level_tld << l.strip
|
35
41
|
end
|
36
42
|
@sockets = []
|
37
43
|
config = Resolv::DNS::Config.new
|
@@ -51,10 +57,13 @@ module DNSBL
|
|
51
57
|
parts = domain.gsub(/^\w{1,20}:\/\//,'').gsub(/[\/\?\:].*/,'').gsub(/.*?\@/,'').split(/\./)
|
52
58
|
# grab the last two parts of the domain
|
53
59
|
dom = parts[-2,2].join(".")
|
54
|
-
# if the dom is in the
|
55
|
-
if @
|
60
|
+
# if the dom is in the two_level_tld list, then use three parts
|
61
|
+
if @two_level_tld.index(dom)
|
56
62
|
dom = parts[-3,3].join(".")
|
57
63
|
end
|
64
|
+
if @three_level_tld.index(dom)
|
65
|
+
dom = parts[-4,4].join(".")
|
66
|
+
end
|
58
67
|
dom
|
59
68
|
end
|
60
69
|
|
@@ -169,4 +178,4 @@ module DNSBL
|
|
169
178
|
results
|
170
179
|
end
|
171
180
|
end
|
172
|
-
end
|
181
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
act.edu.au
|
2
|
+
act.gov.au
|
3
|
+
bay.livefilestore.com
|
4
|
+
blog.friendster.com
|
5
|
+
blu.livefilestore.com
|
6
|
+
bo.nordland.no
|
7
|
+
bo.telemark.no
|
8
|
+
city.chiba.jp
|
9
|
+
city.fukuoka.jp
|
10
|
+
city.hiroshima.jp
|
11
|
+
city.kawasaki.jp
|
12
|
+
city.kitakyushu.jp
|
13
|
+
city.kobe.jp
|
14
|
+
city.kyoto.jp
|
15
|
+
city.nagoya.jp
|
16
|
+
city.niigata.jp
|
17
|
+
city.okayama.jp
|
18
|
+
city.osaka.jp
|
19
|
+
city.saitama.jp
|
20
|
+
city.sapporo.jp
|
21
|
+
city.sendai.jp
|
22
|
+
city.shizuoka.jp
|
23
|
+
city.yokohama.jp
|
24
|
+
cloud.prohosting.com
|
25
|
+
co.at.lv
|
26
|
+
co.at.pn
|
27
|
+
co.at.tc
|
28
|
+
co.uk.pn
|
29
|
+
co.uk.tc
|
30
|
+
com.au.ms
|
31
|
+
com.au.pn
|
32
|
+
com.au.tc
|
33
|
+
com.sapo.pt
|
34
|
+
do.sapo.pt
|
35
|
+
docs.google.com
|
36
|
+
en.alibaba.com
|
37
|
+
groups.live.com
|
38
|
+
gs.aa.no
|
39
|
+
gs.ah.no
|
40
|
+
gs.bu.no
|
41
|
+
gs.fm.no
|
42
|
+
gs.hl.no
|
43
|
+
gs.hm.no
|
44
|
+
gs.jan-mayen.no
|
45
|
+
gs.mr.no
|
46
|
+
gs.nl.no
|
47
|
+
gs.nt.no
|
48
|
+
gs.of.no
|
49
|
+
gs.ol.no
|
50
|
+
gs.oslo.no
|
51
|
+
gs.rl.no
|
52
|
+
gs.sf.no
|
53
|
+
gs.st.no
|
54
|
+
gs.svalbard.no
|
55
|
+
gs.tm.no
|
56
|
+
gs.tr.no
|
57
|
+
gs.va.no
|
58
|
+
gs.vf.no
|
59
|
+
heroy.more-og-romsdal.no
|
60
|
+
heroy.nordland.no
|
61
|
+
home.sapo.pt
|
62
|
+
homepage.t-online.de
|
63
|
+
lkd.co.im
|
64
|
+
ltd.co.im
|
65
|
+
me.uk.tc
|
66
|
+
metro.tokyo.jp
|
67
|
+
nes.akershus.no
|
68
|
+
nes.buskerud.no
|
69
|
+
no.sapo.pt
|
70
|
+
nsw.edu.au
|
71
|
+
nsw.gov.au
|
72
|
+
nt.edu.au
|
73
|
+
nt.gov.au
|
74
|
+
or.at.lv
|
75
|
+
org.uk.tc
|
76
|
+
os.hedmark.no
|
77
|
+
os.hordaland.no
|
78
|
+
pa.gov.pl
|
79
|
+
paginas.sapo.pt
|
80
|
+
perso.sfr.fr
|
81
|
+
plc.co.im
|
82
|
+
po.gov.pl
|
83
|
+
pref.aichi.jp
|
84
|
+
pref.akita.jp
|
85
|
+
pref.aomori.jp
|
86
|
+
pref.chiba.jp
|
87
|
+
pref.ehime.jp
|
88
|
+
pref.fukui.jp
|
89
|
+
pref.fukuoka.jp
|
90
|
+
pref.fukushima.jp
|
91
|
+
pref.gifu.jp
|
92
|
+
pref.gunma.jp
|
93
|
+
pref.hiroshima.jp
|
94
|
+
pref.hokkaido.jp
|
95
|
+
pref.hyogo.jp
|
96
|
+
pref.ibaraki.jp
|
97
|
+
pref.ishikawa.jp
|
98
|
+
pref.iwate.jp
|
99
|
+
pref.kagawa.jp
|
100
|
+
pref.kagoshima.jp
|
101
|
+
pref.kanagawa.jp
|
102
|
+
pref.kochi.jp
|
103
|
+
pref.kumamoto.jp
|
104
|
+
pref.kyoto.jp
|
105
|
+
pref.mie.jp
|
106
|
+
pref.miyagi.jp
|
107
|
+
pref.miyazaki.jp
|
108
|
+
pref.nagano.jp
|
109
|
+
pref.nagasaki.jp
|
110
|
+
pref.nara.jp
|
111
|
+
pref.niigata.jp
|
112
|
+
pref.oita.jp
|
113
|
+
pref.okayama.jp
|
114
|
+
pref.okinawa.jp
|
115
|
+
pref.osaka.jp
|
116
|
+
pref.saga.jp
|
117
|
+
pref.saitama.jp
|
118
|
+
pref.shiga.jp
|
119
|
+
pref.shimane.jp
|
120
|
+
pref.shizuoka.jp
|
121
|
+
pref.tochigi.jp
|
122
|
+
pref.tokushima.jp
|
123
|
+
pref.tottori.jp
|
124
|
+
pref.toyama.jp
|
125
|
+
pref.wakayama.jp
|
126
|
+
pref.yamagata.jp
|
127
|
+
pref.yamaguchi.jp
|
128
|
+
pref.yamanashi.jp
|
129
|
+
privat.t-online.de
|
130
|
+
profile.live.com
|
131
|
+
qld.edu.au
|
132
|
+
qld.gov.au
|
133
|
+
sa.edu.au
|
134
|
+
sa.gov.au
|
135
|
+
sakura.ne.jp
|
136
|
+
sande.more-og-romsdal.no
|
137
|
+
sande.vestfold.no
|
138
|
+
skydrive.live.com
|
139
|
+
so.gov.pl
|
140
|
+
spaces.live.com
|
141
|
+
spaces.msn.com
|
142
|
+
sr.gov.pl
|
143
|
+
starostwo.gov.pl
|
144
|
+
tas.edu.au
|
145
|
+
tas.gov.au
|
146
|
+
ug.gov.pl
|
147
|
+
um.gov.pl
|
148
|
+
upow.gov.pl
|
149
|
+
uw.gov.pl
|
150
|
+
valer.hedmark.no
|
151
|
+
valer.ostfold.no
|
152
|
+
vic.edu.au
|
153
|
+
vic.gov.au
|
154
|
+
wa.edu.au
|
155
|
+
wa.gov.au
|
156
|
+
web.aplus.net
|
157
|
+
web.fc2.com
|
158
|
+
web.officelive.com
|
data/test/test_dnsbl-client.rb
CHANGED
@@ -16,4 +16,29 @@ class TestDnsblClient < Test::Unit::TestCase
|
|
16
16
|
res = c.lookup("pfizer.viagra.aqybasej.gurdoctor.com")
|
17
17
|
assert(res.length >= 0)
|
18
18
|
end
|
19
|
+
|
20
|
+
should "normalize domains to two levels if it's neither in two-level nor three-level list" do
|
21
|
+
c = DNSBL::Client.new
|
22
|
+
|
23
|
+
assert_equal("example.org", c.normalize("example.org"))
|
24
|
+
assert_equal("example.org", c.normalize("www.example.org"))
|
25
|
+
assert_equal("example.org", c.normalize("foo.bar.baz.example.org"))
|
26
|
+
end
|
27
|
+
|
28
|
+
should "normaize domains to three levels if it's in two-level list" do
|
29
|
+
c = DNSBL::Client.new
|
30
|
+
|
31
|
+
assert_equal("example.co.uk", c.normalize("example.co.uk"))
|
32
|
+
assert_equal("example.co.uk", c.normalize("www.example.co.uk"))
|
33
|
+
assert_equal("example.co.uk", c.normalize("foo.bar.baz.example.co.uk"))
|
34
|
+
assert_equal("example.blogspot.com", c.normalize("example.blogspot.com"))
|
35
|
+
end
|
36
|
+
|
37
|
+
should "normalize domains to four levels if it's in three-level list" do
|
38
|
+
c = DNSBL::Client.new
|
39
|
+
|
40
|
+
assert_equal("example.act.edu.au", c.normalize("example.act.edu.au"))
|
41
|
+
assert_equal("example.act.edu.au", c.normalize("www.example.act.edu.au"))
|
42
|
+
assert_equal("example.act.edu.au", c.normalize("foo.bar.example.act.edu.au"))
|
43
|
+
end
|
19
44
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dnsbl-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Lee
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
6yhklP75
|
38
38
|
-----END CERTIFICATE-----
|
39
39
|
|
40
|
-
date: 2011-07-
|
40
|
+
date: 2011-07-16 00:00:00 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/dnsbl-client.rb
|
114
114
|
- lib/dnsbl-client/dnsbl-client.rb
|
115
115
|
- lib/dnsbl-client/dnsbl.yaml
|
116
|
+
- lib/dnsbl-client/three-level-tlds
|
116
117
|
- lib/dnsbl-client/two-level-tlds
|
117
118
|
- LICENSE.txt
|
118
119
|
- README.rdoc
|
metadata.gz.sig
CHANGED
Binary file
|