2020-04-01 | UNLOCK

免費增加 Cloudflare WARP+ 流量

Cloudflare WARP+是良心企業Cloudflare推出的Wireguard代理WARP的付費版,每推薦一名新用戶安裝WARP可以獲得1G流量。利用yyuueexxiinngg寫的刷流量代碼可以直接獲得推薦流量。

首先要找到自己的Referral Code,用電腦連接https://warp.plus/*格式的推薦連接,然後用Netowork Tool抓API請求。

以下代碼均來自yyuueexxiinngg/some-scripts

nodejs實現

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
// Fake register for referrer to get warp plus bandwidth
const referrer = "YOUR REFERRER ID";
const timesToLoop = 10;
const retryTimes = 5;
// How many sec to sleep, currently rate limit might be apply to per min per ip from my observation.
const sleepSeconds = 60;

const https = require("https");
const zlib = require("zlib");

async function init() {
for (let i = 0; i < timesToLoop; i++) {
if (await run()) {
console.log(i + 1, "OK");
} else {
console.log(i + 1, `Error, will sleep for ${sleepSeconds}s`);
for (let r = 0; r < retryTimes; r++) {
await sleep(sleepSeconds * 1000);
if (await run()) {
console.log(i + 1, "Retry #" + (r + 1), "OK");
break;
} else {
console.log(i + 1, "Retry #" + (r + 1), `Error, will sleep for ${sleepSeconds}s`);
if (r === retryTimes - 1) {
return;
}
}
}
}
}
}

async function run() {
return new Promise(resolve => {
const install_id = genString(11);
const postData = JSON.stringify({
key: `${genString(43)}=`,
install_id: install_id,
fcm_token: `${install_id}:APA91b${genString(134)}`,
referrer: referrer,
warp_enabled: false,
tos: new Date().toISOString().replace("Z", "+07:00"),
type: "Android",
locale: "zh_CN"
});

const options = {
hostname: "api.cloudflareclient.com",
port: 443,
path: "/v0a745/reg",
method: "POST",
headers: {
"Content-Type": "application/json",
Host: "api.cloudflareclient.com",
Connection: "Keep-Alive",
"Accept-Encoding": "gzip",
"User-Agent": "okhttp/3.12.1",
"Content-Length": postData.length
}
};

const req = https.request(options, res => {
if(res.statusCode === 429) {
// Too many requests
resolve(false);
}
const gzip = zlib.createGunzip();
// const buffer = [];
res.pipe(gzip);
gzip
.on("data", function(data) {
// buffer.push(data.toString());
})
.on("end", function() {
// console.dir(JSON.parse(buffer.join("")));
resolve(true);
})
.on("error", function(e) {
// console.error(e);
resolve(false);
});
});

req.on("error", error => {
// console.error(error);
resolve(false);
});

req.write(postData);
req.end();
});
}

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

function genString(length) {
// https://stackoverflow.com/a/1349426/11860316
let result = "";
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}

init();

python實現

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
import requests
import json
import datetime
import random
import string

referrer = "YOUR REFERRER ID"
timesToLoop = 10
retryTimes = 5


def genString(stringLength):
letters = string.ascii_letters + string.digits
return ''.join(random.choice(letters) for i in range(stringLength))


url = 'https://api.cloudflareclient.com/v0a745/reg'


def run():
install_id = genString(11)
body = {"key": "{}=".format(genString(42)),
"install_id": install_id,
"fcm_token": "{}:APA91b{}".format(install_id, genString(134)),
"referrer": referrer,
"warp_enabled": False,
"tos": datetime.datetime.now().isoformat()[:-3] + "+07:00",
"type": "Android",
"locale": "zh-CN"}

bodyString = json.dumps(body)

headers = {'Content-Type': 'application/json; charset=UTF-8',
'Host': 'api.cloudflareclient.com',
'Connection': 'Keep-Alive',
'Accept-Encoding': 'gzip',
'User-Agent': 'okhttp/3.12.1'
}

r = requests.post(url, data=bodyString, headers=headers)
return r


for i in range(timesToLoop):
result = run()
if result.status_code == 200:
print(i + 1, "OK")
else:
print(i + 1, "Error")
for r in range(retryTimes):
retry = run()
if retry.status_code == 200:
print(i + 1, "Retry #" + str(r + 1), "OK")
break
else:
print(i + 1, "Retry #" + str(r + 1), "Error")
if r == retryTimes - 1:
exit()

注意事項

這個代碼在寫文章的當下(2020-04-01)還能用,此方法隨時有可能被Cloudflare封堵而失效,薅羊毛要快。

Reference

評論加載中