rg443

blocklist.de update

Aug 25th, 2020
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2. if ($data=file_get_contents('https://lists.blocklist.de/lists/all.txt')){
  3.     $i=preg_match_all('/\d+\.\d+\.\d+\.\d+/',$data,$matches);
  4.     echo "<pre>";
  5.     print($i);
  6.     // var_dump($matches[0]);
  7.     $a=array_map('ip2long',$matches[0]);
  8.     $a=array_unique($a,SORT_NUMERIC);
  9.     sort($a);
  10.     //print_r(array_map('long2ip',$a));
  11.     $result = array_map(function ($ip) {
  12.         return "($ip,'".long2ip($ip)."','" . str_pad(base_convert($ip, 10,36), 7, '0',STR_PAD_LEFT ) .".blocklist.de','2019-11-11')"  ;
  13.     }, $a);
  14.     // print_r($result);
  15.     $sql='replace into rdns2(i,ip,x,ts) values ' . implode(', ',$result);
  16.     print $sql . "\n";
  17.     echo "</pre>";
  18. };
  19. ?>
Add Comment
Please, Sign In to add comment