I’m using my local server (php & crontab)
=======================================================
bogons.php :
<?php
$file = file('http://www.team-cymru.org/Services/Bogons/fullbogons-ipv4.txt');
$num = 0;
$g=1;
$tmp=true;
while ($tmp) {
$tmp = array_slice($file, $num*215, 215);
if($tmp) {
file_put_contents("bog/output$num.txt", $tmp);
}
$num++;
}
file_put_contents("bog/pieces.txt", $num-1)
\
\
?>
==================================================
in cron
0 6 * * * root cd /usr/local/www/apache24/data && php bogons.php
=====================================================
- 3 scripts in Mikrotik
- 1.bogons_fetcher
/tool fetch address=“192.168.1.2” mode=“http” port=84 src-path=“/bog/pieces.txt” dst-path=“bog/pieces.txt”
:delay 10
/system script run bogons_pieces
2.bogons_pieces
:if ( [/file get [/file find name=“bog/pieces.txt”] size] > 0 ) do={
:global prfxses [/file get [/file find name=“bog/pieces.txt”] contents] ;
:global prfend 0;
:do {
/tool fetch address=“192.168.1.2” mode=“http” port=84 src-path=“/bog/output$prfend.txt” dst-path=“bog/output$prfend.txt”
:set prfend ( $prfend + 1 ) ;
} while=( $prfend < $prfxses ); /system script run bogons_addresses } else={ /system script run bogons_fetcher }
3.bogons_addresses
:global cprfxses [/file get [/file find name=“bog/pieces.txt”] contents] ;
:global cprfend 0;
/ip firewall address-list remove [/ip firewall address-list find list=bogons]
:do {
:global content [/file get [/file find name=“bog/output$cprfend.txt”] contents] ;
:global contentLen [ :len $content ] ;
:global lineEnd 0;
:global line “”;
:global lastEnd 0;
:do {
:set lineEnd [:find $content “\n” $lastEnd ] ;
:set line [:pick $content $lastEnd $lineEnd] ;
:set lastEnd ( $lineEnd + 1 ) ;
#If the line doesn’t start with a hash then process and add to the list
:if ( [:pick $line 0 1] != “#” ) do={
:local entry [:pick $line 0 ($lineEnd -1) ]
:if ( [:len $entry ] > 0 ) do={
/ip firewall address-list add list=bogons address=$line
}
}
} while=($lineEnd + 1 < $contentLen) ;
:set cprfend ( $cprfend + 1 ) ;
} while=($cprfend < $cprfxses)
:log info “///----> Bogons list Updated”;
I also have email information about update complete & item counter
/tool e-mail send to=name @ email.com subject=(“BOGONS List Updated & contains: " .[/ip fire address-list print count-only where list=bogons]. " items”)