码上爬 第13题

本题关键是找到怎样生成r,s,t的,混淆代码可要https://7259.cloudns.ch/tools/ob中解码
jqueryxhr.js

<?php

$sums = 0;
for ($page=1;$page<=20;$page++){
    $time = time()*1000;
    $uuid = get_uuid();
    $sign = md5('{"page":'.$page.'}'.$uuid.$time);
    
    
    $headers = [];
    $headers[] = "Cookie: sessionid=acnti2em752v7l48qa9av21r69td509r;";
    $headers[] = "t: {$time}";
    $headers[] = "r: {$uuid}";
    $headers[] = "s: {$sign}";
    
    
    $post['page'] = $page;
    
    $url = "https://mashangpa.com/api/problem-detail/13/data/";
    //echo $time;echo '<br><br>';echo $url;echo '<br><br>';echo PHP_EOL;

    $code = get_curl_contents($url,$headers,json_encode($post));
    //$code = get_curl_contents($url,$headers,$post);
    $json = json_decode($code,true);
    //echo $code;exit;
    $sum = 0;
    foreach($json['current_array'] as $v){
        $sum +=$v;
    }
    $sums += $sum;
}
echo $sums;


function get_curl_contents($bstrURL, $headers = null, $post = null) {
    $ch = curl_init($bstrURL);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    if ($headers) {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    }
    if ($post) {
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    }
    
    //var_dump($headers);
    //var_dump($post);
    
    
    $data = curl_exec($ch);
    // 关闭CURL会话
    curl_close($ch);
    return $data;
}


function get_total_millisecond() {
    $time = explode(" ", microtime());
    $time = ($time[1] + $time[0]) * 1000;
    $time = round($time) . '';
    return $time;
}


function encrypt(int $a, int $b): int{
    // PHP 的 intdiv 对负数向 0 取整,等价于 WAT 的 i32.div_s
    return $a + intdiv($b, 3) + 16358;
}
function get_uuid(): string
{
    // 128 位随机数
    $bytes = openssl_random_pseudo_bytes(16);

    // 版本号 4(第 7 个字节高 4 位 = 0b0100)
    $bytes[6] = chr(ord($bytes[6]) & 0x0f | 0x40);

    // 变体 1(第 9 个字节高 2 位 = 0b10)
    $bytes[8] = chr(ord($bytes[8]) & 0x3f | 0x80);

    // 转十六进制并按 8-4-4-4-12 分段
    return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($bytes), 4));
}

?>


$.ajaxSettings.beforeSend = function (_0x3565b7, _0x891154) {
    var _0x2059bf = Date.parse(new Date());
    var _0x350b3a = _0x1e5c29();
    var _0x3f9dab = x1.stringify(_0x321804(_0x10b283(_0x891154.data || "{}")));
    var _0x3104de = mmm(_0x3f9dab + _0x350b3a + _0x2059bf);
    _0x891154.data = _0x3f9dab;
    _0x3565b7.setRequestHeader("t", _0x2059bf);
    _0x3565b7.setRequestHeader("r", _0x350b3a);
    _0x3565b7.setRequestHeader("s", _0x3104de);
    if (_0x3a4216) {
      return _0x3a4216(jqXHR, _0x891154);
    }
  };
none
最后修改于:2025年08月16日 11:09

添加新评论