🕸️
JsCrack
  • README
  • 🌱AST
    • JS代码混淆基础
    • AST原理与实现
    • Babel API
    • AST自动化混淆JS
    • AST自动化还原JS
  • 🛠️Tricks
    • 经验之谈
    • 解密定位
    • Cookie加密
    • WebPack混淆
    • 进制流解密
    • RPC调用
    • TLS握手流程
    • JAR3算法
  • 🎬Slider
    • 极验滑块JS逆向
  • 🍖Practice
    • 某查查爬取统一社会信用代码
    • 某安全社区文章爬取
Powered by GitBook
On this page
  • JsRPC
  • Ref

Was this helpful?

  1. 🛠️Tricks

RPC调用

Previous进制流解密NextTLS握手流程

Last updated 1 year ago

Was this helpful?

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

image-20231008162414018
image-20231008222243599
image-20231008173825446
image-20231008222406597