whois 2.6.1 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG.md +11 -0
  2. data/lib/whois/definitions/tlds.rb +1 -0
  3. data/lib/whois/record/parser/whois.ati.tn.rb +1 -1
  4. data/lib/whois/record/parser/whois.godaddy.com.rb +0 -4
  5. data/lib/whois/record/parser/whois.markmonitor.com.rb +0 -4
  6. data/lib/whois/record/parser/whois.networksolutions.com.rb +146 -0
  7. data/lib/whois/record/parser/whois.registry.om.rb +1 -1
  8. data/lib/whois/record/parser/whois.sx.rb +124 -0
  9. data/lib/whois/record/parser/whois.ua.rb +70 -10
  10. data/lib/whois/record/scanners/base.rb +19 -6
  11. data/lib/whois/record/scanners/whois.ati.tn.rb +1 -1
  12. data/lib/whois/record/scanners/whois.registry.om.rb +1 -1
  13. data/lib/whois/record/scanners/whois.rnids.rs.rb +11 -11
  14. data/lib/whois/record/scanners/whois.sx.rb +81 -0
  15. data/lib/whois/version.rb +1 -1
  16. data/spec/fixtures/responses/whois.networksolutions.com/property_contacts_short.expected +47 -0
  17. data/spec/fixtures/responses/whois.networksolutions.com/property_contacts_short.txt +61 -0
  18. data/spec/fixtures/responses/whois.networksolutions.com/status_registered.expected +89 -0
  19. data/spec/fixtures/responses/whois.networksolutions.com/status_registered.txt +65 -0
  20. data/spec/fixtures/responses/whois.sx/status_available.expected +55 -0
  21. data/spec/fixtures/responses/whois.sx/status_available.txt +9 -0
  22. data/spec/fixtures/responses/whois.sx/status_registered.expected +85 -0
  23. data/spec/fixtures/responses/whois.sx/status_registered.txt +21 -0
  24. data/spec/fixtures/responses/whois.ua/property_contacts_multiple.expected +107 -0
  25. data/spec/fixtures/responses/whois.ua/property_contacts_multiple.txt +84 -0
  26. data/spec/fixtures/responses/whois.ua/status_available.expected +30 -1
  27. data/spec/fixtures/responses/whois.ua/status_registered.expected +65 -3
  28. data/spec/fixtures/responses/whois.ua/status_registered.txt +10 -9
  29. data/spec/tlds +1 -0
  30. data/spec/whois/record/parser/responses/whois.net.ua/property_contacts_multiple_spec.rb +157 -0
  31. data/spec/whois/record/parser/responses/whois.net.ua/property_nameservers_uppercase_spec.rb +4 -4
  32. data/spec/whois/record/parser/responses/whois.net.ua/status_available_spec.rb +47 -5
  33. data/spec/whois/record/parser/responses/whois.net.ua/status_registered_spec.rb +82 -7
  34. data/spec/whois/record/parser/responses/whois.networksolutions.com/property_contacts_short_spec.rb +77 -0
  35. data/spec/whois/record/parser/responses/whois.networksolutions.com/status_registered_spec.rb +133 -0
  36. data/spec/whois/record/parser/responses/whois.sx/status_available_spec.rb +106 -0
  37. data/spec/whois/record/parser/responses/whois.sx/status_registered_spec.rb +136 -0
  38. data/spec/whois/record/parser/responses/whois.ua/property_contacts_multiple_spec.rb +157 -0
  39. data/spec/whois/record/parser/responses/whois.ua/status_available_spec.rb +43 -1
  40. data/spec/whois/record/parser/responses/whois.ua/status_registered_spec.rb +78 -3
  41. data/whois.gemspec +4 -4
  42. metadata +22 -3
@@ -62,20 +62,33 @@ module Whois
62
62
  protected
63
63
 
64
64
  def _scan_lines_to_array(pattern)
65
- lines = []
65
+ results = []
66
66
  while @input.scan(pattern)
67
67
  @input[1].strip
68
- lines << @input[1].strip
68
+ results << @input[1].strip
69
69
  end
70
- lines
70
+ results
71
71
  end
72
72
 
73
73
  def _scan_lines_to_hash(pattern)
74
- lines = {}
74
+ results = {}
75
75
  while @input.scan(pattern)
76
- lines.merge! @input[1].strip => @input[2].strip
76
+ results.merge! @input[1].strip => @input[2].strip
77
+ end
78
+ results
79
+ end
80
+
81
+ def _scan_keyvalues(pattern)
82
+ results = []
83
+ while @input.scan(/(.+?):(.*?)\n/)
84
+ key, value = @input[1].strip, @input[2].strip
85
+ if results[key].nil?
86
+ results[key] = value
87
+ else
88
+ results[key] = Array.wrap(results[key])
89
+ results[key] << value
90
+ end
77
91
  end
78
- lines
79
92
  end
80
93
 
81
94
  private
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.ati.tn record.
18
18
  #
19
- # @since RELEASE
19
+ # @since 2.6.0
20
20
  class WhoisAtiTn < Base
21
21
 
22
22
  self.tokenizers += [
@@ -16,7 +16,7 @@ module Whois
16
16
 
17
17
  # Scanner for the whois.registry.om record.
18
18
  #
19
- # @since RELEASE
19
+ # @since 2.6.0
20
20
  class WhoisRegistryOm < Base
21
21
 
22
22
  self.tokenizers += [
@@ -22,15 +22,15 @@ module Whois
22
22
  self.tokenizers += [
23
23
  :scan_available,
24
24
  :skip_comment,
25
- :flag_group_start,
26
- :scan_group_keyvalue,
27
- :flag_group_end,
25
+ :flag_section_start,
26
+ :scan_section_keyvalue,
27
+ :flag_section_end,
28
28
  :skip_empty_line,
29
29
  :skip_privacy,
30
30
  ]
31
31
 
32
32
 
33
- GROUPS = ["Owner", "Administrative contact", "Technical contact"]
33
+ SECTIONS = ["Owner", "Administrative contact", "Technical contact"]
34
34
 
35
35
  tokenizer :scan_available do
36
36
  if @input.scan(/^%ERROR:103: Domain is not registered/)
@@ -38,23 +38,23 @@ module Whois
38
38
  end
39
39
  end
40
40
 
41
- tokenizer :flag_group_start do
42
- if GROUPS.any? { |group| @input.check(/^(#{group}):/) }
43
- @tmp["group"] = @input[1]
41
+ tokenizer :flag_section_start do
42
+ if SECTIONS.any? { |section| @input.check(/^(#{section}):/) }
43
+ @tmp["section"] = @input[1]
44
44
  end
45
45
  false
46
46
  end
47
47
 
48
- tokenizer :flag_group_end do
48
+ tokenizer :flag_section_end do
49
49
  if @input.match?(/^\n/)
50
- @tmp.delete("group")
50
+ @tmp.delete("section")
51
51
  end
52
52
  end
53
53
 
54
- tokenizer :scan_group_keyvalue do
54
+ tokenizer :scan_section_keyvalue do
55
55
  if @input.scan(/(.+?):(.*?)\n/)
56
56
  key, value = @input[1].strip, @input[2].strip
57
- target = @tmp["group"] ? (@ast[@tmp["group"]] ||= {}) : @ast
57
+ target = @tmp["section"] ? (@ast[@tmp["section"]] ||= {}) : @ast
58
58
 
59
59
  if target[key].nil?
60
60
  target[key] = value
@@ -0,0 +1,81 @@
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/scanners/base'
11
+
12
+
13
+ module Whois
14
+ class Record
15
+ module Scanners
16
+
17
+ # Scanner for the whois.sx record.
18
+ #
19
+ # @since RELEASE
20
+ class WhoisSx < Base
21
+
22
+ self.tokenizers += [
23
+ :skip_header,
24
+ :skip_comments,
25
+ :skip_empty_line,
26
+ :flag_section_start,
27
+ :flag_section_end,
28
+ :scan_section,
29
+ :scan_keyvalue,
30
+ ]
31
+
32
+
33
+ tokenizer :skip_header do
34
+ if @input.pos == 0 && @input.match?(/^\[/)
35
+ @input.skip_until(/\n/)
36
+ end
37
+ end
38
+
39
+ tokenizer :skip_comments do
40
+ if @input.match?(/^%/)
41
+ @input.skip_until(/\n/)
42
+ end
43
+ end
44
+
45
+ tokenizer :flag_section_start do
46
+ if @input.scan(/(.+?):\n/)
47
+ @tmp['section'] = @input[1].strip
48
+ end
49
+ end
50
+
51
+ tokenizer :flag_section_end do
52
+ # if @input.match?(/^\n/)
53
+ # @tmp.delete('section')
54
+ # end
55
+ end
56
+
57
+ tokenizer :scan_section do
58
+ if @tmp['section']
59
+ lines = _scan_lines_to_array(/^(.+)\n/)
60
+
61
+ # Check all lines to be sure there is no case where a value containing a :
62
+ # is misinterpreted as key : value.
63
+
64
+ # The section is a hash
65
+ value = if lines.all? { |line| line.index(':', 1) }
66
+ Hash[lines.map { |line| line.split(':', 2).map(&:strip) }]
67
+ # The section is an array of values
68
+ else
69
+ lines
70
+ end
71
+
72
+ @ast[@tmp['section']] = value
73
+ @tmp.delete('section')
74
+ end
75
+ end
76
+
77
+ end
78
+
79
+ end
80
+ end
81
+ end
data/lib/whois/version.rb CHANGED
@@ -13,7 +13,7 @@ module Whois
13
13
  module Version
14
14
  MAJOR = 2
15
15
  MINOR = 6
16
- PATCH = 1
16
+ PATCH = 2
17
17
  BUILD = nil
18
18
 
19
19
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join(".")
@@ -0,0 +1,47 @@
1
+
2
+ #registrant_contacts
3
+ should: %s CLASS(array)
4
+ should: %s SIZE(1)
5
+ should: %s[0] CLASS(contact)
6
+ should: %s[0].type == Whois::Record::Contact::TYPE_REGISTRANT
7
+ should: %s[0].organization == "mpowers LLC"
8
+ should: %s[0].address == "21010 Southbank St #575"
9
+ should: %s[0].city == "Potomac Falls"
10
+ should: %s[0].zip == "20165"
11
+ should: %s[0].state == "VA"
12
+ should: %s[0].country_code == "US"
13
+ should: %s[0].phone == nil
14
+ should: %s[0].fax == nil
15
+ should: %s[0].email == nil
16
+
17
+ #admin_contacts
18
+ should: %s CLASS(array)
19
+ should: %s SIZE(1)
20
+ should: %s[0] CLASS(contact)
21
+ should: %s[0].type == Whois::Record::Contact::TYPE_ADMIN
22
+ should: %s[0].name == "mpowers LLC"
23
+ should: %s[0].organization == nil
24
+ should: %s[0].address == "21010 Southbank St #575"
25
+ should: %s[0].city == "Potomac Falls"
26
+ should: %s[0].zip == "20165"
27
+ should: %s[0].state == "VA"
28
+ should: %s[0].country_code == "US"
29
+ should: %s[0].phone == "+1.5712832829"
30
+ should: %s[0].fax == nil
31
+ should: %s[0].email == "michael@mpowers.net"
32
+
33
+ #technical_contacts
34
+ should: %s CLASS(array)
35
+ should: %s SIZE(1)
36
+ should: %s[0] CLASS(contact)
37
+ should: %s[0].type == Whois::Record::Contact::TYPE_TECHNICAL
38
+ should: %s[0].name == "mpowers LLC"
39
+ should: %s[0].organization == nil
40
+ should: %s[0].address == "21010 Southbank St #575"
41
+ should: %s[0].city == "Potomac Falls"
42
+ should: %s[0].zip == "20165"
43
+ should: %s[0].state == "VA"
44
+ should: %s[0].country_code == "US"
45
+ should: %s[0].phone == "+1.5712832829"
46
+ should: %s[0].fax == nil
47
+ should: %s[0].email == "michael@mpowers.net"
@@ -0,0 +1,61 @@
1
+ NOTICE AND TERMS OF USE: You are not authorized to access or query our WHOIS
2
+ database through the use of high-volume, automated, electronic processes. The
3
+ Data in Network Solutions' WHOIS database is provided by Network Solutions for information
4
+ purposes only, and to assist persons in obtaining information about or related
5
+ to a domain name registration record. Network Solutions does not guarantee its accuracy.
6
+ By submitting a WHOIS query, you agree to abide by the following terms of use:
7
+ You agree that you may use this Data only for lawful purposes and that under no
8
+ circumstances will you use this Data to: (1) allow, enable, or otherwise support
9
+ the transmission of mass unsolicited, commercial advertising or solicitations
10
+ via e-mail, telephone, or facsimile; or (2) enable high volume, automated,
11
+ electronic processes that apply to Network Solutions (or its computer systems). The
12
+ compilation, repackaging, dissemination or other use of this Data is expressly
13
+ prohibited without the prior written consent of Network Solutions. You agree not to use
14
+ high-volume, automated, electronic processes to access or query the WHOIS
15
+ database. Network Solutions reserves the right to terminate your access to the WHOIS
16
+ database in its sole discretion, including without limitation, for excessive
17
+ querying of the WHOIS database or for failure to otherwise abide by this policy.
18
+ Network Solutions reserves the right to modify these terms at any time.
19
+
20
+ Get a FREE domain name registration, transfer, or renewal with any annual hosting package.
21
+
22
+ http://www.networksolutions.com
23
+
24
+ Visit AboutUs.org for more information about APPTAP.COM
25
+ <a href="http://www.aboutus.org/APPTAP.COM">AboutUs: APPTAP.COM </a>
26
+
27
+
28
+
29
+
30
+ Registrant:
31
+ mpowers LLC
32
+ 21010 Southbank St #575
33
+ Potomac Falls, VA 20165
34
+ US
35
+
36
+ Domain Name: APPTAP.COM
37
+
38
+ ------------------------------------------------------------------------
39
+ Promote your business to millions of viewers for only $1 a month
40
+ Learn how you can get an Enhanced Business Listing here for your domain name.
41
+ Learn more at http://www.NetworkSolutions.com/
42
+ ------------------------------------------------------------------------
43
+
44
+ Administrative Contact, Technical Contact:
45
+ mpowers LLC michael@mpowers.net
46
+ 21010 Southbank St #575
47
+ Potomac Falls, VA 20165
48
+ US
49
+ +1.5712832829
50
+
51
+
52
+ Record expires on 17-Mar-2017.
53
+ Record created on 21-May-2010.
54
+ Database last updated on 5-Jun-2012 12:08:08 EDT.
55
+
56
+ Domain servers in listed order:
57
+
58
+ NS53.WORLDNIC.COM 205.178.190.27
59
+ NS54.WORLDNIC.COM 206.188.198.27
60
+
61
+
@@ -0,0 +1,89 @@
1
+ #status
2
+ should: %s raise_error(Whois::PropertyNotSupported)
3
+
4
+ #available?
5
+ should: %s == false
6
+
7
+ #registered?
8
+ should: %s == true
9
+
10
+
11
+ #created_on
12
+ should: %s CLASS(time)
13
+ should: %s == Time.parse("1997-06-10")
14
+
15
+ #updated_on
16
+ should: %s raise_error(Whois::PropertyNotSupported)
17
+
18
+ #expires_on
19
+ should: %s CLASS(time)
20
+ should: %s == Time.parse("2014-06-09")
21
+
22
+
23
+ #registrar
24
+ should: %s CLASS(registrar)
25
+ should: %s.name == "Network Solutions"
26
+ should: %s.organization == "Network Solutions, LLC"
27
+ should: %s.url == "http://www.networksolutions.com/"
28
+
29
+ #registrant_contacts
30
+ should: %s CLASS(array)
31
+ should: %s SIZE(1)
32
+ should: %s[0] CLASS(contact)
33
+ should: %s[0].type == Whois::Record::Contact::TYPE_REGISTRANT
34
+ should: %s[0].name == nil
35
+ should: %s[0].organization == "XIF Communications"
36
+ should: %s[0].address == "1200 New Hampshire Avenue NW\nSuite 410"
37
+ should: %s[0].city == "Washington"
38
+ should: %s[0].zip == "20036"
39
+ should: %s[0].state == "DC"
40
+ should: %s[0].country_code == "US"
41
+ should: %s[0].phone == nil
42
+ should: %s[0].fax == nil
43
+ should: %s[0].email == nil
44
+
45
+ #admin_contacts
46
+ should: %s CLASS(array)
47
+ should: %s SIZE(1)
48
+ should: %s[0] CLASS(contact)
49
+ should: %s[0].type == Whois::Record::Contact::TYPE_ADMIN
50
+ should: %s[0].name == "Communications, XIF ContactMiddleName"
51
+ should: %s[0].organization == "XIF Communications"
52
+ should: %s[0].address == "1200 New Hampshire Avenue NW\nSuite 410"
53
+ should: %s[0].city == "Washington"
54
+ should: %s[0].zip == "20036"
55
+ should: %s[0].state == "DC"
56
+ should: %s[0].country_code == "US"
57
+ should: %s[0].phone == "202-463-7200"
58
+ should: %s[0].fax == "202-318-4003"
59
+ should: %s[0].email == "noc@xif.com"
60
+
61
+ #technical_contacts
62
+ should: %s CLASS(array)
63
+ should: %s SIZE(1)
64
+ should: %s[0] CLASS(contact)
65
+ should: %s[0].type == Whois::Record::Contact::TYPE_TECHNICAL
66
+ should: %s[0].name == "Communications, XIF ContactMiddleName"
67
+ should: %s[0].organization == "XIF Communications"
68
+ should: %s[0].address == "1200 New Hampshire Avenue NW\nSuite 410"
69
+ should: %s[0].city == "Washington"
70
+ should: %s[0].zip == "20036"
71
+ should: %s[0].state == "DC"
72
+ should: %s[0].country_code == "US"
73
+ should: %s[0].phone == "202-463-7200"
74
+ should: %s[0].fax == "202-318-4003"
75
+ should: %s[0].email == "noc@xif.com"
76
+
77
+
78
+ #nameservers
79
+ should: %s CLASS(array)
80
+ should: %s SIZE(3)
81
+ should: %s[0] CLASS(nameserver)
82
+ should: %s[0].name == "ns01.xif.com"
83
+ should: %s[0].ipv4 == "63.240.200.70"
84
+ should: %s[1] CLASS(nameserver)
85
+ should: %s[1].name == "ns-east.cerf.net"
86
+ should: %s[1].ipv4 == "207.252.96.3"
87
+ should: %s[2] CLASS(nameserver)
88
+ should: %s[2].name == "ns-west.cerf.net"
89
+ should: %s[2].ipv4 == "192.153.156.3"
@@ -0,0 +1,65 @@
1
+ NOTICE AND TERMS OF USE: You are not authorized to access or query our WHOIS
2
+ database through the use of high-volume, automated, electronic processes. The
3
+ Data in Network Solutions' WHOIS database is provided by Network Solutions for information
4
+ purposes only, and to assist persons in obtaining information about or related
5
+ to a domain name registration record. Network Solutions does not guarantee its accuracy.
6
+ By submitting a WHOIS query, you agree to abide by the following terms of use:
7
+ You agree that you may use this Data only for lawful purposes and that under no
8
+ circumstances will you use this Data to: (1) allow, enable, or otherwise support
9
+ the transmission of mass unsolicited, commercial advertising or solicitations
10
+ via e-mail, telephone, or facsimile; or (2) enable high volume, automated,
11
+ electronic processes that apply to Network Solutions (or its computer systems). The
12
+ compilation, repackaging, dissemination or other use of this Data is expressly
13
+ prohibited without the prior written consent of Network Solutions. You agree not to use
14
+ high-volume, automated, electronic processes to access or query the WHOIS
15
+ database. Network Solutions reserves the right to terminate your access to the WHOIS
16
+ database in its sole discretion, including without limitation, for excessive
17
+ querying of the WHOIS database or for failure to otherwise abide by this policy.
18
+ Network Solutions reserves the right to modify these terms at any time.
19
+
20
+ Get a FREE domain name registration, transfer, or renewal with any annual hosting package.
21
+
22
+ http://www.networksolutions.com
23
+
24
+ Visit AboutUs.org for more information about XIF.COM
25
+ <a href="http://www.aboutus.org/XIF.COM">AboutUs: XIF.COM </a>
26
+
27
+
28
+
29
+
30
+ Registrant:
31
+ XIF Communications
32
+ 1200 New Hampshire Avenue NW
33
+ Suite 410
34
+ Washington, DC 20036
35
+ US
36
+
37
+ Domain Name: XIF.COM
38
+
39
+ ------------------------------------------------------------------------
40
+ Promote your business to millions of viewers for only $1 a month
41
+ Learn how you can get an Enhanced Business Listing here for your domain name.
42
+ Learn more at http://www.NetworkSolutions.com/
43
+ ------------------------------------------------------------------------
44
+
45
+ Administrative Contact, Technical Contact:
46
+ Communications, XIF ContactMiddleName noc@xif.com
47
+ XIF Communications
48
+ 1200 New Hampshire Avenue NW
49
+ Suite 410
50
+ Washington, DC 20036
51
+ US
52
+ 202-463-7200 fax: 202-318-4003
53
+
54
+
55
+ Record expires on 09-Jun-2014.
56
+ Record created on 10-Jun-1997.
57
+ Database last updated on 5-Jun-2012 12:20:31 EDT.
58
+
59
+ Domain servers in listed order:
60
+
61
+ NS01.XIF.COM 63.240.200.70
62
+ NS-EAST.CERF.NET 207.252.96.3
63
+ NS-WEST.CERF.NET 192.153.156.3
64
+
65
+