/
whois.networksolutions.com.rb
154 lines (123 loc) · 4.76 KB
/
whois.networksolutions.com.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
#++
require 'whois/record/parser/base'
module Whois
class Record
class Parser
# Parser for the whois.networksolutions.com server.
#
# @see Whois::Record::Parser::Example
# The Example parser for the list of all available methods.
#
# @author Andrew Brampton <me@bramp.net>
# @since 2.6.2
class WhoisNetworksolutionsCom < Base
property_not_supported :status
# The server is contacted only in case of a registered domain.
property_supported :available? do
false
end
property_supported :registered? do
!available?
end
property_supported :created_on do
if content_for_scanner =~ /Record created on (.+)\.\n/
Time.parse($1)
end
end
property_not_supported :updated_on
property_supported :expires_on do
if content_for_scanner =~ /Record expires on (.+)\.\n/
Time.parse($1)
end
end
property_supported :registrar do
Record::Registrar.new(
:name => 'Network Solutions',
:organization => 'Network Solutions, LLC',
:url => 'http://www.networksolutions.com/'
)
end
property_supported :registrant_contacts do
build_contact('Registrant:', Record::Contact::TYPE_REGISTRANT)
end
property_supported :admin_contacts do
build_contact('Administrative Contact', Record::Contact::TYPE_ADMIN)
end
property_supported :technical_contacts do
build_contact('Technical Contact', Record::Contact::TYPE_TECHNICAL)
end
property_supported :nameservers do
if content_for_scanner =~ /Domain servers in listed order:\n\n((?:[^\n]+\n)+)/
$1.split("\n").map do |line|
# NS01.XIF.COM 63.240.200.70
name, ipv4 = line.strip.split(" ")
Record::Nameserver.new(:name => name.downcase, :ipv4 => ipv4)
end
end
end
def response_throttled?
!!(content_for_scanner =~ /The IP address from which you have visited/)
end
private
def build_contact(element, type)
match = content_for_scanner.slice(/#{element}.*\n((.+\n){4,7})/, 1)
return unless match
# Split lines but don't strip them now because in some cases
# we need the entire line, including extra-spaces.
lines = match.split("\n")
# 0 XIF Communications | mpowers LLC
# 1 1200 New Hampshire Avenue NW | 21010 Southbank St #575
# 2 Suite 410 | Potomac Falls, VA 20165
# 3 Washington, DC 20036 | US
# 4 US
# 0 Communications, XIF ContactMiddleName noc@xif.com | mpowers LLC michael@mpowers.net
# 1 XIF Communications | 21010 Southbank St #575
# 2 1200 New Hampshire Avenue NW | Potomac Falls, VA 20165
# 3 Suite 410 | US
# 4 Washington, DC 20036 | +1.5712832829
# 5 US
# 6 202-463-7200 fax: 202-318-4003
# Does the first line end in something that looks like a email address?
if lines[0].to_s =~ /\S+@\S+$/
# p lines.shift
# The record has a extra name and number line
name, email = lines.shift.scan(/^(.+)\s(\S+@\S+)$/).first
name = name.strip if name
end
lines.each(&:strip!)
# Does the last line contains the word fax, or has >9 digits
if lines[-1].to_s =~ / fax: /
phone, fax = lines.pop.to_s.scan(/^(.+) fax: (.+)$/).first
phone = phone.strip
fax = fax.strip
elsif lines[-1].to_s.gsub(/[^\d]+/, '').length > 9
phone = lines.pop
end
country_code = lines.pop
city, state, zip = lines.pop.scan(/^(.+), ([A-Z]{2}) ([\sA-Z0-9\-]+)$/).first
organization = lines.shift if lines.length >= 2
address = lines.join("\n")
Record::Contact.new(
:type => type,
:name => name,
:organization => organization,
:address => address,
:city => city,
:state => state,
:zip => zip,
:country_code => country_code,
:email => email,
:phone => phone,
:fax => fax
)
end
end
end
end
end