一、下载及运行
./bin/sekiro.bat
配置
conf/config.properties 配置定制参数,目前只支持配置服务端口 sekiro.port=5612
conf/logback.xml可以用来配置日志输出规则
二、插入JS代码
if(!window._makeRequest){window._makeRequest = makeRequest};
三、通过油猴加载sekiro_web_client及SekiroClient相关代码
-
下载油猴插件
-
google安装油猴插件
-
注入代码
// ==UserScript==
// @name dong
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://weibo.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=jianshu.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:5612/business-demo/register?group=test&clientId=" + guid());
client.registerAction("makeRequest", function (request, resolve, reject) {
try {
var _user=request['user']
var _psw=request['psw']
var result=JSON.stringify(window._makeRequest(_user,_psw,7,false))
resolve(result);
} catch (e) {
reject("error: " + e);
}
});
}
setTimeout(sek_start,2000)
})();
四、RPC调用(python示例)
# -*- coding: utf-8 -*-
import requests
r=requests.Session()
pdata={
'group':'test',
'action':'makeRequest',
'user':'12345678910',
'psw':'123456'
}
response=requests.get("http://127.0.0.1:5612/business-demo/invoke",params=pdata)
print(response.text)
网友评论