Fix for blocked ip update script

This commit is contained in:
Kyle Drake 2018-12-20 05:07:07 +00:00
parent ee3516829f
commit a733a3b742

View file

@ -47,17 +47,13 @@ end
desc 'Update banned IPs list'
task :update_blocked_ips => [:environment] do
uri = URI.parse('http://www.stopforumspam.com/downloads/listed_ip_90.zip')
blocked_ips_zip = Tempfile.new('blockedipszip', Dir.tmpdir)
blocked_ips_zip.binmode
Net::HTTP.start(uri.host, uri.port) do |http|
resp = http.get(uri.path)
blocked_ips_zip.write(resp.body)
blocked_ips_zip.flush
end
IO.copy_stream(
open('http://www.stopforumspam.com/downloads/listed_ip_90.zip'),
'/tmp/listed_ip_90.zip'
)
Zip::Archive.open(blocked_ips_zip.path) do |ar|
Zip::Archive.open('/tmp/listed_ip_90.zip') do |ar|
ar.fopen('listed_ip_90.txt') do |f|
ips = f.read
insert_hashes = []