LMLPHP后院

代码分享技术

maybe yes 发表于 2021-04-14 10:09

好东西要分享:

$content = file_get_contents('1615442217.txt');
$t = base64_decode($content);
$a = explode("\n", $t);
$store = array();
foreach ($a as $k => $v){
        $v = trim($v);
        if (!$v) {
                continue;
        }
        $v = preg_replace('/ssr:\/\//i', '', $v);
        $v = str_replace('-', '+', $v);                                                                                                                                                
        $v = str_replace('_', '/', $v);
        $tt = base64_decode($v);
        $aa = explode('/?', $tt);
        $store[$k]['x'] = explode(':', $aa[0]);
        parse_str($aa[1], $store[$k]['y']);
        $store[$k]['x'][5] = base64_decode($store[$k]['x'][5]);
        foreach ($store[$k]['y'] as &$n) {
                $n = str_replace(array('-', '_'), array('+', '/'), $n);
                $n = base64_decode($n);
        }
}

$long_str = '';

foreach ($store as $k => $v) {
        if ($k < 2) {
                continue;
        }
        $v['x'][5] = base64_encode($v['x'][5]);
        $v['x'][5] = str_replace(array('+', '/'), array('-', '_'), $v['x'][5]);
        $str = implode(':', $v['x']);
        foreach ($v['y'] as $a=>$b) {
                if ($a == 'remarks') {
                        $v['y'][$a] = str_replace('Free-', '', $v['y'][$a]);
                        $v['y'][$a] = base64_encode($v['y'][$a]);
                        $v['y'][$a] = str_replace(array('+', '/', '='), array('-', '_', ''), $v['y'][$a]);
                        continue;
                }
                if ($a == 'group') {
                        $v['y'][$a] = 'LinCloud';
                        $v['y'][$a] = base64_encode($v['y'][$a]);
                        $v['y'][$a] = str_replace(array('+', '/', '='), array('-', '_', ''), $v['y'][$a]);
                        continue;
                }
                if ($a == 'protoparam') {
                        $v['y'][$a] = base64_encode($v['y'][$a]);
                        $v['y'][$a] = str_replace(array('+', '/', '='), array('-', '_', ''), $v['y'][$a]);
                        continue;
                }
                $v['y'][$a] = '';
        }
        $str .= '/?'.http_build_query($v['y']);
        //$str .= '/?'.implode(':', $v['y']);
        $str = 'ssr://'.str_replace(array('+', '/'), array('-', '_'), base64_encode($str))."\n";
        $long_str .= $str;
}

echo str_replace(array('+', '/'), array('-', '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