标签:function,sekiro,console,log,框架,seriko,js,var,prototype From: https://www.cnblogs.com/Lhptest/p/18538730
// seriko框架的文件 教程 https://www.bilibili.com/video/BV1UH14YkEn2/
// 解析 第一步 https://oss.iinti.cn/sekiro/sekiro-demo下载地址 下载 5.1m的 安装 打开sekiro.bat
// 第二步 在网页上定位到加密定位的地方 通过替换文件方式插入 var client这段代码 修改内容有 group=lianhe lianhe自定义 var data 参数 还有 h.sign(参数) 之后就会回调h.sign('get','/more/sitemap/20',data)得到的代码,而且在后面断点断住
// 第三步 function SekiroClient(e)将这一段代码在浏览器控制台加载,执行下一步断点,看控制台是否有 对应sekiro 加载成功字样,有的话取消断点,让代码过去
// 第四步 在浏览器 输入地址 'http://127.0.0.1:5612/business-demo/invoke?group=lianhe&action=getpass&num=2' 主要group=lianhe lianhe对应 action=getpass getpass对应 num=2 这个是动态参数 "pageNo": request['num']对应这一个参数 多个参数可以用&xxx = xxx方式传 调用就是request['xxx']
// 第五步 将第四步 转换为用python代码的方式 获取加密参数 搞定
// https://www.zaobao.com/forum/comic
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};
var client = new SekiroClient("ws://127.0.0.1:5612/business-demo/register?group=lianhe&clientId=" + Math.random());
client.registerAction("getpass", function (request, resolve, reject) {
var data ={
"pageNo": request['num'],
"pageSize": 18
}
resolve(h.sign('get','/more/sitemap/20',data));
});
'http://127.0.0.1:5612/business-demo/invoke?group=lianhe&action=getpass&num=2'
// https://www.mindskip.net:7002/#/login
var client = new SekiroClient("ws://127.0.0.1:5612/business-demo/register?group=teach&clientId=" + Math.random());
client.registerAction("getpwd", function (request, resolve, reject) {
resolve(y("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCk/ZoCVw4xW0ca2bP/510xFrEY9rZeWQ+f6GH9ZvzVGDkrIYdgrFrmbFP4ih6/3fMKJlnQZGbjLVKQpIzw2tt3qxp6JptELIQhDt5LKm7Ta2iVBtQxQ1ZULdalorX9A1169dWRRXLAKEwxjkmc8bOajHjBZHJWnXFroiavWzyOoQIDAQAB", request['data'])
);
});
'http://127.0.0.1:5612/business-demo/invoke?group=teach&action=getpwd&data=123456'