Skip to content

Commit

Permalink
fixup an encoding issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jcran committed Feb 24, 2012
1 parent 1ab4402 commit a23fd2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/tasks/geolocate_host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def run
if loc
@task_logger.log "adding location for #{@object.ip_address}"
create_object(PhysicalLocation, {
:zip => loc.postal_code.force_encoding('UTF-8'),
:city => loc.city_name.force_encoding('UTF-8'),
:state => loc.region_name.force_encoding('UTF-8'),
:country => loc.country_name.force_encoding('UTF-8'),
:zip => loc.postal_code.encode('UTF-8', :invalid => :replace),
:city => loc.city_name.encode('UTF-8', :invalid => :replace),
:state => loc.region_name.encode('UTF-8', :invalid => :replace),
:country => loc.country_name.encode('UTF-8', :invalid => :replace),
:longitude => loc.longitude,
:latitude => loc.latitude})
end
Expand Down
1 change: 0 additions & 1 deletion util/sniff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
@excluded.each do |excluded_regex|
if Regexp.new(excluded_regex).match(packet.ip_daddr.to_s)
excluded = true
puts "Packet in the exclusion list."
break
end
end
Expand Down
3 changes: 1 addition & 2 deletions util/sniff_and_lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
@excluded.each do |excluded_regex|
if Regexp.new(excluded_regex).match(packet.ip_daddr.to_s)
excluded = true
puts "Packet in the exclusion list."
break
end
end
Expand All @@ -40,5 +39,5 @@
puts "New host: #{packet.ip_daddr}, creating a record..."
h = Host.create(:ip_address => packet.ip_daddr)
h.run_task "geolocate_host"
h.run_task "dns_forward_lookup"
h.run_task "dns_reverse_lookup"
end

0 comments on commit a23fd2e

Please sign in to comment.