|
|
@@ -50,19 +50,38 @@ class WhoisParser
|
50
|
50
|
end
|
51
|
51
|
# Owner
|
52
|
52
|
owner_data = whois_lookup.to_s.scan(/Registrant\sName:\s([^\\]+)/).first
|
53
|
|
- @parsed_data["owner"] = spliter(owner_data, "\r").downcase.split.map(&:capitalize).join(' ')
|
|
53
|
+ if owner_data != nil
|
|
54
|
+ owner_data = spliter(owner_data, "\r").downcase.split.map(&:capitalize).join(' ')
|
|
55
|
+ if owner_data
|
|
56
|
+ @parsed_data["owner"] = owner_data
|
|
57
|
+ end
|
|
58
|
+ end
|
54
|
59
|
# Registrar
|
55
|
|
- @parsed_data["registrar"] = data["registrar"][:name]
|
|
60
|
+ if data["registrar"] != nil
|
|
61
|
+ @parsed_data["registrar"] = data["registrar"][:name]
|
|
62
|
+ end
|
56
|
63
|
# Creation Date
|
57
|
64
|
temp = whois_lookup.to_s.scan(/Creation\sDate:\s([^\\]+)/).first.first
|
58
|
|
- creation_date_data = temp.scan(/Creation\sDate:\s([^\\]+)/).last
|
59
|
|
- @parsed_data["created_on"] = spliter(creation_date_data, "\n")
|
|
65
|
+ if temp != nil
|
|
66
|
+ creation_date_data = temp.scan(/Creation\sDate:\s([^\\]+)/).last
|
|
67
|
+ creation_date_data = spliter(creation_date_data, "\n")
|
|
68
|
+ if creation_date_data != nil
|
|
69
|
+ @parsed_data["created_on"]
|
|
70
|
+ end
|
|
71
|
+ end
|
60
|
72
|
# Expiration Date
|
61
|
73
|
temp = whois_lookup.to_s.scan(/Expiration\sDate:\s([^\\]+)/).first.first
|
62
|
|
- expiration_date_data = temp.scan(/Expiration\sDate:\s([^\\]+)/).last
|
63
|
|
- @parsed_data["expires_on"] = spliter(expiration_date_data, "\n")
|
|
74
|
+ if temp != nil
|
|
75
|
+ expiration_date_data = temp.scan(/Expiration\sDate:\s([^\\]+)/).last
|
|
76
|
+ expiration_date_data = spliter(expiration_date_data, "\n")
|
|
77
|
+ if expiration_date_data != nil
|
|
78
|
+ @parsed_data["expires_on"] = expiration_date_data
|
|
79
|
+ end
|
|
80
|
+ end
|
64
|
81
|
# Update Date
|
65
|
|
- @parsed_data["update_on"] = data["updated_on"]
|
|
82
|
+ if data["updated_on"] != nil
|
|
83
|
+ @parsed_data["update_on"] = data["updated_on"]
|
|
84
|
+ end
|
66
|
85
|
end
|
67
|
86
|
|
68
|
87
|
def parserBr(data, whois_lookup, url)
|
|
|
@@ -84,15 +103,26 @@ class WhoisParser
|
84
|
103
|
end
|
85
|
104
|
# Owner
|
86
|
105
|
owner_data = whois_lookup.to_s.scan(/owner:\s([^\\]+)/).first
|
87
|
|
- @parsed_data["owner"] = spliter(owner_data, "\r").force_encoding("ISO-8859-1").encode("UTF-8")
|
|
106
|
+ if owner_data != nil
|
|
107
|
+ owner_data = spliter(owner_data, "\r").force_encoding("ISO-8859-1").encode("UTF-8")
|
|
108
|
+ if owner_data != nil
|
|
109
|
+ @parsed_data["owner"] = owner_data
|
|
110
|
+ end
|
|
111
|
+ end
|
88
|
112
|
# Registrar
|
89
|
113
|
@parsed_data["registrar"] = "Registro BR"
|
90
|
114
|
# Creation Date
|
91
|
|
- @parsed_data["created_on"] = data["created_on"]
|
|
115
|
+ if data["created_on"] != nil
|
|
116
|
+ @parsed_data["created_on"] = data["created_on"]
|
|
117
|
+ end
|
92
|
118
|
# Expiration Date
|
93
|
|
- @parsed_data["expires_on"] = data["expires_on"]
|
|
119
|
+ if data["expires_on"] != nil
|
|
120
|
+ @parsed_data["expires_on"] = data["expires_on"]
|
|
121
|
+ end
|
94
|
122
|
# Update Date
|
95
|
|
- @parsed_data["updated_on"] = data["updated_on"]
|
|
123
|
+ if data["updated_on"] != nil
|
|
124
|
+ @parsed_data["updated_on"] = data["updated_on"]
|
|
125
|
+ end
|
96
|
126
|
end
|
97
|
127
|
|
98
|
128
|
def parserNetwork(data, whois_lookup, url)
|
|
|
@@ -114,19 +144,44 @@ class WhoisParser
|
114
|
144
|
end
|
115
|
145
|
# Owner
|
116
|
146
|
owner_data = whois_lookup.to_s.scan(/Registrant\sName:\s([^\\]+)/).first
|
117
|
|
- @parsed_data["owner"] = spliter(owner_data, "\r")
|
|
147
|
+ if owner_data != nil
|
|
148
|
+ owner_data = spliter(owner_data, "\r")
|
|
149
|
+ if owner_data != nil
|
|
150
|
+ @parsed_data["owner"] = owner_data
|
|
151
|
+ end
|
|
152
|
+ end
|
118
|
153
|
# Registrar
|
119
|
154
|
registrar_data = whois_lookup.to_s.scan(/Registrar:\s([^\\]+)/)
|
120
|
|
- @parsed_data["registrar"] = spliter(registrar_data)
|
|
155
|
+ if registrar_data != nil
|
|
156
|
+ registrar_data = spliter(registrar_data)
|
|
157
|
+ if registrar_data != nil
|
|
158
|
+ @parsed_data["registrar"] = registrar_data
|
|
159
|
+ end
|
|
160
|
+ end
|
121
|
161
|
# Creation Date
|
122
|
162
|
creation_date_data = whois_lookup.to_s.scan(/Creation\sDate:\s([^\\]+)/).first
|
123
|
|
- @parsed_data["created_on"] = spliter(creation_date_data, "\n")
|
|
163
|
+ if creation_date_data != nil
|
|
164
|
+ creation_date_data = spliter(creation_date_data, "\n")
|
|
165
|
+ if creation_date_data != nil
|
|
166
|
+ @parsed_data["created_on"] = creation_date_data
|
|
167
|
+ end
|
|
168
|
+ end
|
124
|
169
|
# Expiration Date
|
125
|
170
|
expiration_date_data = whois_lookup.to_s.scan(/Expiry\sDate:\s([^\\]+)/).first
|
126
|
|
- @parsed_data["expires_on"] = spliter(expiration_date_data, "\n")
|
|
171
|
+ if expiration_date_data != nil
|
|
172
|
+ expiration_date_data = spliter(expiration_date_data, "\n")
|
|
173
|
+ if expiration_date_data != nil
|
|
174
|
+ @parsed_data["expires_on"] = expiration_date_data
|
|
175
|
+ end
|
|
176
|
+ end
|
127
|
177
|
# Update Date
|
128
|
178
|
update_date_data = whois_lookup.to_s.scan(/Last\supdate\sof\sWHOIS\sdatabase:\s([^\\]+)/).first
|
129
|
|
- @parsed_data["update_on"] = spliter(update_date_data, "<")
|
|
179
|
+ if update_date_data != nil
|
|
180
|
+ update_date_data = spliter(update_date_data, "<")
|
|
181
|
+ if update_date_data != nil
|
|
182
|
+ @parsed_data["update_on"] = update_date_data
|
|
183
|
+ end
|
|
184
|
+ end
|
130
|
185
|
end
|
131
|
186
|
|
132
|
187
|
def spliter(data, split_char = "\r")
|