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
@@ -7,8 +7,7 @@
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base'
11
- require 'whois/record/scanners/whois.biz.rb'
10
+ require 'whois/record/parser/base_shared2'
12
11
 
13
12
 
14
13
  module Whois
@@ -16,117 +15,11 @@ module Whois
16
15
  class Parser
17
16
 
18
17
  # Parser for the whois.biz server.
19
- class WhoisBiz < Base
20
- include Scanners::Ast
21
-
22
- # Actually the :disclaimer is supported,
23
- # but extracting it with the current scanner
24
- # would require too much effort.
25
- # property_supported :disclaimer
26
-
27
-
28
- property_supported :domain do
29
- node("Domain Name", &:downcase)
30
- end
31
-
32
- property_supported :domain_id do
33
- node("Domain ID")
34
- end
35
-
36
-
37
- property_not_supported :referral_whois
38
-
39
- property_not_supported :referral_url
40
-
41
-
42
- property_supported :status do
43
- node("Domain Status")
44
- end
45
-
46
- property_supported :available? do
47
- !!node("status:available")
48
- end
49
-
50
- property_supported :registered? do
51
- !available?
52
- end
53
-
54
-
55
- property_supported :created_on do
56
- node("Domain Registration Date") { |value| Time.parse(value) }
57
- end
58
-
59
- property_supported :updated_on do
60
- node("Domain Last Updated Date") { |value| Time.parse(value) }
61
- end
62
-
63
- property_supported :expires_on do
64
- node("Domain Expiration Date") { |value| Time.parse(value) }
65
- end
66
-
67
-
68
- property_supported :registrar do
69
- node("Sponsoring Registrar") do |str|
70
- Record::Registrar.new(
71
- :id => node("Sponsoring Registrar IANA ID"),
72
- :name => node("Sponsoring Registrar")
73
- )
74
- end
75
- end
76
-
77
-
78
- property_supported :registrant_contacts do
79
- build_contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
80
- end
81
-
82
- property_supported :admin_contacts do
83
- build_contact("Administrative Contact", Whois::Record::Contact::TYPE_ADMIN)
84
- end
85
-
86
- property_supported :technical_contacts do
87
- build_contact("Technical Contact", Whois::Record::Contact::TYPE_TECHNICAL)
88
- end
89
-
90
-
91
- property_supported :nameservers do
92
- Array.wrap(node("Name Server")).map do |name|
93
- Nameserver.new(:name => name.downcase)
94
- end
95
- end
96
-
97
-
98
- # Initializes a new {Scanners::WhoisBiz} instance
99
- # passing the {#content_for_scanner}
100
- # and calls +parse+ on it.
101
- #
102
- # @return [Hash]
103
- def parse
104
- Scanners::WhoisBiz.new(content_for_scanner).parse
105
- end
106
-
107
-
108
- private
109
-
110
- def build_contact(element, type)
111
- node("#{element} ID") do |str|
112
- Record::Contact.new(
113
- :type => type,
114
- :id => node("#{element} ID"),
115
- :name => node("#{element} Name"),
116
- :organization => node("#{element} Organization"),
117
- :address => node("#{element} Address1"),
118
- :city => node("#{element} City"),
119
- :zip => node("#{element} Postal Code"),
120
- :state => node("#{element} State/Province"),
121
- :country => node("#{element} Country"),
122
- :country_code => node("#{element} Country Code"),
123
- :phone => node("#{element} Phone Number"),
124
- :fax => node("#{element} Facsimile Number"),
125
- :email => node("#{element} Email")
126
- )
127
- end
128
- end
129
-
18
+ #
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
21
+ #
22
+ class WhoisBiz < BaseShared2
130
23
  end
131
24
 
132
25
  end
@@ -76,7 +76,6 @@ module Whois
76
76
  end
77
77
  end
78
78
 
79
-
80
79
  property_supported :registrant_contacts do
81
80
  build_contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
82
81
  end
@@ -0,0 +1,24 @@
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_cocca'
11
+
12
+
13
+ module Whois
14
+ class Record
15
+ class Parser
16
+
17
+ # Parser for the whois.cmc.iq server.
18
+ class WhoisCmcIq < BaseCocca
19
+ property_not_supported :nameservers
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -14,16 +14,14 @@ module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.dk-hostmaster.dk
19
- #
20
17
  # Parser for the whois.dk-hostmaster.dk 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
  # @author Simone Carletti <weppos@weppos.net>
29
27
  # @author Mikkel Kristensen <mikkel@tdx.dk>
@@ -33,7 +31,10 @@ module Whois
33
31
  property_supported :status do
34
32
  if content_for_scanner =~ /Status:\s+(.+?)\n/
35
33
  case $1.downcase
36
- when "active" then :registered
34
+ when "active"
35
+ :registered
36
+ when "deactivated"
37
+ :expired
37
38
  else
38
39
  Whois.bug!(ParserError, "Unknown status `#{$1}'.")
39
40
  end
@@ -56,7 +56,11 @@ module Whois
56
56
  end
57
57
  end
58
58
 
59
- property_not_supported :expires_on
59
+ property_supported :expires_on do
60
+ if content_for_scanner =~ /renewal date:\s+(.+?)\n/
61
+ Time.parse($1)
62
+ end
63
+ end
60
64
 
61
65
 
62
66
  property_supported :nameservers do
@@ -14,16 +14,14 @@ module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.domain-registry.nl parser
19
- #
20
17
  # Parser for the whois.domain-registry.nl 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 WhoisDomainRegistryNl < Base
29
27
 
@@ -38,12 +36,17 @@ module Whois
38
36
  # - in quarantine: this .nl domain name's registration has been cancelled. Following cancellation, a domain name is placed in quarantine for forty days.
39
37
  #
40
38
  # @see https://www.sidn.nl/en/whois/
39
+ # @see https://www.sidn.nl/en/about-nl/whois/looking-up-a-domain-name/
41
40
  #
42
41
  property_supported :status do
43
- if content_for_scanner =~ /Status:\s+(.*?)\n/
42
+ if content_for_scanner =~ /Status:\s+(.+?)\n/
44
43
  case $1.downcase
45
- when "active" then :registered
46
- when "in quarantine" then :redemption
44
+ when "active"
45
+ :registered
46
+ when "in quarantine"
47
+ :redemption
48
+ when "inactive"
49
+ :inactive
47
50
  else
48
51
  Whois.bug!(ParserError, "Unknown status `#{$1}'.")
49
52
  end
@@ -57,7 +60,7 @@ module Whois
57
60
  end
58
61
 
59
62
  property_supported :registered? do
60
- [:registered, :redemption].include?(status)
63
+ status != :available
61
64
  end
62
65
 
63
66
 
@@ -90,8 +90,6 @@ module Whois
90
90
  match = content_for_scanner.slice(/#{element}\n((.+\n)+)\n/, 1)
91
91
  return unless match
92
92
 
93
- lines = $1.split("\n").map(&:strip)
94
-
95
93
  # Lines 1 and 5 may be absent, depending on the record.
96
94
  # The parser attempts to correct for this, but may be a bit flaky
97
95
  # on non-standard data.
@@ -102,6 +100,9 @@ module Whois
102
100
  # 3 Scottsdale, Arizona 85260
103
101
  # 4 United States
104
102
  # 5 +1.4805058800 Fax -- +1.4805058844
103
+
104
+ lines = $1.split("\n").map(&:strip)
105
+
105
106
  phone = nil
106
107
  fax = nil
107
108
  if lines[-1].to_s =~ /Fax --/
@@ -33,6 +33,8 @@ module Whois
33
33
  :reserved
34
34
  when "to be suspended"
35
35
  :redemption
36
+ when "suspended"
37
+ :expired
36
38
  else
37
39
  Whois.bug!(ParserError, "Unknown status `#{$1}'.")
38
40
  end
@@ -0,0 +1,90 @@
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.monic.mo server.
18
+ #
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
21
+ #
22
+ class WhoisMonicMo < Base
23
+
24
+ property_not_supported :disclaimer
25
+
26
+
27
+ property_supported :domain do
28
+ if content_for_scanner =~ /Domain Name:\s+(.+)\n/
29
+ $1.downcase
30
+ end
31
+ end
32
+
33
+ property_not_supported :domain_id
34
+
35
+
36
+ property_not_supported :referral_whois
37
+
38
+ property_not_supported :referral_url
39
+
40
+
41
+ property_supported :status do
42
+ if available?
43
+ :available
44
+ else
45
+ :registered
46
+ end
47
+ end
48
+
49
+ property_supported :available? do
50
+ !!(content_for_scanner =~ /No match for/)
51
+ end
52
+
53
+ property_supported :registered? do
54
+ !available?
55
+ end
56
+
57
+
58
+ property_not_supported :created_on
59
+
60
+ property_not_supported :updated_on
61
+
62
+ property_not_supported :expires_on
63
+
64
+
65
+ property_supported :registrar do
66
+ if content_for_scanner =~ /Registrar:\s+(.+)\n/
67
+ Record::Registrar.new(
68
+ :name => $1
69
+ )
70
+ end
71
+ end
72
+
73
+ property_not_supported :registrant_contacts
74
+
75
+ property_not_supported :admin_contacts
76
+
77
+ property_not_supported :technical_contacts
78
+
79
+
80
+ property_supported :nameservers do
81
+ content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
82
+ Record::Nameserver.new(:name => name.downcase)
83
+ end
84
+ end
85
+
86
+ end
87
+
88
+ end
89
+ end
90
+ end
@@ -20,10 +20,14 @@ module Whois
20
20
  property_supported :status do
21
21
  if content_for_scanner =~ /Status:\s+(.+?)\n/
22
22
  case $1.downcase
23
- when "active" then :registered
24
- when "delegated" then :registered
25
- when "not registered" then :available
26
- when "suspended" then :inactive
23
+ when "active"
24
+ :registered
25
+ when "delegated"
26
+ :registered
27
+ when "not registered"
28
+ :available
29
+ when "suspended"
30
+ :inactive
27
31
  else
28
32
  Whois.bug!(ParserError, "Unknown status `#{$1}'.")
29
33
  end
@@ -7,77 +7,15 @@
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base'
10
+ require 'whois/record/parser/base_cocca'
11
11
 
12
12
 
13
13
  module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.netcom.cm parser
19
- #
20
17
  # Parser for the whois.netcom.cm server.
21
- #
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.
27
- #
28
- class WhoisNetcomCm < Base
29
-
30
- property_supported :status do
31
- if content_for_scanner =~ /Status:\s+(.+?)\n/
32
- case $1.downcase
33
- when "active"
34
- :registered
35
- when "not registered"
36
- :available
37
- else
38
- Whois.bug!(ParserError, "Unknown status `#{$1}'.")
39
- end
40
- else
41
- Whois.bug!(ParserError, "Unable to parse status.")
42
- end
43
- end
44
-
45
- property_supported :available? do
46
- status == :available
47
- end
48
-
49
- property_supported :registered? do
50
- !available?
51
- end
52
-
53
-
54
- property_supported :created_on do
55
- if content_for_scanner =~ /Created:\s+(.+?)\n/
56
- Time.parse($1)
57
- end
58
- end
59
-
60
- property_supported :updated_on do
61
- if content_for_scanner =~ /Modified:\s+(.+?)\n/
62
- Time.parse($1)
63
- end
64
- end
65
-
66
- property_supported :expires_on do
67
- if content_for_scanner =~ /Expires:\s+(.+?)\n/
68
- Time.parse($1)
69
- end
70
- end
71
-
72
-
73
- property_supported :nameservers do
74
- if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
75
- $1.split("\n").map do |name|
76
- Record::Nameserver.new(:name => name.strip)
77
- end
78
- end
79
- end
80
-
18
+ class WhoisNetcomCm < BaseCocca
81
19
  end
82
20
 
83
21
  end