whois 3.3.1 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/CHANGELOG.md +736 -699
  2. data/data/tld.json +20 -5
  3. data/lib/whois/record/parser/base_icann_compliant.rb +20 -18
  4. data/lib/whois/record/parser/{whois.nic-se.se.rb → base_iisse.rb} +17 -16
  5. data/lib/whois/record/parser/whois.ascio.com.rb +198 -0
  6. data/lib/whois/record/parser/whois.cira.ca.rb +4 -4
  7. data/lib/whois/record/parser/whois.cnnic.cn.rb +7 -6
  8. data/lib/whois/record/parser/whois.co.ca.rb +6 -5
  9. data/lib/whois/record/parser/whois.denic.de.rb +1 -1
  10. data/lib/whois/record/parser/whois.dns.be.rb +20 -6
  11. data/lib/whois/record/parser/whois.enom.com.rb +3 -0
  12. data/lib/whois/record/parser/whois.gandi.net.rb +37 -29
  13. data/lib/whois/record/parser/whois.godaddy.com.rb +15 -15
  14. data/lib/whois/record/parser/whois.iis.nu.rb +28 -0
  15. data/lib/whois/record/parser/whois.iis.se.rb +28 -0
  16. data/lib/whois/record/parser/whois.jprs.jp.rb +6 -5
  17. data/lib/whois/record/parser/whois.nic.am.rb +3 -3
  18. data/lib/whois/record/parser/whois.nic.asia.rb +4 -0
  19. data/lib/whois/record/parser/whois.nic.bj.rb +128 -0
  20. data/lib/whois/record/parser/whois.nic.io.rb +23 -0
  21. data/lib/whois/record/parser/{whois.meregistry.net.rb → whois.nic.me.rb} +15 -15
  22. data/lib/whois/record/parser/{whois.nic.net.nf.rb → whois.nic.nf.rb} +2 -2
  23. data/lib/whois/record/parser/whois.nic.xxx.rb +10 -9
  24. data/lib/whois/record/parser/whois.register.com.rb +3 -134
  25. data/lib/whois/record/parser/whois.rrpproxy.net.rb +114 -0
  26. data/lib/whois/record/parser/whois.schlund.info.rb +26 -0
  27. data/lib/whois/record/parser/whois.udag.net.rb +26 -0
  28. data/lib/whois/record/parser/whois.yoursrs.com.rb +15 -14
  29. data/lib/whois/record/scanners/base.rb +6 -3
  30. data/lib/whois/record/scanners/base_icann_compliant.rb +4 -4
  31. data/lib/whois/record/scanners/{whois.nic-se.se.rb → base_iisse.rb} +7 -4
  32. data/lib/whois/record/scanners/scannable.rb +5 -2
  33. data/lib/whois/record/scanners/whois.ascio.com.rb +36 -0
  34. data/lib/whois/version.rb +2 -2
  35. data/whois.gemspec +3 -3
  36. metadata +14 -8
  37. data/lib/whois/record/parser/whois.nic.nu.rb +0 -96
  38. data/lib/whois/record/scanners/whois.gandi.net.rb +0 -49
@@ -43,11 +43,6 @@ module Whois
43
43
  !available?
44
44
  end
45
45
 
46
- # NEWPROPERTY
47
- def reserved?
48
- !!(content_for_scanner =~ /^Domain is not available or is reserved by the registry/)
49
- end
50
-
51
46
 
52
47
  property_supported :created_on do
53
48
  if content_for_scanner =~ /date_approved:\s+(.+)\n/
@@ -70,6 +65,12 @@ module Whois
70
65
  end
71
66
  end
72
67
 
68
+
69
+ # NEWPROPERTY
70
+ def reserved?
71
+ !!(content_for_scanner =~ /^Domain is not available or is reserved by the registry/)
72
+ end
73
+
73
74
  end
74
75
 
75
76
  end
@@ -150,7 +150,7 @@ module Whois
150
150
  end
151
151
 
152
152
 
153
- private
153
+ private
154
154
 
155
155
  def build_contact(element, type)
156
156
  node(element) do |raw|
@@ -33,10 +33,16 @@ module Whois
33
33
  property_supported :status do
34
34
  if content_for_scanner =~ /Status:\s+(.+?)\n/
35
35
  case $1.downcase
36
- when "available" then :available
37
- when "not available" then :registered
38
- when "quarantine" then :redemption
39
- when "out of service" then :redemption
36
+ when "available"
37
+ :available
38
+ when "not available"
39
+ :registered
40
+ when "quarantine"
41
+ :redemption
42
+ when "out of service"
43
+ :redemption
44
+ when "not allowed"
45
+ :invalid
40
46
  else
41
47
  Whois.bug!(ParserError, "Unknown status `#{$1}'.")
42
48
  end
@@ -46,11 +52,11 @@ module Whois
46
52
  end
47
53
 
48
54
  property_supported :available? do
49
- (status == :available)
55
+ !invalid? && (status == :available)
50
56
  end
51
57
 
52
58
  property_supported :registered? do
53
- !available?
59
+ !invalid? && !available?
54
60
  end
55
61
 
56
62
 
@@ -101,6 +107,14 @@ module Whois
101
107
  !!(content_for_scanner =~ /^-3: IP address blocked/)
102
108
  end
103
109
 
110
+
111
+ # NEWPROPERTY
112
+ def invalid?
113
+ cached_properties_fetch(:invalid?) do
114
+ status == :invalid
115
+ end
116
+ end
117
+
104
118
  end
105
119
 
106
120
  end
@@ -16,6 +16,9 @@ module Whois
16
16
 
17
17
  # Parser for the whois.enom.com server.
18
18
  class WhoisEnomCom < BaseIcannCompliant
19
+ self.scanner = Scanners::BaseIcannCompliant, {
20
+ pattern_available: /^Domain not found\.\n/
21
+ }
19
22
  end
20
23
 
21
24
  end
@@ -7,8 +7,8 @@
7
7
  #++
8
8
 
9
9
 
10
+ require 'yaml'
10
11
  require 'whois/record/parser/base'
11
- require 'whois/record/scanners/whois.gandi.net'
12
12
 
13
13
 
14
14
  module Whois
@@ -26,12 +26,8 @@ module Whois
26
26
  class WhoisGandiNet < Base
27
27
  include Scanners::Scannable
28
28
 
29
- self.scanner = Scanners::WhoisGandiNet
30
29
 
31
-
32
- property_supported :disclaimer do
33
- node("field:disclaimer")
34
- end
30
+ property_not_supported :disclaimer
35
31
 
36
32
 
37
33
  property_supported :domain do
@@ -59,22 +55,22 @@ module Whois
59
55
 
60
56
 
61
57
  property_supported :created_on do
62
- node("created") { |str| Time.parse(str) }
58
+ node("created")
63
59
  end
64
60
 
65
61
  property_supported :updated_on do
66
- node("changed") { |str| Time.parse(str) }
62
+ node("changed")
67
63
  end
68
64
 
69
65
  property_supported :expires_on do
70
- node("expires") { |str| Time.parse(str) }
66
+ node("expires")
71
67
  end
72
68
 
73
69
 
74
70
  property_supported :registrar do
75
71
  Record::Registrar.new(
76
- :name => 'GANDI Registrar',
77
- :organization => 'GANDI Registrar',
72
+ name: "GANDI Registrar",
73
+ organization: "GANDI Registrar",
78
74
  )
79
75
  end
80
76
 
@@ -95,17 +91,26 @@ module Whois
95
91
  property_supported :nameservers do
96
92
  content_for_scanner.scan(/^ns\d{1}:\s(.*)/).flatten.map do |line|
97
93
  name, ipv4 = line.strip.split(" ")
98
- Record::Nameserver.new(:name => name.downcase, :ipv4 => ipv4)
94
+ Record::Nameserver.new(name: name.downcase, ipv4: ipv4)
99
95
  end
100
96
  end
101
97
 
102
98
 
103
99
  private
104
100
 
105
- def build_contact(element, type)
106
- match = content_for_scanner.slice(/#{element}:\n((\s\s.+\n)*)/, 1)
107
- return unless match
101
+ def parse
102
+ patched = content_for_scanner.dup
103
+ patched.gsub!(/(zipcode|phone|fax): (.+)/, %Q{\\1: "\\2"})
104
+
105
+ result = YAML.load(patched)
106
+ unless result
107
+ result = {}
108
+ result["status:available"] = true
109
+ end
110
+ result
111
+ end
108
112
 
113
+ def build_contact(element, type)
109
114
  # nic-hdl: NG270-GANDI
110
115
  # organisation: GANDI SAS
111
116
  # person: NOC GANDI
@@ -117,20 +122,23 @@ module Whois
117
122
  # fax: +33.143731851
118
123
  # email: 12e7da77f638acdf8d9f4d0b828ca80c-248842@contact.gandi.net
119
124
  # lastupdated: 2013-04-04 15:53:42
120
- Record::Contact.new(
121
- :type => type,
122
- :id => match.slice(/nic-hdl: (.*)/, 1),
123
- :name => match.slice(/person: (.*)/, 1),
124
- :organization => match.slice(/organisation: (.*)/, 1),
125
- :address => match.slice(/address: (.*)/, 1),
126
- :zip => match.slice(/zipcode: (.*)/, 1),
127
- :city => match.slice(/city: (.*)/, 1),
128
- :country => match.slice(/country: (.*)/, 1),
129
- :phone => match.slice(/phone: (.*)/, 1),
130
- :fax => match.slice(/fax: (.*)/, 1),
131
- :email => match.slice(/email: (.*)/, 1),
132
- :updated_on => Time.parse(match.slice(/lastupdated: (.*)/, 1)),
133
- )
125
+
126
+ node(element) do |section|
127
+ Record::Contact.new(
128
+ type: type,
129
+ id: section["nic-hdl"],
130
+ name: section["person"],
131
+ organization: section["organisation"],
132
+ address: section["address"],
133
+ zip: section["zipcode"],
134
+ city: section["city"],
135
+ country: section["country"],
136
+ phone: section["phone"],
137
+ fax: section["fax"],
138
+ email: section["email"],
139
+ updated_on: section["lastupdated"],
140
+ )
141
+ end
134
142
  end
135
143
 
136
144
  end
@@ -57,8 +57,8 @@ module Whois
57
57
 
58
58
  property_supported :registrar do
59
59
  Record::Registrar.new(
60
- :name => content_for_scanner[/Registrar: (.+)\n/, 1],
61
- :url => "http://www.godaddy.com/"
60
+ name: content_for_scanner[/Registrar: (.+)\n/, 1],
61
+ url: "http://www.godaddy.com/"
62
62
  )
63
63
  end
64
64
 
@@ -76,7 +76,7 @@ module Whois
76
76
 
77
77
  property_supported :nameservers do
78
78
  content_for_scanner.scan(/Name Server: (.+)\n/).map do |line|
79
- Record::Nameserver.new(:name => line[0].strip)
79
+ Record::Nameserver.new(name: line[0].strip)
80
80
  end
81
81
  end
82
82
 
@@ -84,18 +84,18 @@ module Whois
84
84
 
85
85
  def build_contact(element, type)
86
86
  Record::Contact.new(
87
- :type => type,
88
- :id => nil,
89
- :name => value_for_property(element, 'Name'),
90
- :organization => value_for_property(element, 'Organization'),
91
- :address => value_for_property(element, 'Street'),
92
- :city => value_for_property(element, 'City'),
93
- :zip => value_for_property(element, 'Postal Code'),
94
- :state => value_for_property(element, 'State/Province'),
95
- :country => value_for_property(element, 'Country'),
96
- :phone => value_for_property(element, 'Phone'),
97
- :fax => value_for_property(element, 'Fax'),
98
- :email => value_for_property(element, 'Email')
87
+ type: type,
88
+ id: nil,
89
+ name: value_for_property(element, 'Name'),
90
+ organization: value_for_property(element, 'Organization'),
91
+ address: value_for_property(element, 'Street'),
92
+ city: value_for_property(element, 'City'),
93
+ zip: value_for_property(element, 'Postal Code'),
94
+ state: value_for_property(element, 'State/Province'),
95
+ country: value_for_property(element, 'Country'),
96
+ phone: value_for_property(element, 'Phone'),
97
+ fax: value_for_property(element, 'Fax'),
98
+ email: value_for_property(element, 'Email')
99
99
  )
100
100
  end
101
101
 
@@ -0,0 +1,28 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require 'whois/record/parser/base'
11
+ require 'whois/record/parser/base_iisse'
12
+
13
+
14
+ module Whois
15
+ class Record
16
+ class Parser
17
+
18
+ # Parser for the whois.iis.nu server.
19
+ #
20
+ # @see Whois::Record::Parser::Example
21
+ # The Example parser for the list of all available methods.
22
+ #
23
+ class WhoisIisNu < BaseIisse
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require 'whois/record/parser/base'
11
+ require 'whois/record/parser/base_iisse'
12
+
13
+
14
+ module Whois
15
+ class Record
16
+ class Parser
17
+
18
+ # Parser for the whois.iis.se server.
19
+ #
20
+ # @see Whois::Record::Parser::Example
21
+ # The Example parser for the list of all available methods.
22
+ #
23
+ class WhoisIisSe < BaseIisse
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -63,11 +63,6 @@ module Whois
63
63
  !available?
64
64
  end
65
65
 
66
- # NEWPROPERTY
67
- def reserved?
68
- status == :reserved
69
- end
70
-
71
66
 
72
67
  # TODO: timezone ('Asia/Tokyo')
73
68
  property_supported :created_on do
@@ -97,6 +92,12 @@ module Whois
97
92
  end
98
93
  end
99
94
 
95
+
96
+ # NEWPROPERTY
97
+ def reserved?
98
+ status == :reserved
99
+ end
100
+
100
101
  end
101
102
 
102
103
  end
@@ -48,19 +48,19 @@ module Whois
48
48
 
49
49
 
50
50
  property_supported :created_on do
51
- if content_for_scanner =~ /\s+Registered:\s+(.*)\n/
51
+ if content_for_scanner =~ /\s+Registered:\s+(.+)\n/
52
52
  Time.parse($1)
53
53
  end
54
54
  end
55
55
 
56
56
  property_supported :updated_on do
57
- if content_for_scanner =~ /\s+Last modified:\s+(.*)\n/
57
+ if content_for_scanner =~ /\s+Last modified:\s+(.+)\n/
58
58
  Time.parse($1)
59
59
  end
60
60
  end
61
61
 
62
62
  property_supported :expires_on do
63
- if content_for_scanner =~ /\s+Expires:\s+(.*)\n/
63
+ if content_for_scanner =~ /\s+Expires:\s+(.+)\n/
64
64
  Time.parse($1)
65
65
  end
66
66
  end
@@ -15,6 +15,10 @@ module Whois
15
15
  class Parser
16
16
 
17
17
  # Parser for the whois.nic.asia server.
18
+ #
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
21
+ #
18
22
  class WhoisNicAsia < BaseAfilias
19
23
 
20
24
  property_supported :status do
@@ -0,0 +1,128 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require 'whois/record/parser/base_afilias'
11
+
12
+
13
+ module Whois
14
+ class Record
15
+ class Parser
16
+
17
+ # Parser for the whois.nic.bj server.
18
+ #
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
21
+ #
22
+ class WhoisNicBj < Base
23
+
24
+
25
+ property_not_supported :disclaimer
26
+
27
+
28
+ property_supported :domain do
29
+ if section =~ /Domain Name:\s+(.+)\n/
30
+ $1
31
+ end
32
+ end
33
+
34
+ property_not_supported :domain_id
35
+
36
+
37
+ property_supported :status do
38
+ if available?
39
+ :available
40
+ else
41
+ :registered
42
+ end
43
+ end
44
+
45
+ property_supported :available? do
46
+ !!(content_for_scanner =~ /^No records matching/)
47
+ end
48
+
49
+ property_supported :registered? do
50
+ !available?
51
+ end
52
+
53
+
54
+ property_supported :created_on do
55
+ if section =~ /Created:\s+(.+)\n/
56
+ Time.parse($1)
57
+ end
58
+ end
59
+
60
+ property_supported :updated_on do
61
+ if section =~ /Updated:\s+(.+)\n/
62
+ Time.parse($1)
63
+ end
64
+ end
65
+
66
+ property_not_supported :expires_on
67
+
68
+
69
+ property_not_supported :registrar
70
+
71
+
72
+ property_supported :registrant_contacts do
73
+ if section =~ /Name:\s+(.+)\n/
74
+ Record::Contact.new(
75
+ type: Whois::Record::Contact::TYPE_REGISTRANT,
76
+ name: $1
77
+ )
78
+ end
79
+ end
80
+
81
+ property_not_supported :admin_contacts
82
+
83
+ property_not_supported :technical_contacts
84
+
85
+
86
+ property_supported :nameservers do
87
+ (1..4).map do |i|
88
+ section =~ /Name Server #{i}:\s+(.+)\n/ ? Record::Nameserver.new(name: $1) : nil
89
+ end.compact
90
+ end
91
+
92
+
93
+ private
94
+
95
+ def build_contact(element, type)
96
+ node("#{element} ID") do
97
+ address = ["", "2", "3"].
98
+ map { |i| node("#{element} Address#{i}") }.
99
+ delete_if(&:empty?).
100
+ join("\n")
101
+
102
+ Record::Contact.new(
103
+ :type => type,
104
+ :id => node("#{element} ID"),
105
+ :name => node("#{element} Name"),
106
+ :organization => node("#{element} Organization"),
107
+ :address => address,
108
+ :city => node("#{element} City"),
109
+ :zip => node("#{element} Postal Code"),
110
+ :state => node("#{element} State/Province"),
111
+ :country_code => node("#{element} Country/Economy"),
112
+ :phone => node("#{element} Phone"),
113
+ :fax => node("#{element} FAX"),
114
+ :email => node("#{element} E-mail")
115
+ )
116
+ end
117
+ end
118
+
119
+ def section
120
+ return @section if @section
121
+ @section = content_for_scanner =~ /((?:Domain:.+\n)(?:.+:.+\n)+)\n/ ? $1 : ""
122
+ end
123
+
124
+ end
125
+
126
+ end
127
+ end
128
+ end