You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
718 B
PHP

<?php
echo "Downloading...\n";
file_put_contents(__DIR__ . "/bannedips.zip", file_get_contents("https://www.stopforumspam.com/downloads/bannedips.zip"));
file_put_contents(__DIR__ . "/toxic_ip_cidr.txt", file_get_contents("https://www.stopforumspam.com/downloads/toxic_ip_cidr.txt"));
$zip = new ZipArchive;
$res = $zip->open(__DIR__ . "/bannedips.zip");
if ($res === TRUE) {
$zip->extractTo(__DIR__ . "/");
$zip->close();
echo 'Unzipped.';
} else {
echo 'Unzip failed.';
}
unlink(__DIR__ . "/bannedips.zip");
$csv = file_get_contents(__DIR__ . "/bannedips.csv");
$ips = explode(",", $csv);
file_put_contents("bannedips.txt", implode("\n", $ips));
echo "\nConverted.\n";
unlink(__DIR__ . "/bannedips.csv");