-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshadowshare.php
More file actions
48 lines (45 loc) · 1.46 KB
/
shadowshare.php
File metadata and controls
48 lines (45 loc) · 1.46 KB
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
<?php
const GIT_URL = [ // git 仓库地址,原软件还有几个 GitHub 反代站,这里就不加了
"https://gitee.com/api/v5/repos/configshare/share/raw/%s?access_token=9019dae4f65bd15afba8888f95d7ebcc&ref=hotfix",
"https://raw.githubusercontent.com/configshare/share/hotfix/%s",
"https://shadowshare.v2cross.com/servers/%s",
];
const GIT_FILE = [ // 要获取的文件名称
"clash_http_encrypt",
"clash_https_encrypt",
"clash_socks5_encrypt",
"shadowshareserver",
"sub",
"http_cn_encrypt",
"https_cn_encrypt",
"socks5_cn_encrypt",
];
// 获取文件
function get_file($file)
{
foreach (GIT_URL as $url) {
// 发起请求
$request = curl_init(sprintf($url, $file));
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($request);
// 如果请求失败
if (curl_errno($request)) {
error_log(sprintf($url, $file) . " 请求失败 " . curl_error($request));
curl_close($request);
continue;
}
curl_close($request);
// AES 解密
$key = "8YfiQ8wrkziZ5YFW";
$iv = "8YfiQ8wrkziZ5YFW";
$cipher = "AES-128-CBC";
$result = openssl_decrypt(base64_decode($response), $cipher, $key, OPENSSL_RAW_DATA, $iv);
// 保存订阅链接
file_put_contents("{$file}.txt", $result);
return $result;
}
return false;
}
foreach (GIT_FILE as $file) {
get_file($file);
}