mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
Fix for banned ips update
This commit is contained in:
parent
a2098a300e
commit
2be4fbbde8
1 changed files with 12 additions and 6 deletions
18
Rakefile
18
Rakefile
|
@ -53,13 +53,17 @@ end
|
||||||
desc 'Update banned IPs list'
|
desc 'Update banned IPs list'
|
||||||
task :update_blocked_ips => [:environment] do
|
task :update_blocked_ips => [:environment] do
|
||||||
|
|
||||||
IO.copy_stream(
|
filename = 'listed_ip_365_ipv46'
|
||||||
open('https://www.stopforumspam.com/downloads/listed_ip_90.zip'),
|
|
||||||
'/tmp/listed_ip_90.zip'
|
|
||||||
)
|
|
||||||
|
|
||||||
Zip::Archive.open('/tmp/listed_ip_90.zip') do |ar|
|
File.open("/tmp/#{filename}.zip", 'wb') do |file|
|
||||||
ar.fopen('listed_ip_90.txt') do |f|
|
response = HTTP.get "https://www.stopforumspam.com/downloads/#{filename}.zip"
|
||||||
|
response.body.each do |chunk|
|
||||||
|
file.write chunk
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Zip::Archive.open("/tmp/#{filename}.zip") do |ar|
|
||||||
|
ar.fopen("#{filename}.txt") do |f|
|
||||||
ips = f.read
|
ips = f.read
|
||||||
insert_hashes = []
|
insert_hashes = []
|
||||||
ips.each_line {|ip| insert_hashes << {ip: ip.strip, created_at: Time.now}}
|
ips.each_line {|ip| insert_hashes << {ip: ip.strip, created_at: Time.now}}
|
||||||
|
@ -71,6 +75,8 @@ task :update_blocked_ips => [:environment] do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
FileUtils.rm "/tmp/#{filename}.zip"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'parse tor exits'
|
desc 'parse tor exits'
|
||||||
|
|
Loading…
Add table
Reference in a new issue