whois 2.6.4 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG.md +39 -0
  2. data/LICENSE +2 -2
  3. data/README.md +1 -1
  4. data/lib/whois/definitions/tlds.rb +5 -4
  5. data/lib/whois/record/parser/NOTES.txt +0 -8
  6. data/lib/whois/record/parser/base_afilias.rb +2 -3
  7. data/lib/whois/record/parser/base_cocca.rb +6 -4
  8. data/lib/whois/record/parser/base_shared1.rb +120 -0
  9. data/lib/whois/record/parser/base_shared2.rb +143 -0
  10. data/lib/whois/record/parser/base_whoisd.rb +3 -3
  11. data/lib/whois/record/parser/whois.biz.rb +6 -113
  12. data/lib/whois/record/parser/whois.centralnic.com.rb +0 -1
  13. data/lib/whois/record/parser/whois.cmc.iq.rb +24 -0
  14. data/lib/whois/record/parser/whois.dk-hostmaster.dk.rb +10 -9
  15. data/lib/whois/record/parser/whois.dns.pl.rb +5 -1
  16. data/lib/whois/record/parser/whois.domain-registry.nl.rb +15 -12
  17. data/lib/whois/record/parser/whois.godaddy.com.rb +3 -2
  18. data/lib/whois/record/parser/whois.jprs.jp.rb +2 -0
  19. data/lib/whois/record/parser/whois.monic.mo.rb +90 -0
  20. data/lib/whois/record/parser/whois.na-nic.com.na.rb +8 -4
  21. data/lib/whois/record/parser/whois.netcom.cm.rb +2 -64
  22. data/lib/whois/record/parser/whois.networksolutions.com.rb +3 -0
  23. data/lib/whois/record/parser/whois.nic.co.rb +4 -49
  24. data/lib/whois/record/parser/whois.nic.dm.rb +142 -0
  25. data/lib/whois/record/parser/whois.nic.fo.rb +1 -1
  26. data/lib/whois/record/parser/whois.nic.gs.rb +9 -5
  27. data/lib/whois/record/parser/whois.nic.name.rb +26 -12
  28. data/lib/whois/record/parser/whois.nic.net.nf.rb +13 -7
  29. data/lib/whois/record/parser/whois.register.com.rb +158 -0
  30. data/lib/whois/record/parser/whois.registry.om.rb +2 -99
  31. data/lib/whois/record/parser/whois.registry.qa.rb +5 -95
  32. data/lib/whois/record/parser/whois.tld.ee.rb +1 -1
  33. data/lib/whois/record/parser/whois1.nic.bi.rb +23 -0
  34. data/lib/whois/record/scanners/base.rb +4 -0
  35. data/lib/whois/record/scanners/{afilias.rb → base_afilias.rb} +2 -2
  36. data/lib/whois/record/scanners/{whois.registry.om.rb → base_shared1.rb} +2 -5
  37. data/lib/whois/record/scanners/{whois.biz.rb → base_shared2.rb} +4 -3
  38. data/lib/whois/record/scanners/{whoisd.rb → base_whoisd.rb} +2 -2
  39. data/lib/whois/record/scanners/whois.nic.dm.rb +52 -0
  40. data/lib/whois/version.rb +2 -2
  41. data/whois.gemspec +4 -4
  42. metadata +15 -8
  43. data/lib/whois/record/scanners/whois.registry.qa.rb +0 -39
@@ -81,6 +81,9 @@ module Whois
81
81
  end
82
82
  end
83
83
 
84
+ def response_throttled?
85
+ !!(content_for_scanner =~ /The IP address from which you have visited/)
86
+ end
84
87
 
85
88
  private
86
89
 
@@ -7,64 +7,19 @@
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base'
10
+ require 'whois/record/parser/base_shared2'
11
11
 
12
12
 
13
13
  module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.nic.co parser
19
- #
20
17
  # Parser for the whois.nic.co server.
21
18
  #
22
- # NOTE: This parser is just a stub and provides only a few basic methods
23
- # to check for domain availability and get domain status.
24
- # Please consider to contribute implementing missing methods.
25
- # See WhoisNicIt parser for an explanation of all available methods
26
- # and examples.
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
27
21
  #
28
- class WhoisNicCo < Base
29
-
30
- property_supported :status do
31
- content_for_scanner.scan(/Domain Status:\s+(.*?)\n/).flatten
32
- end
33
-
34
- property_supported :available? do
35
- !!(content_for_scanner =~ /Not found:/)
36
- end
37
-
38
- property_supported :registered? do
39
- !available?
40
- end
41
-
42
-
43
- property_supported :created_on do
44
- if content_for_scanner =~ /Domain Registration Date:\s+(.*)\n/
45
- Time.parse($1)
46
- end
47
- end
48
-
49
- property_supported :updated_on do
50
- if content_for_scanner =~ /Domain Last Updated Date:\s+(.*)\n/
51
- Time.parse($1)
52
- end
53
- end
54
-
55
- property_supported :expires_on do
56
- if content_for_scanner =~ /Domain Expiration Date:\s+(.*)\n/
57
- Time.parse($1)
58
- end
59
- end
60
-
61
-
62
- property_supported :nameservers do
63
- content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
64
- Record::Nameserver.new(:name => name.downcase)
65
- end
66
- end
67
-
22
+ class WhoisNicCo < BaseShared2
68
23
  end
69
24
 
70
25
  end
@@ -0,0 +1,142 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require 'whois/record/parser/base'
11
+ require 'whois/record/scanners/whois.nic.dm.rb'
12
+
13
+
14
+ module Whois
15
+ class Record
16
+ class Parser
17
+
18
+ # Parser for the whois.nic.dm server.
19
+ #
20
+ # @see Whois::Record::Parser::Example
21
+ # The Example parser for the list of all available methods.
22
+ #
23
+ # @since RELEASE
24
+ class WhoisNicDm < Base
25
+ include Scanners::Ast
26
+
27
+ property_supported :disclaimer do
28
+ node("field:disclaimer")
29
+ end
30
+
31
+
32
+ property_supported :domain do
33
+ node("domain name", &:downcase)
34
+ end
35
+
36
+ property_not_supported :domain_id
37
+
38
+
39
+ property_not_supported :referral_whois
40
+
41
+ property_not_supported :referral_url
42
+
43
+
44
+ property_supported :status do
45
+ if available?
46
+ :available
47
+ else
48
+ :registered
49
+ end
50
+ end
51
+
52
+ property_supported :available? do
53
+ !!node("status:available")
54
+ end
55
+
56
+ property_supported :registered? do
57
+ !available?
58
+ end
59
+
60
+
61
+ property_supported :created_on do
62
+ node("created date") { |value| Time.parse(value) }
63
+ end
64
+
65
+ property_supported :updated_on do
66
+ node("updated date") { |value| Time.parse(value) }
67
+ end
68
+
69
+ property_supported :expires_on do
70
+ node("expiration date") { |value| Time.parse(value) }
71
+ end
72
+
73
+
74
+ property_supported :registrar do
75
+ node("registrar") do |raw|
76
+ Record::Registrar.new(
77
+ :id => nil,
78
+ :name => node("registrar"),
79
+ :organization => nil,
80
+ :url => node("url")
81
+ )
82
+ end
83
+ end
84
+
85
+ property_supported :registrant_contacts do
86
+ build_contact("owner", Whois::Record::Contact::TYPE_REGISTRANT)
87
+ end
88
+
89
+ property_supported :admin_contacts do
90
+ build_contact("admin", Whois::Record::Contact::TYPE_ADMIN)
91
+ end
92
+
93
+ property_supported :technical_contacts do
94
+ build_contact("tech", Whois::Record::Contact::TYPE_TECHNICAL)
95
+ end
96
+
97
+
98
+ property_supported :nameservers do
99
+ node("nameserver") do |array|
100
+ array.map do |name|
101
+ Nameserver.new(:name => name)
102
+ end
103
+ end
104
+ end
105
+
106
+
107
+ # Initializes a new {Scanners::WhoisDnsHr} instance
108
+ # passing the {#content_for_scanner}
109
+ # and calls +parse+ on it.
110
+ #
111
+ # @return [Hash]
112
+ def parse
113
+ Scanners::WhoisNicDm.new(content_for_scanner).parse
114
+ end
115
+
116
+
117
+ private
118
+
119
+ def build_contact(element, type)
120
+ node("#{element}-contact") do |raw|
121
+ Record::Contact.new(
122
+ :type => type,
123
+ :id => node("#{element}-contact"),
124
+ :name => node("#{element}-name"),
125
+ :organization => node("#{element}-organization"),
126
+ :address => node("#{element}-street"),
127
+ :city => node("#{element}-city"),
128
+ :zip => node("#{element}-zip"),
129
+ :state => nil,
130
+ :country_code => node("#{element}-country"),
131
+ :phone => nil,
132
+ :fax => nil,
133
+ :email => nil
134
+ )
135
+ end
136
+ end
137
+
138
+ end
139
+
140
+ end
141
+ end
142
+ end
@@ -19,7 +19,7 @@ module Whois
19
19
  # @see Whois::Record::Parser::Example
20
20
  # The Example parser for the list of all available methods.
21
21
  #
22
- # @since RELEASE
22
+ # @since 2.6.4
23
23
  class WhoisNicFo < BaseWhoisd
24
24
 
25
25
  property_not_supported :registrar
@@ -19,11 +19,15 @@ module Whois
19
19
 
20
20
  property_supported :status do
21
21
  if content_for_scanner =~ /Status:\s+(.+?)\n/
22
- case s = $1.downcase
23
- when "active" then :registered
24
- when "delegated" then :registered
25
- when "not registered" then :available
26
- when /pending delete/ then :redemption
22
+ case (s = $1.downcase)
23
+ when "active"
24
+ :registered
25
+ when "delegated"
26
+ :registered
27
+ when "not registered"
28
+ :available
29
+ when /pending delete/
30
+ :redemption
27
31
  else
28
32
  Whois.bug!(ParserError, "Unknown status `#{s}'.")
29
33
  end
@@ -14,16 +14,14 @@ module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.nic.name parser
19
- #
20
17
  # Parser for the whois.nic.name server.
21
18
  #
22
- # NOTE: This parser is just a stub and provides only a few basic methods
23
- # to check for domain availability and get domain status.
24
- # Please consider to contribute implementing missing methods.
25
- # See WhoisNicIt parser for an explanation of all available methods
26
- # and examples.
19
+ # @note This parser is just a stub and provides only a few basic methods
20
+ # to check for domain availability and get domain status.
21
+ # Please consider to contribute implementing missing methods.
22
+ #
23
+ # @see Whois::Record::Parser::Example
24
+ # The Example parser for the list of all available methods.
27
25
  #
28
26
  class WhoisNicName < Base
29
27
 
@@ -40,14 +38,30 @@ module Whois
40
38
  end
41
39
 
42
40
 
43
- property_not_supported :created_on
41
+ property_supported :created_on do
42
+ if content_for_scanner =~ /Created On: (.+)\n/
43
+ Time.parse($1)
44
+ end
45
+ end
44
46
 
45
- property_not_supported :updated_on
47
+ property_supported :updated_on do
48
+ if content_for_scanner =~ /Updated On: (.+)\n/
49
+ Time.parse($1)
50
+ end
51
+ end
46
52
 
47
- property_not_supported :expires_on
53
+ property_supported :expires_on do
54
+ if content_for_scanner =~ /Expires On: (.+)\n/
55
+ Time.parse($1)
56
+ end
57
+ end
48
58
 
49
59
 
50
- property_not_supported :nameservers
60
+ property_supported :nameservers do
61
+ content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
62
+ Record::Nameserver.new(:name => name.downcase)
63
+ end
64
+ end
51
65
 
52
66
  end
53
67
 
@@ -19,13 +19,19 @@ module Whois
19
19
 
20
20
  property_supported :status do
21
21
  if content_for_scanner =~ /Status:\s+(.+?)\n/
22
- case s = $1.downcase
23
- when "active" then :registered
24
- when "delegated" then :registered
25
- when "not registered" then :available
26
- when /pending delete/ then :redemption
27
- when /pending purge/ then :redemption
28
- when /not have any records for that zone/ then :invalid
22
+ case (s = $1.downcase)
23
+ when "active"
24
+ :registered
25
+ when "delegated"
26
+ :registered
27
+ when "not registered"
28
+ :available
29
+ when /pending delete/
30
+ :redemption
31
+ when /pending purge/
32
+ :redemption
33
+ when /not have any records for that zone/
34
+ :invalid
29
35
  else
30
36
  Whois.bug!(ParserError, "Unknown status `#{s}'.")
31
37
  end
@@ -0,0 +1,158 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require 'whois/record/parser/base'
11
+
12
+
13
+ module Whois
14
+ class Record
15
+ class Parser
16
+
17
+ # Parser for the whois.register.com server.
18
+ #
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
21
+ class WhoisRegisterCom < Base
22
+
23
+ property_not_supported :status
24
+
25
+ # The server is contacted only in case of a registered domain.
26
+ property_supported :available? do
27
+ false
28
+ end
29
+
30
+ property_supported :registered? do
31
+ !available?
32
+ end
33
+
34
+
35
+ property_supported :created_on do
36
+ if content_for_scanner =~ /(?:Created on\.+|Creation date): (.+)\n/
37
+ Time.parse($1)
38
+ end
39
+ end
40
+
41
+ property_not_supported :updated_on
42
+
43
+ property_supported :expires_on do
44
+ if content_for_scanner =~ /(?:Expires on\.+|Expiration date): (.+)\n/
45
+ Time.parse($1)
46
+ end
47
+ end
48
+
49
+
50
+ property_supported :registrar do
51
+ Record::Registrar.new(
52
+ :name => 'Register.com',
53
+ :organization => 'Register.com',
54
+ :url => 'http://www.register.com/'
55
+ )
56
+ end
57
+
58
+ property_supported :registrant_contacts do
59
+ build_contact(/Registrant(?: Contact)?:/, Record::Contact::TYPE_REGISTRANT)
60
+ end
61
+
62
+ property_supported :admin_contacts do
63
+ build_contact(/Administrative Contact:/, Record::Contact::TYPE_ADMIN)
64
+ end
65
+
66
+ property_supported :technical_contacts do
67
+ build_contact(/Technical\s+Contact:/, Record::Contact::TYPE_TECHNICAL)
68
+ end
69
+
70
+
71
+ property_supported :nameservers do
72
+ if content_for_scanner =~ /(?:DNS|Name) Servers:\n((.+\n)+)\n/
73
+ $1.split("\n").map do |line|
74
+ Record::Nameserver.new(:name => line.strip)
75
+ end
76
+ end
77
+ end
78
+
79
+
80
+ private
81
+
82
+ def build_contact(element, type)
83
+ if content_for_scanner.match /DNS Servers/
84
+ build_register_contact(element, type)
85
+ else
86
+ build_enom_contact(element, type)
87
+ end
88
+ end
89
+
90
+ def build_register_contact(element, type)
91
+ match = content_for_scanner.slice(/#{element}\n((.+\n){7})/, 1)
92
+ return unless match
93
+
94
+ lines = match.split("\n").map(&:strip)
95
+
96
+ # 0 Register.Com, Inc.
97
+ # 1 Domain Registrar
98
+ # 2 575 8th Avenue
99
+ # 3 New York, NY 10018
100
+ # 4 US
101
+ # 5 Phone: +1.9027492701
102
+ # 6 Email: domainregistrar@register.com
103
+ city, state, zip = lines[3].scan(/^(.+), ([A-Z]{2}) ([0-9]+)$/).first
104
+ phone = lines[5].slice(/Phone: (.+)/, 1)
105
+ email = lines[6].slice(/Email: (.+)/, 1)
106
+ Record::Contact.new(
107
+ :type => type,
108
+ :name => lines[1],
109
+ :organization => lines[0],
110
+ :address => lines[2],
111
+ :city => city,
112
+ :state => state,
113
+ :zip => zip,
114
+ :country_code => lines[4],
115
+ :email => email,
116
+ :phone => phone
117
+ )
118
+ end
119
+
120
+ def build_enom_contact(element, type)
121
+ match = content_for_scanner.slice(/#{element}\n(((\s{3}+.*)\n)+)/, 1)
122
+ return unless match
123
+
124
+ # 0 AdBrite, Inc.
125
+ # 1 Host Master (hostmaster@adbrite.com)
126
+ # 2 4159750916
127
+ # 3 Fax:
128
+ # 4 731 Market Street, Suite 500
129
+ # 5 San Francisco, CA 94103
130
+ # 6 US
131
+
132
+ lines = match.split("\n").map(&:lstrip)
133
+ name, email = lines[1].match(/(.*)\((.*)\)/)[1..2].map(&:strip)
134
+ fax_match = lines[3].match(/Fax: (.*)/)
135
+ fax = fax_match[1] if fax_match
136
+ city, state, zip = lines[-2].match(/(.*),(.+?)(\d*)$/)[1..3].map(&:strip)
137
+
138
+ Record::Contact.new(
139
+ :type => type,
140
+ :id => nil,
141
+ :name => name,
142
+ :organization => lines[0],
143
+ :address => lines[4..-3].join("\n"),
144
+ :city => city,
145
+ :zip => zip,
146
+ :state => state,
147
+ :country_code => lines[-1],
148
+ :phone => lines[2] == "" ? nil : lines[2],
149
+ :fax => fax,
150
+ :email => email == "" ? nil : email
151
+ )
152
+ end
153
+
154
+ end
155
+
156
+ end
157
+ end
158
+ end