2017-12-31 20:18:41 +08:00
|
|
|
|
<?php
|
2019-12-14 10:45:22 +08:00
|
|
|
|
/**
|
|
|
|
|
* 根据下载的原始文件,生成dnsmasq的屏蔽广告用途的配置
|
|
|
|
|
*
|
|
|
|
|
* @file make-addr.php
|
|
|
|
|
* @author gently
|
|
|
|
|
* @date 2017.12.31
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
2017-12-31 20:18:41 +08:00
|
|
|
|
|
2018-10-04 21:34:10 +08:00
|
|
|
|
set_time_limit(600);
|
2017-12-31 20:18:41 +08:00
|
|
|
|
|
2019-12-14 10:45:22 +08:00
|
|
|
|
error_reporting(7);
|
2019-10-19 19:39:59 +08:00
|
|
|
|
|
2017-12-31 20:18:41 +08:00
|
|
|
|
if(PHP_SAPI != 'cli'){
|
|
|
|
|
die('nothing.');
|
|
|
|
|
}
|
2019-12-14 10:45:22 +08:00
|
|
|
|
require('./lib/addressMaker.class.php');
|
2017-12-31 20:18:41 +08:00
|
|
|
|
$arr_blacklist = require('./black_domain_list.php');
|
2018-11-17 00:23:55 +08:00
|
|
|
|
$arr_whitelist = require('./white_domain_list.php');
|
2017-12-31 20:18:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$arr_result = array();
|
|
|
|
|
|
|
|
|
|
|
2019-12-14 10:45:22 +08:00
|
|
|
|
$easylist1 = file_get_contents('./origin-files/easylistchina+easylist.txt');
|
|
|
|
|
$arr_result = array_merge_recursive($arr_result, addressMaker::get_domain_from_easylist($easylist1));
|
2018-10-04 21:34:10 +08:00
|
|
|
|
|
2019-12-14 10:45:22 +08:00
|
|
|
|
$easylist2 = file_get_contents('./origin-files/cjx-annoyance.txt');
|
|
|
|
|
$arr_result = array_merge_recursive($arr_result, addressMaker::get_domain_from_easylist($easylist2));
|
2018-10-04 21:34:10 +08:00
|
|
|
|
|
2019-12-14 10:45:22 +08:00
|
|
|
|
$easylist3 = file_get_contents('./origin-files/fanboy-annoyance.txt');
|
|
|
|
|
$arr_result = array_merge_recursive($arr_result, addressMaker::get_domain_from_easylist($easylist3));
|
2019-11-01 00:48:07 +08:00
|
|
|
|
|
|
|
|
|
|
2019-12-14 10:45:22 +08:00
|
|
|
|
$host1 = file_get_contents('./origin-files/hosts1');
|
|
|
|
|
$arr_result = array_merge_recursive($arr_result, addressMaker::get_domain_list($host1));
|
2017-12-31 20:18:41 +08:00
|
|
|
|
|
2019-09-04 17:33:09 +08:00
|
|
|
|
// $host2 = makeAddr::http_get('http://www.malwaredomainlist.com/hostslist/hosts.txt');
|
2019-12-14 10:45:22 +08:00
|
|
|
|
$host2 = file_get_contents('./origin-files/hosts2');
|
|
|
|
|
$arr_result = array_merge_recursive($arr_result, addressMaker::get_domain_list($host2));
|
2017-12-31 20:18:41 +08:00
|
|
|
|
|
2019-12-14 10:45:22 +08:00
|
|
|
|
$host3 = file_get_contents('./origin-files/hosts3');
|
|
|
|
|
$arr_result = array_merge_recursive($arr_result, addressMaker::get_domain_list($host3));
|
2019-11-01 01:21:54 +08:00
|
|
|
|
|
2019-10-19 19:39:59 +08:00
|
|
|
|
$arr_result = array_merge_recursive($arr_result, $arr_blacklist);
|
2018-10-08 10:59:06 +08:00
|
|
|
|
|
2019-10-19 19:39:59 +08:00
|
|
|
|
echo 'Written file size:';
|
2019-12-14 10:45:22 +08:00
|
|
|
|
echo addressMaker::write_to_conf($arr_result, './adblock-for-dnsmasq.conf', 'q-filter.conf');
|
|
|
|
|
|
|
|
|
|
|