rpc boss直聘 __zp_stoken__参数

声明:本文章的分析内容, 仅用于经验技术交流分享,不可用于任何商业用途和非法用途,否则后果自负,如有侵权,请联系作者立即删除,因为滥用技术产生的风险与本人无关。转载请注明出处。

目录

一、使用工具

二、定位加密函数

三、暴露加密函数

四、动态注入

五、通过python编写代码成功取到值


一、使用工具

  1. fiddler (AutoResponder+编程猫插件hook)
  2. chrome浏览器
  3. vscode
  4. jsrpc(不懂就看我第一篇文章rpc某银理财 payload加密-CSDN博客
  5. python3.9

项目步骤 定位加密函数==>暴露加密函数==>注入js并且建立连接==>使用python获取cookie并访问

二、定位加密函数

通过hook cookie定位到加密函数

三、暴露加密函数

因为文件是动态的所以必须要动态替换

1. 将security-check.html保存下来 这里文件名一定要存为 security-check.html

2. 删除文件里面的一个刷新命令

3. 通过document.lrs 暴露加密函数

4. 使用fiddler的 AutoResponder动态替换

5. 结果显示替换成功了

四、动态注入

1. 打开jsrpc服务端

2. 通过fiddler的编程猫插件 hook 动态注入

function Hlclient(wsURL) {
  this.wsURL = wsURL;
  this.handlers = {
    _execjs: function (resolve, param) {
      var res = eval(param)
      if (!res) {
        resolve("没有返回值")
      } else {
        resolve(res)
      }

    }
  };
  this.socket = undefined;
  if (!wsURL) {
    throw new Error('wsURL can not be empty!!')
  }
  this.connect()
}

Hlclient.prototype.connect = function () {
  console.log('begin of connect to wsURL: ' + this.wsURL);
  var _this = this;
  try {
    this.socket = new WebSocket(this.wsURL);
    this.socket.onmessage = function (e) {
      _this.handlerRequest(e.data)
    }
  } catch (e) {
    console.log("connection failed,reconnect after 10s");
    setTimeout(function () {
      _this.connect()
    }, 10000)
  }
  this.socket.onclose = function () {
    console.log('rpc已关闭');
    setTimeout(function () {
      _this.connect()
    }, 10000)
  }
  this.socket.addEventListener('open', (event) => {
    console.log("rpc连接成功");
  });
  this.socket.addEventListener('error', (event) => {
    console.error('rpc连接出错,请检查是否打开服务端:', event.error);
  });

};
Hlclient.prototype.send = function (msg) {
  this.socket.send(msg)
}

Hlclient.prototype.regAction = function (func_name, func) {
  if (typeof func_name !== 'string') {
    throw new Error("an func_name must be string");
  }
  if (typeof func !== 'function') {
    throw new Error("must be function");
  }
  console.log("register func_name: " + func_name);
  this.handlers[func_name] = func;
  return true

}

//收到消息后这里处理,
Hlclient.prototype.handlerRequest = function (requestJson) {
  var _this = this;
  try {
    var result = JSON.parse(requestJson)
  } catch (error) {
    console.log("catch error", requestJson);
    result = transjson(requestJson)
  }
  //console.log(result)
  if (!result['action']) {
    this.sendResult('', 'need request param {action}');
    return
  }
  var action = result["action"]
  var theHandler = this.handlers[action];
  if (!theHandler) {
    this.sendResult(action, 'action not found');
    return
  }
  try {
    if (!result["param"]) {
      theHandler(function (response) {
        _this.sendResult(action, response);
      })
      return
    }
    var param = result["param"]
    try {
      param = JSON.parse(param)
    } catch (e) {}
    theHandler(function (response) {
      _this.sendResult(action, response);
    }, param)

  } catch (e) {
    console.log("error: " + e);
    _this.sendResult(action, e);
  }
}

Hlclient.prototype.sendResult = function (action, e) {
  if (typeof e === 'object' && e !== null) {
    try {
      e = JSON.stringify(e)
    } catch (v) {
      console.log(v)//不是json无需操作
    }
  }
  this.send(action + atob("aGxeX14") + e);
}

function transjson(formdata) {
  var regex = /"action":(?<actionName>.*?),/g
  var actionName = regex.exec(formdata).groups.actionName
  stringfystring = formdata.match(/{..data..:.*..\w+..:\s...*?..}/g).pop()
    stringfystring = stringfystring.replace(/\\"/g, '"')
    paramstring = JSON.parse(stringfystring)
    tens = `{"action":` + actionName + `,"param":{}}`
    tjson = JSON.parse(tens)
    tjson.param = paramstring
    return tjson
}





var demo = new Hlclient("ws://127.0.0.1:12080/ws?group=zzz");



demo.regAction("data_encode", function (resolve,param) {
    //这样添加了一个param参数,http接口带上它,这里就能获得
    var zhipin_cookie =  document.__lrs.z(param['seed'],param['ts'])
    console.log(param['seed'],param['ts'])
	//location.reload()
    resolve(zhipin_cookie);
    
})

3. 动态注入成功

五、通过python编写代码成功取到值

总结:这个项目难点就是动态替换 和 动态建立连接,应该还有很多思路可以实现,欢迎各位大佬指教。

Boss直聘对数据安全性进行了加密处理,其中一个加密字段是__zp_stoken__。这个字段是用于身份验证和安全访问的一种方式,确保用户的身份和数据的安全性。具体的生成流程和算法并没有公开的信息。如果你在进行逆向分析或爬取数据时遇到了问题,请注意Boss直聘的数据保护措施,并确保你的操作符合相关法律法规和隐私政策。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [2019年末逆向复习系列之Boss直聘Cookie加密字段__zp_stoken__逆向分析](https://blog.csdn.net/zhangge3663/article/details/109778462)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [boss直聘的爬取之js解密cookie的”__zp_stoken__”字段](https://blog.csdn.net/Lock_Jun/article/details/101768531)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [自我学习-逆向解析BOSS直聘cookie字段 _zp_stoken__加密](https://blog.csdn.net/qq_39960370/article/details/106242240)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值