RPC调用
RPC在JS逆向中的利用:
浏览器当作服务端,本地起一个类似注册中心的服务,Python脚本作为客户端。注册中心作为客户端和服务端的通信桥梁,客户端可以直接调服务端暴露出来的API(即功能函数,如加解密函数)
Tools:
https://github.com/jxhczhl/JsRpc
https://github.com/yint-tech/sekiro-open
JsRPC
复制项目中JsEnv.js
到浏览器Sources的代码片段,右下角点击运行

本地运行编译好的文件win64-localhost.exe
,开启RPC监听。
浏览器控制台开启websocket监听
var demo = new Hlclient("ws://127.0.0.1:12080/ws?group=api&name=test");
python脚本执行:
import requests
jscode = """
(function(){
console.log("test")
return "执行成功"
})()
"""
url = "http://localhost:12080/execjs"
data = {
"group": "api",
"name": "test",
"jscode": jscode
}
res = requests.post(url, data=data)
print(res.text)
浏览器控制台成功打印test
,python收到返回值{"data":"执行成功","group":"api","name":"test","status":"200"}
注意group和name要和上面创建的监听连接一致。
🎯Target:dWdnY2Y6Ly9jbmZmY2JlZy56cnZnaG5hLnBiei9ucHBiaGFnL2hhdmd2aXJ5YnR2YQ==
登录接口有一个很长一串的字符h5Fingerprint

全局搜索h5Fingerprint

var demo = new Hlclient("ws://127.0.0.1:12080/ws?group=api&name=h5Fingerprint");
window.getH5fingerprint = utility.getH5fingerprint
demo.regAction("hell0", function (resolve, url_param) {
res=window.getH5fingerprint(window.location.origin + url_param)
resolve(res);
})
本地文件覆盖js文件,并在h5Fingerprint
的生成逻辑处插入websocket监听的代码

import requests
param2 = 'xxx'
url = "http://localhost:12080/go"
data = {
"group": "api",
"name": "h5Fingerprint",
"action": "hell0",
"url_param": param2
}
res = requests.post(url, data=data)
print(res.text)
Ref
https://blog.csdn.net/kdl_csdn/article/details/123074729
Last updated
Was this helpful?