php实现抖音ABogus算法示例代码

代码语言:php

所属分类:其他

代码描述:php实现抖音ABogus算法示例代码

代码标签: php 抖音 ABogus 算法 示例 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<?php

class ABogus {
    private $filter = '/%([0-9A-F]{2})/';
    private $arguments = [0, 1, 14];
    private $ua_key = "\x00\x01\x0e";
    private $end_string = "cus";
    private $version = [1, 0, 1, 5];
    private $browser = "1536|742|1536|864|0|0|0|0|1536|864|1536|864|1536|742|24|24|MacIntel";
    private $reg = [
        1937774191,
        1226093241,
        388252375,
        3666478592,
        2842636476,
        372324522,
        3817729613,
        2969243214,
    ];
    private $str = [
        "s0" => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
        "s1" => "Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
        "s2" => "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=",
        "s3" => "ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe",
        "s4" => "Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe",
    ];
    
    private $chunk = [];
    private $size = 0;
    private $reg_copy = [];
    private $ua_code = [
        76, 98, 15, 131, 97, 245, 224, 133, 122, 199, 241, 166, 79, 34, 90, 191,
        128, 126, 122, 98, 66, 11, 14, 40, 49, 110, 110, 173, 67, 96, 138, 252
    ];
    private $browser_info;
    private $browser_len;
    private $browser_code;

    public function __construct($platform = null) {
        $this->reg_copy = $this->reg;
        $this->browser_info = $platform ? $this->generateBrowserInfo($platform) : $this->browser;
        $this->browser_len = strlen($this->browser_info);
        $this->browser_code = $this->charCodeAt($this->browser_info);
    }

    private function list1($random_num = null, $a = 170, $b = 85, $c = 45) {
        return $this->randomList($random_num, $a, $b, 1, 2, 5, $c & $a);
    }

    private function list2($random_num = null, $a = 170, $b = 85) {
        return $this->randomList($random_num, $a, $b, 1, 0, 0, 0);
    }

    private function list3($random_num = null, $a = 170, $b = 85) {
        return $this->randomList($random_num, $a, $b, 1, 0, 5, 0);
    }

    private function randomList($a = null, $b = 170, $c = 85, $d = 0, $e = 0, $f = 0, $g = 0) {
        $r = $a ?? (mt_rand() / mt_getrandmax() * 10000);
        $v = [$r, (int)$r & 255, (int)$r >> 8];
        $s = $v[1] & $b | $d;
        $v[] = $s;
        $s = $v[1] & $c | $e;
        $v[] = $s;
        $s = $v[2] & $b | $f;
        $v[] = $s;
        $s = $v[2] & $c | $g;
        $v[] = $s;
        return array_slice($v, -4);
    }

    private function fromCharCode(...$args) {
        $str = '';
        fo.........完整代码请登录后点击上方下载按钮下载查看

网友评论0