视频教程

https://www.bilibili.com/video/BV1aN4y1V7cb/

Sekiro框架

官方文档地址

https://sekiro.virjar.com/sekiro-doc/

demoServer下载地址

https://null119.lanzoul.com/iHdw709rydba

插入JS代码

if (!window._encryptSm4ECB) {window._encryptSm4ECB = Ht.a.encryptSm4ECB}

通过油猴加载sekiro_web_client及SekiroClient相关代码

// ==UserScript==
// @name         encryptSm4ECB
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://ccgateway.paas.cmbchina.com/ccgateway/statics/paas-content/ArticleDetail.html?curID=19a77f34-f4a7-4895-99a4-23db9fa5b55a
// @icon         https://www.google.com/s2/favicons?sz=64&domain=cmbchina.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    var _mscript=document.createElement("script")
    _mscript.src="https://sekiro.virjar.com/sekiro-doc/assets/sekiro_web_client.js"
    document.body.appendChild(_mscript);
    function sek_start(){
        function guid() {
            function S4() {
                return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
            }
            return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
        }
        var client = new SekiroClient("ws://127.0.0.1:5620/business-demo/register?group=encryptSm4ECB&clientId=" + guid());
        client.registerAction("encryptSm4ECB", function (request, resolve, reject) {
            try {
                var _curID=request['data']
                var result=JSON.stringify(window._encryptSm4ECB(JSON.parse(_curID)))
                resolve(result);
            } catch (e) {
                reject("error: " + e);
            }
        });
    }
    setTimeout(sek_start,2000)
})();

RPC调用(python示例)

# -*- coding: utf-8 -*-
# @Author: Null119 微信公众号/网站:治廷君
# @Desc: { 某加密data数据PRC获取示例 }
# @Date: { 2022/9/2 }

import requests

def getParams(id):
    pdata={
        'group':'encryptSm4ECB',
        'action':'encryptSm4ECB',
        'data':'{"articleId":"'+id+'","confuseFlag":true}',
    }
    response=requests.get("http://127.0.0.1:5620/business-demo/invoke",params=pdata)
    rdata=response.json()['data']
    rts=response.json()['timestamp']
    print('加密结果:',rdata,rts)
    return '{"data":"'+rdata+'","timestamp":'+str(rts)+'}'

def getContent(id):
    headers={
        'Accept':'application/json, text/plain, */*',
        'Accept-Language':'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
        'Auth-Type':'optional',
        'Cache-Control':'no-cache',
        'Connection':'keep-alive',
        'Content-Type':'application/json;charset=UTF-8',
        'Host':'ccgateway.paas.cmbchina.com',
        'Origin':'https://ccgateway.paas.cmbchina.com',
        'Pragma':'no-cache',
        'Referer':'https://ccgateway.paas.cmbchina.com/ccgateway/statics/paas-content/ArticleDetail.html?curID='+id,
        'sec-ch-ua':'"Chromium";v="104", " Not A;Brand";v="99", "Microsoft Edge";v="104"',
        'sec-ch-ua-mobile':'?0',
        'sec-ch-ua-platform':'"Windows"',
        'Sec-Fetch-Dest':'empty',
        'Sec-Fetch-Mode':'cors',
        'Sec-Fetch-Site':'same-origin',
        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 Edg/104.0.1293.70'
        }
    pdat=getParams(id)
    resp=requests.post('https://ccgateway.paas.cmbchina.com/ccgateway/api/paas-content/article/info',data=pdat,headers=headers,verify=False)
    return resp.text

if __name__ == '__main__':
    id = '19a77f34-f4a7-4895-99a4-23db9fa5b55a'
    print(getContent(id))

本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习使用,请在下载后24小时内删除,严禁商用。若由于商用引起版权纠纷,一切责任均由使用者承担。 【注意:本站发布资源来源于网络搜集,均有较强时效性,请在下载前注意查看文章资源发布或更新时间,距离当前时间太久的资源不建议下载,特别是安卓专区相关资源,会有大概率失效无法使用】