whois 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/CHANGELOG.rdoc +44 -1
  2. data/bin/ruby-whois +3 -3
  3. data/lib/whois/answer/parser/NOTES.txt +4 -0
  4. data/lib/whois/answer/parser/whois.aero.rb +1 -1
  5. data/lib/whois/answer/parser/whois.cnnic.cn.rb +4 -4
  6. data/lib/whois/answer/parser/whois.co.pl.rb +106 -0
  7. data/lib/whois/answer/parser/whois.co.ug.rb +1 -1
  8. data/lib/whois/answer/parser/whois.coza.net.za.rb +106 -0
  9. data/lib/whois/answer/parser/whois.dk-hostmaster.dk.rb +1 -1
  10. data/lib/whois/answer/parser/whois.dns.pl.rb +77 -0
  11. data/lib/whois/answer/parser/whois.gov.za.rb +71 -0
  12. data/lib/whois/answer/parser/whois.iam.net.ma.rb +72 -0
  13. data/lib/whois/answer/parser/whois.ja.net.rb +85 -0
  14. data/lib/whois/answer/parser/whois.nic.cd.rb +4 -4
  15. data/lib/whois/answer/parser/whois.nic.ci.rb +77 -0
  16. data/lib/whois/answer/parser/whois.nic.ck.rb +1 -1
  17. data/lib/whois/answer/parser/whois.nic.nu.rb +3 -3
  18. data/lib/whois/answer/parser/whois.nic.pr.rb +75 -0
  19. data/lib/whois/answer/parser/whois.nic.sh.rb +99 -0
  20. data/lib/whois/answer/parser/whois.nic.sl.rb +83 -0
  21. data/lib/whois/answer/parser/whois.org.za.rb +96 -0
  22. data/lib/whois/answer/parser/whois.registry.gy.rb +90 -0
  23. data/lib/whois/answer/parser/whois.registry.hm.rb +79 -0
  24. data/lib/whois/answer/parser/whois.sgnic.sg.rb +77 -0
  25. data/lib/whois/answer/parser/whois.sk-nic.sk.rb +81 -0
  26. data/lib/whois/answer/parser/whois.thnic.co.th.rb +85 -0
  27. data/lib/whois/answer/parser/whois.twnic.net.tw.rb +81 -0
  28. data/lib/whois/definitions/tlds.rb +3 -3
  29. data/lib/whois/version.rb +1 -1
  30. data/whois.gemspec +2 -2
  31. metadata +21 -4
@@ -0,0 +1,99 @@
1
+ #
2
+ # = Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ #
7
+ # Category:: Net
8
+ # Package:: Whois
9
+ # Author:: Simone Carletti <weppos@weppos.net>
10
+ # License:: MIT License
11
+ #
12
+ #--
13
+ #
14
+ #++
15
+
16
+
17
+ require 'whois/answer/parser/base'
18
+
19
+
20
+ module Whois
21
+ class Answer
22
+ class Parser
23
+
24
+ #
25
+ # = whois.nic.sh parser
26
+ #
27
+ # Parser for the whois.nic.sh server.
28
+ #
29
+ class WhoisNicSh < Base
30
+
31
+ property_not_supported :disclaimer
32
+
33
+
34
+ property_supported :domain do
35
+ @domain ||= if content_for_scanner =~ /Domain "(.+?)"/
36
+ $1.downcase
37
+ end
38
+ end
39
+
40
+ property_not_supported :domain_id
41
+
42
+
43
+ property_not_supported :referral_whois
44
+
45
+ property_not_supported :referral_url
46
+
47
+
48
+ property_supported :status do
49
+ @status ||= if available?
50
+ :available
51
+ else
52
+ :registered
53
+ end
54
+ end
55
+
56
+ property_supported :available? do
57
+ @available ||= !!(content_for_scanner =~ /- Available/)
58
+ end
59
+
60
+ property_supported :registered? do
61
+ @registered ||= !available?
62
+ end
63
+
64
+
65
+ property_not_supported :created_on
66
+
67
+ property_not_supported :updated_on
68
+
69
+ property_not_supported :expires_on
70
+
71
+
72
+ property_not_supported :registrar
73
+
74
+ property_not_supported :registrant_contact
75
+
76
+ property_not_supported :admin_contact
77
+
78
+ property_not_supported :technical_contact
79
+
80
+
81
+ property_not_supported :nameservers
82
+
83
+
84
+ # NEWPROPERTY
85
+ def changed?(other)
86
+ !unchanged?(other)
87
+ end
88
+
89
+ # NEWPROPERTY
90
+ def unchanged?(other)
91
+ self.equal?(other) ||
92
+ self.content_for_scanner == other.content_for_scanner
93
+ end
94
+
95
+ end
96
+
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,83 @@
1
+ #
2
+ # = Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ #
7
+ # Category:: Net
8
+ # Package:: Whois
9
+ # Author:: Simone Carletti <weppos@weppos.net>
10
+ # License:: MIT License
11
+ #
12
+ #--
13
+ #
14
+ #++
15
+
16
+
17
+ require 'whois/answer/parser/base'
18
+
19
+
20
+ module Whois
21
+ class Answer
22
+ class Parser
23
+
24
+ #
25
+ # = whois.nic.sl parser
26
+ #
27
+ # Parser for the whois.nic.sl server.
28
+ #
29
+ # NOTE: This parser is just a stub and provides only a few basic methods
30
+ # to check for domain availability and get domain status.
31
+ # Please consider to contribute implementing missing methods.
32
+ # See WhoisNicIt parser for an explanation of all available methods
33
+ # and examples.
34
+ #
35
+ class WhoisNicSl < Base
36
+
37
+ property_supported :status do
38
+ @status ||= if available?
39
+ :available
40
+ else
41
+ :registered
42
+ end
43
+ end
44
+
45
+ property_supported :available? do
46
+ @available ||= !!(content_for_scanner =~ /Domain not found, marked private, or error in your query/)
47
+ end
48
+
49
+ property_supported :registered? do
50
+ @registered ||= !available?
51
+ end
52
+
53
+
54
+ property_supported :created_on do
55
+ @created_on ||= if content_for_scanner =~ /^Registration Date:\s+(.+)\n/
56
+ Time.parse($1)
57
+ end
58
+ end
59
+
60
+ property_supported :updated_on do
61
+ @expires_on ||= if content_for_scanner =~ /^Last Updated:\s+(.+)\n/
62
+ if $1 != "0000-00-00"
63
+ Time.parse($1)
64
+ end
65
+ end
66
+ end
67
+
68
+ property_supported :expires_on do
69
+ @expires_on ||= if content_for_scanner =~ /^Expiration Date:\s+(.+)\n/
70
+ Time.parse($1)
71
+ end
72
+ end
73
+
74
+
75
+ property_supported :nameservers do
76
+ @nameservers ||= content_for_scanner.scan(/^Name Server:\s+(.+)\n/).flatten.map(&:downcase)
77
+ end
78
+
79
+ end
80
+
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,96 @@
1
+ #
2
+ # = Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ #
7
+ # Category:: Net
8
+ # Package:: Whois
9
+ # Author:: Simone Carletti <weppos@weppos.net>
10
+ # License:: MIT License
11
+ #
12
+ #--
13
+ #
14
+ #++
15
+
16
+
17
+ require 'whois/answer/parser/base'
18
+
19
+
20
+ module Whois
21
+ class Answer
22
+ class Parser
23
+
24
+ #
25
+ # = whois.org.za parser
26
+ #
27
+ # Parser for the whois.org.za server.
28
+ #
29
+ class WhoisOrgZa < Base
30
+
31
+ property_not_supported :disclaimer
32
+
33
+
34
+ property_not_supported :domain
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
+ @status ||= if available?
46
+ :available
47
+ else
48
+ :registered
49
+ end
50
+ end
51
+
52
+ property_supported :available? do
53
+ @available ||= !!(content_for_scanner =~ /^(.+): Available/)
54
+ end
55
+
56
+ property_supported :registered? do
57
+ @registered ||= !available?
58
+ end
59
+
60
+
61
+ property_not_supported :created_on
62
+
63
+ property_not_supported :updated_on
64
+
65
+ property_not_supported :expires_on
66
+
67
+
68
+ property_not_supported :registrar
69
+
70
+
71
+ property_not_supported :registrant_contact
72
+
73
+ property_not_supported :admin_contact
74
+
75
+ property_not_supported :technical_contact
76
+
77
+
78
+ property_not_supported :nameservers
79
+
80
+
81
+ # NEWPROPERTY
82
+ property_supported :changed? do |other|
83
+ !unchanged?(other)
84
+ end
85
+
86
+ # NEWPROPERTY
87
+ property_supported :unchanged? do |other|
88
+ (self === other) ||
89
+ (self.content == other.content)
90
+ end
91
+
92
+ end
93
+
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,90 @@
1
+ #
2
+ # = Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ #
7
+ # Category:: Net
8
+ # Package:: Whois
9
+ # Author:: Simone Carletti <weppos@weppos.net>
10
+ # License:: MIT License
11
+ #
12
+ #--
13
+ #
14
+ #++
15
+
16
+
17
+ require 'whois/answer/parser/base'
18
+
19
+
20
+ module Whois
21
+ class Answer
22
+ class Parser
23
+
24
+ #
25
+ # = whois.registry.gy parser
26
+ #
27
+ # Parser for the whois.registry.gy server.
28
+ #
29
+ # NOTE: This parser is just a stub and provides only a few basic methods
30
+ # to check for domain availability and get domain status.
31
+ # Please consider to contribute implementing missing methods.
32
+ # See WhoisNicIt parser for an explanation of all available methods
33
+ # and examples.
34
+ #
35
+ class WhoisRegistryGy < Base
36
+
37
+ property_supported :status do
38
+ @status ||= if content_for_scanner =~ /Status:\s+(.+?)\n/
39
+ case $1.downcase
40
+ when "active" then :registered
41
+ when "not registered" then :available
42
+ else
43
+ Whois.bug!(ParserError, "Unknown status `#{$1}'.")
44
+ end
45
+ else
46
+ Whois.bug!(ParserError, "Unable to parse status.")
47
+ end
48
+ end
49
+
50
+ property_supported :available? do
51
+ @available ||= (status == :available)
52
+ end
53
+
54
+ property_supported :registered? do
55
+ @registered ||= !available?
56
+ end
57
+
58
+
59
+ property_supported :created_on do
60
+ @created_on ||= if content_for_scanner =~ /Created:\s+(.+?)\n/
61
+ Time.parse($1)
62
+ end
63
+ end
64
+
65
+ property_supported :updated_on do
66
+ @updated_on ||= if content_for_scanner =~ /Modified:\s+(.+?)\n/
67
+ Time.parse($1)
68
+ end
69
+ end
70
+
71
+ property_supported :expires_on do
72
+ @expires_on ||= if content_for_scanner =~ /Expires:\s+(.+?)\n/
73
+ Time.parse($1)
74
+ end
75
+ end
76
+
77
+
78
+ property_supported :nameservers do
79
+ @nameservers ||= if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
80
+ $1.split("\n").map(&:strip)
81
+ else
82
+ []
83
+ end
84
+ end
85
+
86
+ end
87
+
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,79 @@
1
+ #
2
+ # = Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ #
7
+ # Category:: Net
8
+ # Package:: Whois
9
+ # Author:: Simone Carletti <weppos@weppos.net>
10
+ # License:: MIT License
11
+ #
12
+ #--
13
+ #
14
+ #++
15
+
16
+
17
+ require 'whois/answer/parser/base'
18
+
19
+
20
+ module Whois
21
+ class Answer
22
+ class Parser
23
+
24
+ #
25
+ # = whois.registry.hm parser
26
+ #
27
+ # Parser for the whois.registry.hm server.
28
+ #
29
+ # NOTE: This parser is just a stub and provides only a few basic methods
30
+ # to check for domain availability and get domain status.
31
+ # Please consider to contribute implementing missing methods.
32
+ # See WhoisNicIt parser for an explanation of all available methods
33
+ # and examples.
34
+ #
35
+ class WhoisRegistryHm < Base
36
+
37
+ property_supported :status do
38
+ @status ||= if available?
39
+ :available
40
+ else
41
+ :registered
42
+ end
43
+ end
44
+
45
+ property_supported :available? do
46
+ @available ||= !!(content_for_scanner =~ /^Domain not found/)
47
+ end
48
+
49
+ property_supported :registered? do
50
+ @registered ||= !available?
51
+ end
52
+
53
+
54
+ property_supported :created_on do
55
+ @created_on ||= if content_for_scanner =~ /Domain creation date: (.+?)\n/
56
+ # Change dd/mm/yy to yyyy-mm-dd to prevent
57
+ # argument out of range
58
+ Time.parse($1.split("/").reverse.join("-"))
59
+ end
60
+ end
61
+
62
+ property_not_supported :updated_on
63
+
64
+ property_supported :expires_on do
65
+ @expires_on ||= if content_for_scanner =~ /Domain expiration date: (.+?)\n/
66
+ Time.parse($1.split("/").reverse.join("-"))
67
+ end
68
+ end
69
+
70
+
71
+ property_supported :nameservers do
72
+ @nameservers ||= content_for_scanner.scan(/Name Server: ([^\s]+)\n/).flatten.map(&:downcase)
73
+ end
74
+
75
+ end
76
+
77
+ end
78
+ end
79
+ end