@@ -33,9 +33,14 @@ class WhoisParser |
||
| 33 | 33 |
|
| 34 | 34 |
if raw |
| 35 | 35 |
# Parsed whois lookup data |
| 36 |
- @parsed_data["whois_lookup"] = data |
|
| 36 |
+ #@parsed_data["whois_lookup"] = data |
|
| 37 | 37 |
# Raw whois lookup data |
| 38 |
- @parsed_data["raw"] = whois_lookup.to_s |
|
| 38 |
+ if domain_type == 'br' |
|
| 39 |
+ raw_data = whois_lookup.to_s.force_encoding("ISO-8859-1").encode("UTF-8")
|
|
| 40 |
+ else |
|
| 41 |
+ raw_data = whois_lookup.to_s |
|
| 42 |
+ end |
|
| 43 |
+ @parsed_data["raw"] = raw_data |
|
| 39 | 44 |
end |
| 40 | 45 |
|
| 41 | 46 |
return JSON.pretty_generate(@parsed_data) |
@@ -84,6 +89,7 @@ class WhoisParser |
||
| 84 | 89 |
end |
| 85 | 90 |
end |
| 86 | 91 |
|
| 92 |
+ # .br Parser |
|
| 87 | 93 |
def parserBr(data, whois_lookup, url) |
| 88 | 94 |
# Domain Name |
| 89 | 95 |
domain_data = whois_lookup.to_s.scan(/domain:\s([^\\]+)/) |
@@ -114,17 +120,42 @@ class WhoisParser |
||
| 114 | 120 |
# Creation Date |
| 115 | 121 |
if data["created_on"] != nil |
| 116 | 122 |
@parsed_data["created_on"] = data["created_on"] |
| 123 |
+ else |
|
| 124 |
+ created_on_data = whois_lookup.to_s.scan(/created:\s([^\\]+)/).first |
|
| 125 |
+ if created_on_data != nil |
|
| 126 |
+ created_on_data = spliter(created_on_data, "\r") |
|
| 127 |
+ if created_on_data != nil |
|
| 128 |
+ @parsed_data["created_on"] = created_on_data |
|
| 129 |
+ end |
|
| 130 |
+ end |
|
| 117 | 131 |
end |
| 118 | 132 |
# Expiration Date |
| 119 | 133 |
if data["expires_on"] != nil |
| 120 | 134 |
@parsed_data["expires_on"] = data["expires_on"] |
| 135 |
+ else |
|
| 136 |
+ expires_on_data = whois_lookup.to_s.scan(/expires:\s([^\\]+)/).first |
|
| 137 |
+ if expires_on_data != nil |
|
| 138 |
+ expires_on_data = spliter(expires_on_data, "\r") |
|
| 139 |
+ if expires_on_data != nil |
|
| 140 |
+ @parsed_data["expires_on"] = expires_on_data |
|
| 141 |
+ end |
|
| 142 |
+ end |
|
| 121 | 143 |
end |
| 122 | 144 |
# Update Date |
| 123 | 145 |
if data["updated_on"] != nil |
| 124 | 146 |
@parsed_data["updated_on"] = data["updated_on"] |
| 147 |
+ else |
|
| 148 |
+ updated_on_data = whois_lookup.to_s.scan(/changed:\s([^\\]+)/).first |
|
| 149 |
+ if updated_on_data != nil |
|
| 150 |
+ updated_on_data = spliter(updated_on_data, "\r") |
|
| 151 |
+ if updated_on_data != nil |
|
| 152 |
+ @parsed_data["updated_on"] = updated_on_data |
|
| 153 |
+ end |
|
| 154 |
+ end |
|
| 125 | 155 |
end |
| 126 | 156 |
end |
| 127 | 157 |
|
| 158 |
+ # .network Parser |
|
| 128 | 159 |
def parserNetwork(data, whois_lookup, url) |
| 129 | 160 |
# Domain Name |
| 130 | 161 |
domain_data = whois_lookup.to_s.scan(/Domain\sName:\s([^\\]+)/) |