PC企业微信HOOK / iPad企业微信协议最新版研究
前言
企业微信在群发消息、批量添加好友等场景中,难以满足企业诉求,所以,某些企业便对企业微信进行hook,以实现企业的批量处理需求。本人对hook的原理及方案进行了分析,目前在PC版的HOOK和 iPad版的协议研究上颇有心得,咱们一起来看一下吧。
研究成果
目前本人选择的PC企业微信版本是 4.1.32.6005,通过IDA Pro 和 CE 等工具,已经完成消息收发 / 搜索、增删好友 / 联系人获取、查询信息、设置备注 / 群操作 / 收发朋友圈等功能,基本满足企业的业务要求。
在iPad版本上,本人选择的企微版本也是4.1.32.6005,通过 Frida、LLDB 等工具实现了与 PC 企微类似的功能,相比 PC 版,iPad更加灵活,轻量级,适合大规模群控场景的业务需求。
代码展示
PC 企业微信hook
// Receive Message
weworkHookModule->add(
{
0x42AB046,
StdHookCallBeginStageHandler<0x3111111, 0x3555555>,
[this](DWORD ebp, DWORD esp)
{
auto pRecvMsg = DPUInt(esp, 0x1C) - 0x10;
this->customHandleReceiveMessage(pRecvMsg);
}
}
);
// Send Message
weworkHookModule->add(
{
0x1111111,
StdHookCallBeginStageHandler<0x1444444, 0x1888888>,
[this](DWORD ebp, DWORD esp)
{
auto pSendMsg = DPUInt(ebp, 0x8, 0x0, 0xD0, 0x3C);
auto pMsgPackage = DPUInt(esp, 0x8, 0x34);
auto msgID = *reinterpret_cast<UINT64 *>(DPUInt(esp, 0x8, 0xC));
this->customHandleSendMessage(pSendMsg, pMsgPackage, msgID);
}
}
);
iPad 协议
void Client::sendCgiRequest(const std::string& syncKey, int32 businessCmd, const RequestConfig& config, const std::string& reqData, ResponseHandler fn)
{
auto rawResponseHandler = [syncKey, businessCmd, fn, this](bool result, const std::string& data)
{
// inner cgi request
if (businessCmd == 0) {
return;
}
json_t notifyData;
if (result) {
WWResponse rsp;
rsp.ParseFromString(data);
if (rsp.base().error_code() == 0) {
if (fn) {
fn(rsp.body());
} else {
sendDataNotify(m_id, businessCmd, E_SUCCESS, syncKey, notifyData);
}
} else {
notifyData["error_code"] = rsp.base().error_code();
notifyData["error_msg"] = BASE64_ENC(rsp.base().error_message());
sendDataNotify(m_id, businessCmd, E_REQUEST_ERROR, syncKey, notifyData);
}
} else {
notifyData["error_msg"] = BASE64_ENC(data);
sendDataNotify(m_id, businessCmd, E_UNKNOW_ERROR, syncKey, notifyData);
}
};
sendCgiRequest(config, reqData, rawResponseHandler);
}
最后
随着AI时代的到来,技术变革与产业逻辑重构对企业发展既是前所未有的挑战,也是重塑竞争优势的历史机遇。以AI为引擎,以脚本技术为骨架,推构建人机协同新生态,将重复性劳动交予智能系统,专注于价值创造,在个性化需求爆发时代打造差异化服务护城河。
// contact information
{
char QQ[] = "3837713198";
char qq[] = "3837713198";
}