客户端安装

https://oss.iinti.cn/sekiro/sekiro-demo,直接运行 bat 文件(需要Java环境)

image.png

浏览器注入

参考:https://sekiro.iinti.cn/sekiro-doc/01_manual/1.quickstart.html#%E6%B5%8F%E8%A7%88%E5%99%A8js%E7%8E%AF%E5%A2%83

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
function SekiroClient(e){if(this.wsURL=e,this.handlers={},this.socket={},!e)throw new Error("wsURL can not be empty!!");this.webSocketFactory=this.resolveWebSocketFactory(),this.connect()}SekiroClient.prototype.resolveWebSocketFactory=function(){if("object"==typeof window){var e=window.WebSocket?window.WebSocket:window.MozWebSocket;return function(o){function t(o){this.mSocket=new e(o)}return t.prototype.close=function(){this.mSocket.close()},t.prototype.onmessage=function(e){this.mSocket.onmessage=e},t.prototype.onopen=function(e){this.mSocket.onopen=e},t.prototype.onclose=function(e){this.mSocket.onclose=e},t.prototype.send=function(e){this.mSocket.send(e)},new t(o)}}if("object"==typeof weex)try{console.log("test webSocket for weex");var o=weex.requireModule("webSocket");return console.log("find webSocket for weex:"+o),function(e){try{o.close()}catch(e){}return o.WebSocket(e,""),o}}catch(e){console.log(e)}if("object"==typeof WebSocket)return function(o){return new e(o)};throw new Error("the js environment do not support websocket")},SekiroClient.prototype.connect=function(){console.log("sekiro: begin of connect to wsURL: "+this.wsURL);var e=this;try{this.socket=this.webSocketFactory(this.wsURL)}catch(o){return console.log("sekiro: create connection failed,reconnect after 2s:"+o),void setTimeout(function(){e.connect()},2e3)}this.socket.onmessage(function(o){e.handleSekiroRequest(o.data)}),this.socket.onopen(function(e){console.log("sekiro: open a sekiro client connection")}),this.socket.onclose(function(o){console.log("sekiro: disconnected ,reconnection after 2s"),setTimeout(function(){e.connect()},2e3)})},SekiroClient.prototype.handleSekiroRequest=function(e){console.log("receive sekiro request: "+e);var o=JSON.parse(e),t=o.__sekiro_seq__;if(o.action){var n=o.action;if(this.handlers[n]){var s=this.handlers[n],i=this;try{s(o,function(e){try{i.sendSuccess(t,e)}catch(e){i.sendFailed(t,"e:"+e)}},function(e){i.sendFailed(t,e)})}catch(e){console.log("error: "+e),i.sendFailed(t,":"+e)}}else this.sendFailed(t,"no action handler: "+n+" defined")}else this.sendFailed(t,"need request param {action}")},SekiroClient.prototype.sendSuccess=function(e,o){var t;if("string"==typeof o)try{t=JSON.parse(o)}catch(e){(t={}).data=o}else"object"==typeof o?t=o:(t={}).data=o;(Array.isArray(t)||"string"==typeof t)&&(t={data:t,code:0}),t.code?t.code=0:(t.status,t.status=0),t.__sekiro_seq__=e;var n=JSON.stringify(t);console.log("response :"+n),this.socket.send(n)},SekiroClient.prototype.sendFailed=function(e,o){"string"!=typeof o&&(o=JSON.stringify(o));var t={};t.message=o,t.status=-1,t.__sekiro_seq__=e;var n=JSON.stringify(t);console.log("sekiro: response :"+n),this.socket.send(n)},SekiroClient.prototype.registerAction=function(e,o){if("string"!=typeof e)throw new Error("an action must be string");if("function"!=typeof o)throw new Error("a handler must be function");return console.log("sekiro: register action: "+e),this.handlers[e]=o,this};

// 使用本地 127.0.0.1、没有证书使用ws协议
wsUrl = "ws://127.0.0.1:5612/business/register?group=dy_web&clientId=" + Math.random();
var client = new SekiroClient(wsUrl);
client.registerAction("get_promotion", function (request, resolve, reject) {
item_id = request.itemId;
var formData = {
"ui_params": '{"from_live":false,"from_video":null,"three_d_log_data":null,"follow_status":null,"which_account":null,"ad_log_extra":null,"from_group_id":null,"bolt_param":null,"transition_tracker_data":null,"selected_ids":null,"window_reposition":null,"is_short_screen":null,"full_mode":true}',
"use_new_price": "1",
"is_h5": "1",
"bff_type": "2",
"is_in_app": "0",
"origin_type": "606",
"promotion_ids": item_id,
"meta_param": "",
"source_page": "",
"request_additions": "",
"isFromVideo": "false",
"enable_timing": "true"
};
params = new URLSearchParams(formData).toString()
var _url = "https://haohuo.jinritemai.com/aweme/v2/shop/promotion/pack/h5/?is_h5=1&is_native_h5=1&origin_type=606";
fetch(_url, {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: params
})
.then(response => response.json())
.then(data => {
resolve(data);
})
.catch(error => {
reject(error); // 处理错误
});
});

拿到结果(抖店商品详情)

http://127.0.0.1:5612/business/invoke?group=dy_web&action=get_promotion&itemId=3645571022750665988

group、action填写正确即可

缺点

  • 需要一直开着浏览器