在使用cloudflare worker搭建的vless或者cloudflare zero时会面临优选ip或者优选域名的问题,这里记录以下个人在使用的解决方案,相对比较便捷且稳定。
先介绍两个概念:
1. 优选ip
优选ip是对cloudflare自身的ip进行筛选,筛选出最佳的边缘服务器ip,也就是根据自己的网络环境进行筛选出来的一些质量较好的ip提高网络速度.
2. 反代ip(ProxyIP)
这些ip本身不是cloudflare的ip,因为一些原因被设置了对cloudflare ip的流量转发,也就是对cloudflare ip的反代中转,也成为中转ip.由于cloudlfare自身的限制,使用CFvless时如未设置ProxyIP会导致cloudflare系的网站都不能正常访问,也就是 ASN13335
都不能访问,也就是cloudflare为了避免循环,限制了自身ip的访问,这时使用反代服务器访问cloudflare就是很好的选择。反代ip其实是配置了流量转发的优选ip,所以也能当作优选ip使用。
寻找可以优选的ip
借用 fofa.info 使用fofa语法可以便捷的找到想要的ip或域名,这些域名和ip一个最大的特征就是使用了cloudflare的证书服务。
主要的特点是 server="cloudflare"
.
参考语法:
1 | cert="cloudflare"&&country="US"&&is_domain=true |
可以参考fofa语法记录
寻找可用的反代ip
反代ip的一个显著特点就是header="Forbidden" && server="cloudflare" && asn!="13335"
国内反代IP:server==”cloudflare” && port==”80” && header=”Forbidden” && country==”CN”
剔除CF:asn!=”13335” && asn!=”209242”
阿里云:server==”cloudflare” && asn==”45102”
甲骨文韩国:server==”cloudflare” && asn==”31898” && country==”KR”
搬瓦工:server==”cloudflare” && asn==”25820”
1 | server="cloudflare" && banner="Forbidden" && country="US" && is_domain=true && port="443" |
一些大佬维护的反代ip
1 | CM 维护 |
想要不不跳ip就解析下要是使用的反代域名,挑选符合要求的ip固定就行了。
这里并不打算详细的介绍fofa的语法,需要的自行到fofa去了解。为了便于汇总在fofa筛选的结果,我写一个油猴脚本,可以方便的复制结果中的域名和ip,当然你也可以登录fofa使用官方的下载服务,写脚本的目的主要是为了更便捷。脚本上传到到了greasyfork.org,你可以在 FOFA IP and Domain Extractor下载,配置进油猴或者手机端的stay\injectscript都可以使用。当然如果你不想使用脚本,只是偶尔需要这个功能,你也可以将以下代码在浏览器的console里运行,得到相同的结果。
- console运行脚本
1
console.log([...document.querySelectorAll('.hsxa-meta-data-list .hsxa-meta-data-list-lv1-lf span.hsxa-copy-btn')].map(e => e.dataset.clipboardText).filter((value,index,self)=>self.indexOf(value)===index).filter(text => !text.includes(':')).join(','));
- FOFA IP and Domain Extractor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375// ==UserScript==
// @name FOFA IP and Domain Extractor (Dark Tabbed) - Auto Refresh
// @namespace http://tampermonkey.net/
// @version 1.7
// @description Extract IP:port and domains with dark themed tabbed interface, auto-refresh on pagination
// @author zephyrus
// @match https://fofa.info/result*
// @match https://*.fofa.info/result*
// @grant GM_setClipboard
// @grant GM_addStyle
// @grant GM_notification
// ==/UserScript==
(function() {
'use strict';
// Add custom CSS styles (same as before)
GM_addStyle(`
.fofa-extractor-container {
margin: 20px auto;
font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
width: 450px;
}
.fofa-tab-container {
display: flex;
flex-direction: column;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
background: #2d2d2d;
}
.fofa-tab-header {
display: flex;
background: #1e1e1e;
border-bottom: 1px solid #3a3a3a;
justify-content: space-between;
align-items: center;
padding-right: 15px;
}
.fofa-tabs {
display: flex;
}
.fofa-tab {
padding: 10px 20px;
cursor: pointer;
font-weight: 500;
color: #aaa;
transition: all 0.3s;
border-right: 1px solid #3a3a3a;
position: relative;
}
.fofa-tab:last-child {
border-right: none;
}
.fofa-tab.active {
color: #05f2f2;
background: #2d2d2d;
}
.fofa-tab.active:after {
content: '';
position: absolute;
bottom: -1px;
left: 0;
right: 0;
height: 2px;
background: #05f2f2;
}
.fofa-tab-badge {
display: inline-block;
padding: 2px 6px;
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
font-size: 12px;
margin-left: 8px;
color: #ddd;
}
.fofa-tab-content {
display: none;
background: #2d2d2d;
padding: 15px;
}
.fofa-tab-content.active {
display: block;
}
.fofa-content-box {
max-height: 400px;
overflow-y: auto;
padding: 12px;
background: #252525;
border-radius: 4px;
line-height: 1.6;
white-space: pre;
font-size: 13px;
color: #e0e0e0;
border: 1px solid #3a3a3a;
font-family: 'Consolas', 'Monaco', monospace;
}
.fofa-toolbar {
display: flex;
align-items: center;
color: #aaa;
font-size: 13px;
gap: 10px;
}
.fofa-copy-btn {
padding: 6px 14px;
background: #05f2f2;
color: #111;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 13px;
transition: all 0.2s;
font-weight: 500;
}
.fofa-copy-btn:hover {
background: #05e0e0;
}
.fofa-copy-btn.copied {
background: #05a2a2;
color: #fff;
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: #1e1e1e;
}
::-webkit-scrollbar-thumb {
background: #05f2f2;
border-radius: 4px;
}
@media (max-width: 768px) {
.fofa-extractor-container {
width: 90%;
}
.fofa-tab-header {
flex-wrap: wrap;
}
.fofa-tab {
flex: 1 0 auto;
text-align: center;
padding: 8px 12px;
}
}
`);
// 主提取函数
const extractData = () => {
const items = Array.from(document.querySelectorAll(".hsxa-meta-data-item"));
const domains = new Set();
const ips = new Set();
items.forEach(item => {
// Extract domain with port
const domainLink = item.querySelector(".hsxa-host a");
const domain = domainLink?.textContent.trim().replace(/^https?:\/\//, "");
const portElement = item.querySelector(".hsxa-port");
const port = portElement ? atob(portElement.href.match(/qbase64=([^&]+)/)?.[1]).match(/port="([^"]+)"/)?.[1] : "";
if (domain && port) {
domains.add(`${domain}:${port}`);
}
// Extract IP with port
const ipElement = item.querySelector(".hsxa-jump-a");
const ip = ipElement ? atob(ipElement.href.match(/qbase64=([^&]+)/)?.[1]).match(/ip="([^"]+)"/)?.[1] : "";
if (ip && port) {
ips.add(`${ip}:${port}`);
}
});
return {
domains: Array.from(domains).sort(),
ips: Array.from(ips).sort()
};
};
// 创建标签页界面
const createTabbedInterface = (ips, domains) => {
const container = document.createElement('div');
container.className = 'fofa-tab-container';
// 创建标签头
const tabHeader = document.createElement('div');
tabHeader.className = 'fofa-tab-header';
const tabsContainer = document.createElement('div');
tabsContainer.className = 'fofa-tabs';
const ipTab = document.createElement('div');
ipTab.className = 'fofa-tab active';
ipTab.dataset.tab = 'ip';
ipTab.innerHTML = `IP列表 <span class="fofa-tab-badge">${ips.length}</span>`;
const domainTab = document.createElement('div');
domainTab.className = 'fofa-tab';
domainTab.dataset.tab = 'domain';
domainTab.innerHTML = `域名列表 <span class="fofa-tab-badge">${domains.length}</span>`;
tabsContainer.appendChild(ipTab);
tabsContainer.appendChild(domainTab);
tabHeader.appendChild(tabsContainer);
// 创建工具栏
const toolbar = document.createElement('div');
toolbar.className = 'fofa-toolbar';
const countInfo = document.createElement('div');
countInfo.textContent = `IP: ${ips.length} | 域名: ${domains.length}`;
const copyBtn = document.createElement('button');
copyBtn.className = 'fofa-copy-btn';
copyBtn.textContent = '复制当前';
copyBtn.onclick = () => {
const activeTab = container.querySelector('.fofa-tab.active').dataset.tab;
const content = activeTab === 'ip' ? ips.join('\n') : domains.join('\n');
GM_setClipboard(content);
copyBtn.textContent = '已复制!';
copyBtn.classList.add('copied');
setTimeout(() => {
copyBtn.textContent = '复制当前';
copyBtn.classList.remove('copied');
}, 2000);
};
toolbar.appendChild(countInfo);
toolbar.appendChild(copyBtn);
tabHeader.appendChild(toolbar);
container.appendChild(tabHeader);
// 创建标签内容
const contentContainer = document.createElement('div');
contentContainer.className = 'fofa-tab-contents';
// IP 标签内容
const ipContent = document.createElement('div');
ipContent.className = 'fofa-tab-content active';
ipContent.id = 'ip-tab';
const ipContentBox = document.createElement('div');
ipContentBox.className = 'fofa-content-box';
ipContentBox.textContent = ips.join('\n');
ipContent.appendChild(ipContentBox);
// 域名标签内容
const domainContent = document.createElement('div');
domainContent.className = 'fofa-tab-content';
domainContent.id = 'domain-tab';
const domainContentBox = document.createElement('div');
domainContentBox.className = 'fofa-content-box';
domainContentBox.textContent = domains.join('\n');
domainContent.appendChild(domainContentBox);
contentContainer.appendChild(ipContent);
contentContainer.appendChild(domainContent);
container.appendChild(contentContainer);
// 添加标签切换功能
const tabs = container.querySelectorAll('.fofa-tab');
tabs.forEach(tab => {
tab.addEventListener('click', () => {
// 更新活动标签
tabs.forEach(t => t.classList.remove('active'));
tab.classList.add('active');
// 更新活动内容
const tabName = tab.dataset.tab;
container.querySelectorAll('.fofa-tab-content').forEach(content => {
content.classList.remove('active');
});
container.querySelector(`#${tabName}-tab`).classList.add('active');
});
});
return container;
};
// 插入结果到页面
const insertResults = () => {
// 检查是否已经插入
let extractorContainer = document.getElementById('fofa-extractor-container');
// 如果结果列表不存在,移除提取器(如果有)
if (!document.querySelector('.hsxa-meta-data-item')) {
if (extractorContainer) {
extractorContainer.remove();
}
return;
}
const { domains, ips } = extractData();
// 如果没有数据,也移除提取器
if (domains.length === 0 && ips.length === 0) {
if (extractorContainer) {
extractorContainer.remove();
}
return;
}
const targetElement = document.querySelector('div.contentContainer.resultIndex > div:nth-child(1) > div.relatedSearch');
if (!targetElement) return;
// 如果提取器已存在,更新内容
if (extractorContainer) {
const newContainer = createTabbedInterface(ips, domains);
extractorContainer.replaceWith(newContainer);
extractorContainer = newContainer;
extractorContainer.id = 'fofa-extractor-container';
} else {
// 否则创建新的提取器
extractorContainer = document.createElement('div');
extractorContainer.id = 'fofa-extractor-container';
extractorContainer.className = 'fofa-extractor-container';
extractorContainer.appendChild(createTabbedInterface(ips, domains));
targetElement.parentNode.insertBefore(extractorContainer, targetElement);
}
};
// 使用 MutationObserver 监听结果列表的变化
const observeResults = () => {
const resultsContainer = document.querySelector('.hsxa-meta-table-list');
if (!resultsContainer) {
// 如果结果容器不存在,稍后重试
setTimeout(observeResults, 500);
return;
}
const observer = new MutationObserver((mutations) => {
// 检查是否有子节点变化或属性变化(翻页时可能会重置整个容器)
const needsUpdate = mutations.some(mutation =>
mutation.type === 'childList' ||
(mutation.type === 'attributes' && mutation.attributeName === 'class')
);
if (needsUpdate) {
// 延迟执行以确保DOM完全更新
setTimeout(insertResults, 300);
}
});
// 开始观察结果容器
observer.observe(resultsContainer, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['class']
});
// 初始执行一次
insertResults();
};
// 页面加载完成后开始观察
if (document.readyState === 'complete' || document.readyState === 'interactive') {
setTimeout(observeResults, 500);
} else {
window.addEventListener('DOMContentLoaded', () => {
setTimeout(observeResults, 500);
});
}
// 添加一个按钮点击事件监听器,因为FOFA可能在点击分页按钮时使用AJAX
document.addEventListener('click', (e) => {
if (e.target.closest('.ant-pagination-item, .ant-pagination-prev, .ant-pagination-next')) {
// 分页按钮被点击,稍后检查更新
setTimeout(insertResults, 1000);
}
});
})();
对ip或域名进行优选
地区网络不同、时段不同,ip的连接速度、可用性和稳定性都会不同,也就是动态的,这就需要不间断的对ip或域名进行测试,无论是手动或者是使用脚本,本质上都是找到最快速的目标。
优选一定要注意是本地网络环境,关闭所有代理工具包括软路由!
优选ip
- CF-优选官方IP+反代IP二合一脚本-甬哥
手机端可用,比如苹果的ish+curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/cfip.sh -o cfip.sh && chmod +x cfip.sh && bash cfip.sh
- better-cloudflare-ip
Termux、OpenWrt、Ubuntu、Debian、CentOS、MacOS、Raspbian、Armbian、iSH都可使用。curl https://raw.githubusercontent.com/badafans/better-cloudflare-ip/master/shell/cf.sh -o cf.sh && chmod +x cf.sh && ./cf.sh
优选域名
推荐使用优选域名,减少维护的凭此,一个域名对应有一个ip池,优点是相对稳定,缺点是会跳地区(同一域名解析的不同ip可能对应不同地区)。手机端也可用curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/CFcdnym.sh -o CFcdnym.sh && chmod +x CFcdnym.sh && bash CFcdnym.sh
更多可以阅读文章 How to find proxyip for VLESS CF WORKERS using Cybersecurity / Cyberspace Search Engine
- Shodan (https://shodan.io/)
Keywords:
port:80 product:”CloudFlare” title:”Direct IP access not allowed”
http.html_hash:141477257 port:443
Censys (https://search.censys.io/)
Keywords:
((((((services.http.response.html_title=”400 The plain HTTP request was sent to HTTPS port”) and services.port=443) and services.software.product=”CloudFlare Load Balancer”) and services.software.vendor=”CloudFlare”) and services.http.response.headers: (key: Server and value.headers: cloudflare)) and services.service_name=”HTTP”) and services.transport_protocol=”TCP”
((((((services.http.response.html_title=”Direct IP access not allowed | Cloudflare”) and services.port=80) and services.software.product=”CloudFlare Load Balancer”) and services.software.vendor=”CloudFlare”) and services.http.response.headers: (key: Server and value.headers: cloudflare)) and services.service_name=”HTTP”) and services.transport_protocol=”TCP”
FOFA (https://en.fofa.info/)
Keywords:
server==”cloudflare” && port=”443” && is_domain=false && banner=”CF-RAY: -“ && banner=”Content-Length: 155” && banner=”HTTP/1.1 400 Bad Request” && protocol=”http”
server==”cloudflare” && port=”80” && is_domain=false && banner=”CF-RAY: -“ && banner=”Content-Length: 16” && banner=”HTTP/1.1 403 Forbidden” && protocol=”http”
Pulsedive (https://pulsedive.com/explore/)
Keywords:
port=80 and port=443 && technology=CloudFlare && type=ip && http.cf-ray= - && http.++code=400 && http.Content-Length=655
Zoomeye (https://zoomeye.org/)
Keywords:
+app:”Cloudflare http proxy” +port:”443” +service:”http” +title:”400 The plain HTTP request was sent to HTTPS port”
+app:”Cloudflare” +port:”443” +service:”http” +title:”400 The plain HTTP request was sent to HTTPS port”
+app:”Cloudflare http proxy” +port:”80” +service:”http” +title:”Direct IP access not allowed”
+app:”Cloudflare” +port:”80” +service:”http” +title:”Direct IP access not allowed”
Hunter (https://hunter.how/)
Keywords:
ip.port==”443”&&product.name=”CloudFlare”&&header.status_code==”400”&&protocol==”http”
Criminal IP (https://criminal.ip/)
Keywords:
- port:80 product: “cloudflare” title: Direct IP access not allowed - Cloudflare
another website but I haven’t found the keyword yet
website lainnya, tetapi saya tidak menemukan kata kuncinya
- BinaryEdge (https://app.binaryedge.io/)