summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-12 23:30:50 +0100
committerspag <spag@golwen.net>2013-02-12 23:30:50 +0100
commit345c2b2b67cde33de7825a2cde32316900793fe9 (patch)
tree992cfafd0c95076dbd65b00a4cae97bafb036698 /app
parent6891b0e62712c5c2772ef205b8393b7ed5e72495 (diff)
remove non-ascii characters from whois reply
Diffstat (limited to 'app')
-rw-r--r--app/models/intruder.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
index 8877c4c..249fffc 100644
--- a/app/models/intruder.rb
+++ b/app/models/intruder.rb
@@ -17,11 +17,14 @@ class Intruder < ActiveRecord::Base
before_validation :set_key_if_empty
+ def to_s
+ key
+ end
def whois(ip_address = self.contact_ip)
if ! ip_address.blank?
begin
- return Whois.whois(ip_address).to_s.gsub(/[^A-Za-z0-9\:\_\-\ \+\.\,\n]/, '')
+ return Whois.whois(ip_address).to_s.gsub(/[^\u{0000}-\u{007F}]/, '')
rescue
return nil
end