cloudflare由于使用anycast,IP并不能指定区域.
我们需要手动扫描指定区域的IP,获得更快速度.
由于IP失效较快,需要及时更新
扫描开放端口的IP段
https://www.cloudflare.com/ips/
zmap -p 443 --whitelist-file=/root/full.txt -o cdn_ip.txt
HTTP ports supported by Cloudflare:
- 80
- 8080
- 8880
- 2052
- 2082
- 2086
- 2095
HTTPS ports supported by Cloudflare:
- 443
- 2053
- 2083
- 2087
- 2096
- 8443
使用过滤脚本(见源代码)进行过滤
运行前需要安装PHP和CURL
apt -y install zmap php7.0 php7.0-curl
php cff.php cdn_ip.txt v.txt 300
cdn_ip.txt是zmap扫描结果文件,v.txt是存放可用ip的文件,300是进程数量
注意:进程过多可能会被服务商判断为DDoS
cff.php脚本源代码
<?PHP ini_set('memory_limit', '-1'); function partition($list, $p) { $listlen = count($list); $partlen = floor($listlen / $p); $partrem = $listlen % $p; $partition = array(); $mark = 0; for ($px = 0; $px < $p; $px++) { $incr = ($px < $partrem) ? $partlen + 1 : $partlen; $partition[$px] = array_slice($list, $mark, $incr); $mark += $incr; } return $partition; } if ($argc < 4) { echo "CloudFlare filter\nVersion: 0.4\n"; echo "Usage: php {$argv[0]} <raw file> <Verification file> <threads> [verify domain] [verify path] [verify value]\n"; echo "Power by Kagurazaka Shira\n"; exit; } if (!file_exists("$argv[1]")) { exit("Invalid input file!\n"); } if (file_exists("$argv[2]")) { unlink($argv[2]); } $array = file($argv[1], FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); //列表 $childcount = $argv[3]; //线程数 $array = array_unique($array); $part = array(); $part = partition($array, $childcount); //列表分割 $vname = $argv[2]; $domain = empty($argv[4]) ? "cfv.virtualizor.com" : $argv[4]; $vpath = empty($argv[5]) ? "/srk.css" : $argv[5]; $vvalue = empty($argv[6]) ? "srk_verify" : $argv[6]; for ($i = 0; $i < $childcount; $i++) { $pid = pcntl_fork(); if ($pid == -1) { echo "Forking failed on loop $i\n"; exit; } else if ($pid) { continue; } else { foreach ($part[$i] as $ip) { $url = "http://{$ip}/cdn-cgi/trace"; $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, // CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5, // CURLOPT_PROXY => $ip, CURLOPT_TIMEOUT => 10, CURLOPT_HTTPHEADER => [ "Host: {$domain}", "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", ], // CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", ]); $return = curl_exec($ch); if (empty($return)) { echo "{$ip} down\n"; curl_close($ch); continue; } // var_dump($return); if (strpos($return, "h={$domain}")) { curl_setopt($ch, CURLOPT_URL, "http://{$ip}" . $vpath); $return = curl_exec($ch); // var_dump($return); if (strpos($return, $vvalue) !== false) { echo "{$ip} success\n"; file_put_contents($vname, $ip . "\n", FILE_APPEND | LOCK_EX); curl_close($ch); continue; } } echo "{$ip} bad\n"; curl_close($ch); } exit; } } for ($j = 0; $j < $childcount; $j++) { $pid = pcntl_wait($status); } $v_arr = file($vname, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); //列表 $v_arr = array_unique($v_arr); foreach ($v_arr as &$v) { $v = ip2long($v); } sort($v_arr); foreach ($v_arr as &$v) { $v = long2ip($v); } file_put_contents($vname, implode("\n", $v_arr));
debian9临时脚本
#!/bin/bash # Check if user is root [ $(id -u) != "0" ] && { echo -e "\033[31mError: You must be root to run this script\033[0m"; exit 1; } export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin apt -y install zmap php7.0 php7.0-curl cd /root rm *.zone wget http://www.ipdeny.com/ipblocks/data/countries/hk.zone wget http://www.ipdeny.com/ipblocks/data/countries/tw.zone wget http://www.ipdeny.com/ipblocks/data/countries/kr.zone wget http://www.ipdeny.com/ipblocks/data/countries/mo.zone wget http://www.ipdeny.com/ipblocks/data/countries/jp.zone wget http://www.ipdeny.com/ipblocks/data/countries/sg.zone wget http://www.ipdeny.com/ipblocks/data/countries/th.zone cat *.zone > full.txt zmap -p 443 --whitelist-file=/root/full.txt -o cdn_ip.txt php cff.php cdn_ip.txt v.txt 300
CloudFlare所有节点IP收集
172.69.184.0/22 菲律宾
162.158.136.0/22
162.158.228.0/22
172.69.188.0/22 立陶宛
103.22.202.0/24 香港
103.22.203.0/24
108.162.222.0/24
108.162.223.0/24
162.158.176.0/24
162.158.177.0/24
162.158.178.0/24
162.158.179.0/24
172.68.248.0/22
172.69.96.0/22
172.69.176.0/22
173.245.62.0/24
103.31.4.0/23 台北
162.158.224.0/22
162.158.240.0/22
172.69.72.0/22 澳门
172.69.80.0/22 柬埔寨
108.162.208.0/24 加拿大
108.162.240.0/24
108.162.241.0/24
162.158.144.0/24
162.158.145.0/24
162.158.146.0/24
162.158.147.0/24
172.69.156.0/22
172.69.212.0/22
172.69.216.0/22
108.162.214.0/24 洛杉矶
108.162.215.0/24
141.101.72.0/24
162.158.56.0/22
172.68.44.0/22
172.68.208.0/22
172.69.32.0/22
173.245.48.0/24
108.162.216.0/24 芝加哥
108.162.217.0/24
141.101.73.0/24
162.158.72.0/22
172.68.56.0/24
172.68.57.0/24
172.68.58.0/24
172.68.59.0/24
162.158.140.0/24 凤凰城
162.158.141.0/24
162.158.142.0/24
162.158.143.0/24
108.162.218.0/24 纽瓦克
108.162.219.0/24
162.158.60.0/22
173.245.52.0/24 纽约
108.162.220.0/24 达拉斯
108.162.221.0/24
141.101.74.0/24
172.69.64.0/21
162.158.252.0/22 圣何塞
172.68.80.0/22
172.68.132.0/22
172.68.140.0/22
172.68.188.0/22
172.69.16.0/22
162.158.244.0/22 拉斯维加斯
108.162.226.0/24 日本东京
108.162.227.0/24
103.22.200.0/23
162.158.4.0/22
162.158.116.0/22
172.69.108.0/22
172.69.152.0/22 日本大阪
108.162.228.0/24 法国巴黎
141.101.66.0/24
141.101.67.0/24
141.101.68.0/24
141.101.69.0/24
108.162.229.0/24
141.101.88.0/22
162.158.192.0/24
162.158.193.0/24
162.158.194.0/24
162.158.195.0/24
172.69.224.0/22
162.158.120.0/24 迈阿密
162.158.121.0/24
162.158.122.0/24
162.158.123.0/24
108.162.210.0/24
108.162.211.0/24
108.162.212.0/24
108.162.213.0/24
108.162.236.0/24 亚特兰大
108.162.237.0/24
108.162.238.0/24
162.158.124.0/22
162.158.184.0/24
162.158.185.0/24
162.158.186.0/24
162.158.187.0/24
172.68.32.0/22 丹佛
172.68.36.0/22 圣路易斯
172.68.52.0/22 波士顿
108.162.243.0/24 西雅图
108.162.244.0/24
108.162.245.0/24
108.162.246.0/24
162.158.104.0/24
162.158.105.0/24
162.158.106.0/24
162.158.107.0/24
162.158.76.0/22 阿什本
172.68.64.0/22
172.69.60.0/22
173.245.54.0/24
188.114.104.0/24
172.68.148.0/22 堪萨斯
172.68.204.0/22 底特律
172.68.172.0/22 波兰特
172.69.168.0/22 休斯顿
172.69.40.0/22 盐湖城
172.68.228.0/22 圣地亚哥
172.68.68.0/22 宾法尼西亚费城
172.68.72.0/22 田纳西州纳什维尔
172.68.76.0/22 佛罗里达州坦帕
172.68.88.0/22 内布拉斯加州奥马哈
172.69.4.0/22 德克萨斯州麦卡伦
172.69.48.0/22 宾法尼西亚州匹兹堡
172.69.88.0/22 印第安纳州印第安纳波利斯
172.69.140.0/22 加利福尼亚州萨克拉门托
172.69.180.0/22 佛罗里达州塔拉哈西
172.69.196.0/22 田纳西州孟菲斯
172.69.208.0/22 佛罗里达州杰克逊维尔
108.162.247.0/24 澳大利亚
108.162.248.0/24
108.162.249.0/24
108.162.250.0/24
162.158.0.0/22
172.68.0.0/22
172.68.84.0/22
172.68.116.0/22
108.162.252.0/24 韩国
141.101.82.0/24
141.101.83.0/24
141.101.84.0/24
141.101.85.0/24
162.158.188.0/24
162.158.189.0/24
162.158.190.0/24
162.158.191.0/24
108.162.253.0/24 美国明尼苏达州明尼阿波利斯
162.158.212.0/22
108.162.254.0/24 旧金山
141.101.64.0/24 荷兰
141.101.65.0/24
141.101.75.0/24
141.101.76.0/24
141.101.77.0/24
141.101.104.0/24
162.158.108.0/22
172.69.52.0/22
141.101.70.0/24 英国伦敦
141.101.71.0/24
141.101.98.0/24
141.101.99.0/24
141.101.105.0/24
141.101.106.0/24
141.101.107.0/24
162.158.152.0/22
162.158.156.0/22
172.64.16.0/20
172.69.124.0/22
188.114.105.0/24
162.158.32.0/22 英国曼彻斯底
172.69.172.0/22 英国爱丁堡
162.158.36.0/24 爱尔兰
162.158.37.0/24
162.158.38.0/24
162.158.39.0/24
172.69.120.0/22
162.158.82.0/24 德国法兰克福
162.158.83.0/24
162.158.84.0/24
162.158.85.0/24
162.158.86.0/24
162.158.87.0/24
162.158.88.0/24
162.158.89.0/24
162.158.90.0/24
162.158.91.0/24
162.158.92.0/24
162.158.93.0/24
162.158.94.0/24
162.158.95.0/24
162.158.112.0/24 德国柏林
162.158.113.0/24
162.158.114.0/24
162.158.115.0/24
162.158.200.0/22 德国汉堡
172.68.108.0/22 德国慕尼黑
162.158.148.0/22 瑞士
162.158.180.0/22 瑞典
172.68.180.0/22
162.158.96.0/24 阿联酋
162.158.97.0/24
162.158.98.0/24
162.158.99.0/24
141.101.95.0/24 捷克
141.101.96.0/24
141.101.97.0/24
172.68.212.0/22
162.158.100.0/24 波兰华沙
162.158.101.0/24
162.158.102.0/24
162.158.103.0/24
172.68.136.0/22
141.101.100.0/22 智利
172.68.112.0/22
141.101.108.0/24 哥伦比亚
141.101.109.0/24
141.101.110.0/24
141.101.111.0/24
172.69.204.0/22
162.158.8.0/24 卡塔尔多哈
162.158.9.0/24
162.158.10.0/24
162.158.11.0/24
162.158.12.0/22 科威特
162.158.16.0/22 罗马尼亚
172.69.148.0/22
162.158.20.0/22 法国马赛
172.69.220.0/22 法国
162.158.24.0/24 新加坡
162.158.25.0/24
162.158.26.0/24
162.158.27.0/24
162.158.160.0/20
172.68.144.0/22
172.69.132.0/22
162.158.28.0/24 阿曼
162.158.29.0/24
162.158.30.0/24
162.158.31.0/24
162.158.40.0/24 肯尼亚
162.158.41.0/24
162.158.42.0/24
162.158.43.0/24
162.158.44.0/24 印度
162.158.45.0/24
162.158.46.0/24
162.158.47.0/24
162.158.48.0/24
162.158.49.0/24
162.158.50.0/24
162.158.51.0/24
162.158.52.0/24
162.158.53.0/24
162.158.54.0/24
162.158.55.0/24
172.68.160.0/22
172.69.104.0/22
162.158.128.0/22 埃及
162.158.132.0/24 丹麦
162.158.133.0/24
162.158.134.0/24
162.158.135.0/24
162.158.196.0/24 意大利米兰
162.158.197.0/24
162.158.198.0/24
162.158.199.0/24
188.114.100.0/24
188.114.101.0/24
188.114.102.0/24
188.114.103.0/24
172.68.196.0/22 意大利罗马
172.68.48.0/22 奥地利
172.69.0.0/22
162.158.208.0/22 保加利亚
172.68.60.0/22 希腊
172.69.56.0/22
162.158.220.0/22 挪威
162.158.232.0/22 比利时
162.158.236.0/22 芬兰
162.158.248.0/22 乌克兰
172.68.236.0/22
172.68.4.0/22 泰国
172.68.104.0/22
172.68.232.0/22
172.68.240.0/22
172.68.8.0/22 俄罗斯
172.68.12.0/22
172.68.244.0/22
172.68.16.0/20 巴西圣保罗
188.114.96.0/24
188.114.97.0/24
188.114.98.0/24
188.114.99.0/24
172.68.216.0/22 巴西里约热内卢
172.68.40.0/22 安哥拉
172.68.96.0/22 巴拿马
172.68.92.0/22 西班牙
188.114.106.0/24
188.114.107.0/24
188.114.108.0/24
188.114.109.0/24
188.114.110.0/24
188.114.111.0/24
172.68.100.0/22 葡萄牙
172.68.120.0/22 库拉索
172.68.124.0/22 亚美尼亚
172.68.128.0/22 吉布提
172.68.152.0/22 塞尔维亚
172.68.176.0/22 厄瓜多尔
172.68.184.0/22 南非
172.69.112.0/22
197.234.240.0/22
172.68.200.0/22 斯里兰卡
172.68.220.0/22 克罗地亚
172.68.224.0/22 匈牙利
172.69.76.0/22 尼泊尔
172.69.84.0/22 黎巴嫩
172.69.92.0/22 毛里求斯
172.69.100.0/22 伊拉克
172.69.116.0/22 土耳其
172.69.128.0/22 以色列
172.69.136.0/22 爱沙尼亚
172.69.144.0/22 冰岛
172.69.164.0/22 墨西哥
172.69.192.0/22 拉脱维亚
172.69.200.0/22 摩尔多瓦
参考来源 https://www.hostloc.com/thread-501556-1-1.html
https://www.hostloc.com/thread-501344-1-1.html
此处评论已关闭