diff --git a/WeChatFerry/spy/chatroom_mgmt.cpp b/WeChatFerry/spy/chatroom_mgmt.cpp index 18a8bda..23d5d8b 100644 --- a/WeChatFerry/spy/chatroom_mgmt.cpp +++ b/WeChatFerry/spy/chatroom_mgmt.cpp @@ -12,10 +12,10 @@ using namespace std; extern WxCalls_t g_WxCalls; extern QWORD g_WeChatWinDllAddr; -typedef QWORD (*funcGetChatRoomMgr_t)(); -typedef QWORD (*funcAddMemberToChatRoom_t)(QWORD, QWORD, QWORD, QWORD); -typedef QWORD (*funcDelMemberFromChatRoom_t)(QWORD, QWORD, QWORD); -typedef QWORD (*funcInviteMemberToChatRoom_t)(QWORD, QWORD, QWORD, QWORD); +typedef QWORD (*GetChatRoomMgr_t)(); +typedef QWORD (*AddMemberToChatRoom_t)(QWORD, QWORD, QWORD, QWORD); +typedef QWORD (*DelMemberFromChatRoom_t)(QWORD, QWORD, QWORD); +typedef QWORD (*InviteMemberToChatRoom_t)(QWORD, QWORD, QWORD, QWORD); int AddChatroomMember(string roomid, string wxids) { @@ -26,8 +26,8 @@ int AddChatroomMember(string roomid, string wxids) return status; } - funcGetChatRoomMgr_t GetChatRoomMgr = (funcGetChatRoomMgr_t)(g_WeChatWinDllAddr + g_WxCalls.arm.call1); - funcAddMemberToChatRoom_t AddMembers = (funcAddMemberToChatRoom_t)(g_WeChatWinDllAddr + g_WxCalls.arm.call2); + GetChatRoomMgr_t GetChatRoomMgr = (GetChatRoomMgr_t)(g_WeChatWinDllAddr + g_WxCalls.arm.call1); + AddMemberToChatRoom_t AddMembers = (AddMemberToChatRoom_t)(g_WeChatWinDllAddr + g_WxCalls.arm.call2); vector vMembers; vector vWxMembers; @@ -58,8 +58,8 @@ int DelChatroomMember(string roomid, string wxids) return status; } - funcGetChatRoomMgr_t GetChatRoomMgr = (funcGetChatRoomMgr_t)(g_WeChatWinDllAddr + g_WxCalls.drm.call1); - funcDelMemberFromChatRoom_t DelMembers = (funcDelMemberFromChatRoom_t)(g_WeChatWinDllAddr + g_WxCalls.drm.call2); + GetChatRoomMgr_t GetChatRoomMgr = (GetChatRoomMgr_t)(g_WeChatWinDllAddr + g_WxCalls.drm.call1); + DelMemberFromChatRoom_t DelMembers = (DelMemberFromChatRoom_t)(g_WeChatWinDllAddr + g_WxCalls.drm.call2); vector vMembers; vector vWxMembers; @@ -89,8 +89,7 @@ int InviteChatroomMember(string roomid, string wxids) return status; } - funcInviteMemberToChatRoom_t InviteMembers - = (funcInviteMemberToChatRoom_t)(g_WeChatWinDllAddr + g_WxCalls.irm.call1); + InviteMemberToChatRoom_t InviteMembers = (InviteMemberToChatRoom_t)(g_WeChatWinDllAddr + g_WxCalls.irm.call1); vector vMembers; vector vWxMembers; diff --git a/WeChatFerry/spy/contact_mgmt.cpp b/WeChatFerry/spy/contact_mgmt.cpp index d6d55f4..7873507 100644 --- a/WeChatFerry/spy/contact_mgmt.cpp +++ b/WeChatFerry/spy/contact_mgmt.cpp @@ -9,8 +9,8 @@ using namespace std; extern WxCalls_t g_WxCalls; extern QWORD g_WeChatWinDllAddr; -typedef QWORD (*funcGetContactMgr_t)(); -typedef QWORD (*funcGetContactList_t)(QWORD, QWORD); +typedef QWORD (*GetContactMgr_t)(); +typedef QWORD (*GetContactList_t)(QWORD, QWORD); #define FEAT_LEN 5 static const uint8_t FEAT_COUNTRY[FEAT_LEN] = { 0xA4, 0xD9, 0x02, 0x4A, 0x18 }; @@ -48,8 +48,8 @@ static string GetCntString(QWORD start, QWORD end, const uint8_t *feat, size_t l vector GetContacts() { vector contacts; - funcGetContactMgr_t funcGetContactMgr = (funcGetContactMgr_t)(g_WeChatWinDllAddr + 0x1C0BDE0); - funcGetContactList_t funcGetContactList = (funcGetContactList_t)(g_WeChatWinDllAddr + 0x2265540); + GetContactMgr_t funcGetContactMgr = (GetContactMgr_t)(g_WeChatWinDllAddr + 0x1C0BDE0); + GetContactList_t funcGetContactList = (GetContactList_t)(g_WeChatWinDllAddr + 0x2265540); QWORD mgr = funcGetContactMgr(); QWORD addr[3] = { 0 }; diff --git a/WeChatFerry/spy/funcs.cpp b/WeChatFerry/spy/funcs.cpp index 2b8792e..0c0f4cf 100644 --- a/WeChatFerry/spy/funcs.cpp +++ b/WeChatFerry/spy/funcs.cpp @@ -25,10 +25,10 @@ extern bool gIsListeningPyq; extern WxCalls_t g_WxCalls; extern QWORD g_WeChatWinDllAddr; -typedef QWORD (*funcGetSNSDataMgr_t)(); -typedef QWORD (*funcGetSnsTimeLineMgr_t)(); -typedef QWORD (*funcGetSNSFirstPage_t)(QWORD, QWORD, QWORD); -typedef QWORD (*funcGetSNSNextPageScene_t)(QWORD, QWORD); +typedef QWORD (*GetSNSDataMgr_t)(); +typedef QWORD (*GetSnsTimeLineMgr_t)(); +typedef QWORD (*GetSNSFirstPage_t)(QWORD, QWORD, QWORD); +typedef QWORD (*GetSNSNextPageScene_t)(QWORD, QWORD); typedef QWORD (*GetChatMgr_t)(); typedef QWORD (*NewChatMsg_t)(QWORD); typedef QWORD (*FreeChatMsg_t)(QWORD); @@ -131,8 +131,8 @@ static int GetFirstPage() { int status = -1; - funcGetSNSDataMgr_t GetSNSDataMgr = (funcGetSNSDataMgr_t)(g_WeChatWinDllAddr + 0x22A91C0); - funcGetSNSFirstPage_t GetSNSFirstPage = (funcGetSNSFirstPage_t)(g_WeChatWinDllAddr + 0x2ED9080); + GetSNSDataMgr_t GetSNSDataMgr = (GetSNSDataMgr_t)(g_WeChatWinDllAddr + 0x22A91C0); + GetSNSFirstPage_t GetSNSFirstPage = (GetSNSFirstPage_t)(g_WeChatWinDllAddr + 0x2ED9080); QWORD buff[16] = { 0 }; QWORD mgr = GetSNSDataMgr(); @@ -145,8 +145,8 @@ static int GetNextPage(QWORD id) { int status = -1; - funcGetSnsTimeLineMgr_t GetSnsTimeLineMgr = (funcGetSnsTimeLineMgr_t)(g_WeChatWinDllAddr + 0x2E6B110); - funcGetSNSNextPageScene_t GetSNSNextPageScene = (funcGetSNSNextPageScene_t)(g_WeChatWinDllAddr + 0x2EFEC00); + GetSnsTimeLineMgr_t GetSnsTimeLineMgr = (GetSnsTimeLineMgr_t)(g_WeChatWinDllAddr + 0x2E6B110); + GetSNSNextPageScene_t GetSNSNextPageScene = (GetSNSNextPageScene_t)(g_WeChatWinDllAddr + 0x2EFEC00); QWORD mgr = GetSnsTimeLineMgr(); status = (int)GetSNSNextPageScene(mgr, id); diff --git a/WeChatFerry/spy/receive_msg.cpp b/WeChatFerry/spy/receive_msg.cpp index 16c8c81..3963303 100644 --- a/WeChatFerry/spy/receive_msg.cpp +++ b/WeChatFerry/spy/receive_msg.cpp @@ -22,17 +22,17 @@ extern queue gMsgQueue; extern WxCalls_t g_WxCalls; extern QWORD g_WeChatWinDllAddr; -typedef QWORD (*funcRecvMsg_t)(QWORD, QWORD); -typedef QWORD (*funcWxLog_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD); -typedef QWORD (*funcRecvPyq_t)(QWORD, QWORD, QWORD); +typedef QWORD (*RecvMsg_t)(QWORD, QWORD); +typedef QWORD (*WxLog_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD); +typedef QWORD (*RecvPyq_t)(QWORD, QWORD, QWORD); -static funcRecvMsg_t funcRecvMsg = nullptr; -static funcRecvMsg_t realRecvMsg = nullptr; -static funcWxLog_t funcWxLog = nullptr; -static funcWxLog_t realWxLog = nullptr; -static funcRecvPyq_t funcRecvPyq = nullptr; -static funcRecvPyq_t realRecvPyq = nullptr; -static bool isMH_Initialized = false; +static RecvMsg_t funcRecvMsg = nullptr; +static RecvMsg_t realRecvMsg = nullptr; +static WxLog_t funcWxLog = nullptr; +static WxLog_t realWxLog = nullptr; +static RecvPyq_t funcRecvPyq = nullptr; +static RecvPyq_t realRecvPyq = nullptr; +static bool isMH_Initialized = false; MsgTypes_t GetMsgTypes() { @@ -183,7 +183,7 @@ void EnableLog() LOG_WARN("g_WeChatWinDllAddr == 0"); return; } - funcWxLog_t funcWxLog = (funcWxLog_t)(g_WeChatWinDllAddr + 0x26DA2D0); + WxLog_t funcWxLog = (WxLog_t)(g_WeChatWinDllAddr + 0x26DA2D0); if (!isMH_Initialized) { status = MH_Initialize(); @@ -238,7 +238,7 @@ void ListenMessage() LOG_WARN("gIsListening || (g_WeChatWinDllAddr == 0)"); return; } - funcRecvMsg = (funcRecvMsg_t)(g_WeChatWinDllAddr + g_WxCalls.recvMsg.call); + funcRecvMsg = (RecvMsg_t)(g_WeChatWinDllAddr + g_WxCalls.recvMsg.call); if (!isMH_Initialized) { status = MH_Initialize(); @@ -300,7 +300,7 @@ void ListenPyq() LOG_WARN("gIsListeningPyq || (g_WeChatWinDllAddr == 0)"); return; } - funcRecvPyq = (funcRecvPyq_t)(g_WeChatWinDllAddr + 0x2EFAA10); + funcRecvPyq = (RecvPyq_t)(g_WeChatWinDllAddr + 0x2EFAA10); if (!isMH_Initialized) { status = MH_Initialize(); diff --git a/WeChatFerry/spy/send_msg.cpp b/WeChatFerry/spy/send_msg.cpp index 4d325f2..7511c1b 100644 --- a/WeChatFerry/spy/send_msg.cpp +++ b/WeChatFerry/spy/send_msg.cpp @@ -13,18 +13,18 @@ extern WxCalls_t g_WxCalls; extern QWORD g_WeChatWinDllAddr; extern string GetSelfWxid(); // Defined in spy.cpp -typedef QWORD (*funcNew_t)(QWORD); -typedef QWORD (*funcFree_t)(QWORD); -typedef QWORD (*funcSendMsgMgr_t)(); -typedef QWORD (*funcGetAppMsgMgr_t)(); +typedef QWORD (*New_t)(QWORD); +typedef QWORD (*Free_t)(QWORD); +typedef QWORD (*SendMsgMgr_t)(); +typedef QWORD (*GetAppMsgMgr_t)(); -typedef QWORD (*funcSendTextMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD); -typedef QWORD (*funcSendImageMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD); -typedef QWORD (*funcSendFileMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD *, QWORD, QWORD *, QWORD, QWORD *, QWORD, - QWORD); -typedef QWORD (*funcSendRichTextMsg_t)(QWORD, QWORD, QWORD); -typedef QWORD (*funcSendPatMsg_t)(QWORD, QWORD); -typedef QWORD (*funcForwardMsg_t)(QWORD, QWORD, QWORD, QWORD); +typedef QWORD (*SendTextMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD); +typedef QWORD (*SendImageMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD); +typedef QWORD (*SendFileMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD *, QWORD, QWORD *, QWORD, QWORD *, QWORD, + QWORD); +typedef QWORD (*SendRichTextMsg_t)(QWORD, QWORD, QWORD); +typedef QWORD (*SendPatMsg_t)(QWORD, QWORD); +typedef QWORD (*ForwardMsg_t)(QWORD, QWORD, QWORD, QWORD); void SendTextMessage(string wxid, string msg, string atWxids) { @@ -52,10 +52,10 @@ void SendTextMessage(string wxid, string msg, string atWxids) QWORD wxAters = (QWORD) & ((RawVector_t *)&vWxAtWxids)->start; - char buffer[0x460] = { 0 }; - funcSendMsgMgr_t funcSendMsgMgr = (funcSendMsgMgr_t)(g_WeChatWinDllAddr + g_WxCalls.sendText.call1); - funcSendTextMsg_t funcSendTextMsg = (funcSendTextMsg_t)(g_WeChatWinDllAddr + g_WxCalls.sendText.call2); - funcFree_t funcFree = (funcFree_t)(g_WeChatWinDllAddr + g_WxCalls.sendText.call3); + char buffer[0x460] = { 0 }; + SendMsgMgr_t funcSendMsgMgr = (SendMsgMgr_t)(g_WeChatWinDllAddr + g_WxCalls.sendText.call1); + SendTextMsg_t funcSendTextMsg = (SendTextMsg_t)(g_WeChatWinDllAddr + g_WxCalls.sendText.call2); + Free_t funcFree = (Free_t)(g_WeChatWinDllAddr + g_WxCalls.sendText.call3); funcSendMsgMgr(); success = funcSendTextMsg((QWORD)(&buffer), (QWORD)(&wxWxid), (QWORD)(&wxMsg), wxAters, 1, 1, 0, 0); funcFree((QWORD)(&buffer)); @@ -69,10 +69,10 @@ void SendImageMessage(string wxid, string path) WxString wxWxid(wsWxid); WxString wxPath(wsPath); - funcNew_t funcNew = (funcNew_t)(g_WeChatWinDllAddr + g_WxCalls.sendImg.call1); - funcFree_t funcFree = (funcFree_t)(g_WeChatWinDllAddr + g_WxCalls.sendImg.call2); - funcSendMsgMgr_t funcSendMsgMgr = (funcSendMsgMgr_t)(g_WeChatWinDllAddr + g_WxCalls.sendImg.call3); - funcSendImageMsg_t funcSendImage = (funcSendImageMsg_t)(g_WeChatWinDllAddr + g_WxCalls.sendImg.call4); + New_t funcNew = (New_t)(g_WeChatWinDllAddr + g_WxCalls.sendImg.call1); + Free_t funcFree = (Free_t)(g_WeChatWinDllAddr + g_WxCalls.sendImg.call2); + SendMsgMgr_t funcSendMsgMgr = (SendMsgMgr_t)(g_WeChatWinDllAddr + g_WxCalls.sendImg.call3); + SendImageMsg_t funcSendImage = (SendImageMsg_t)(g_WeChatWinDllAddr + g_WxCalls.sendImg.call4); char msg[0x460] = { 0 }; char msgTmp[0x460] = { 0 }; @@ -99,10 +99,10 @@ void SendFileMessage(string wxid, string path) WxString wxWxid(wsWxid); WxString wxPath(wsPath); - funcNew_t funcNew = (funcNew_t)(g_WeChatWinDllAddr + g_WxCalls.sendFile.call1); - funcFree_t funcFree = (funcFree_t)(g_WeChatWinDllAddr + g_WxCalls.sendFile.call2); - funcGetAppMsgMgr_t funcGetAppMsgMgr = (funcGetAppMsgMgr_t)(g_WeChatWinDllAddr + g_WxCalls.sendFile.call3); - funcSendFileMsg_t funcSendFile = (funcSendFileMsg_t)(g_WeChatWinDllAddr + g_WxCalls.sendFile.call4); + New_t funcNew = (New_t)(g_WeChatWinDllAddr + g_WxCalls.sendFile.call1); + Free_t funcFree = (Free_t)(g_WeChatWinDllAddr + g_WxCalls.sendFile.call2); + GetAppMsgMgr_t funcGetAppMsgMgr = (GetAppMsgMgr_t)(g_WeChatWinDllAddr + g_WxCalls.sendFile.call3); + SendFileMsg_t funcSendFile = (SendFileMsg_t)(g_WeChatWinDllAddr + g_WxCalls.sendFile.call4); char msg[0x460] = { 0 }; QWORD tmp1[4] = { 0 }; @@ -120,10 +120,10 @@ int SendRichTextMessage(RichText_t &rt) #define SRTM_SIZE 0x3F0 QWORD status = -1; - funcNew_t funcNew = (funcNew_t)(g_WeChatWinDllAddr + g_WxCalls.rt.call1); - funcFree_t funcFree = (funcFree_t)(g_WeChatWinDllAddr + g_WxCalls.rt.call2); - funcGetAppMsgMgr_t funcGetAppMsgMgr = (funcGetAppMsgMgr_t)(g_WeChatWinDllAddr + g_WxCalls.rt.call3); - funcSendRichTextMsg_t funcForwordPublicMsg = (funcSendRichTextMsg_t)(g_WeChatWinDllAddr + g_WxCalls.rt.call4); + New_t funcNew = (New_t)(g_WeChatWinDllAddr + g_WxCalls.rt.call1); + Free_t funcFree = (Free_t)(g_WeChatWinDllAddr + g_WxCalls.rt.call2); + GetAppMsgMgr_t funcGetAppMsgMgr = (GetAppMsgMgr_t)(g_WeChatWinDllAddr + g_WxCalls.rt.call3); + SendRichTextMsg_t funcForwordPublicMsg = (SendRichTextMsg_t)(g_WeChatWinDllAddr + g_WxCalls.rt.call4); char *buff = (char *)HeapAlloc(GetProcessHeap(), 0, SRTM_SIZE); if (buff == NULL) { @@ -164,7 +164,7 @@ int SendPatMessage(string roomid, string wxid) WxString wxRoomid(wsRoomid); WxString wxWxid(wsWxid); - funcSendPatMsg_t funcSendPatMsg = (funcSendPatMsg_t)(g_WeChatWinDllAddr + g_WxCalls.pm.call1); + SendPatMsg_t funcSendPatMsg = (SendPatMsg_t)(g_WeChatWinDllAddr + g_WxCalls.pm.call1); status = funcSendPatMsg((QWORD)(&wxRoomid), (QWORD)(&wxWxid)); return (int)status; @@ -176,7 +176,7 @@ int ForwardMessage(QWORD msgid, string receiver) uint32_t dbIdx = 0; QWORD localId = 0; - funcForwardMsg_t funcForwardMsg = (funcForwardMsg_t)(g_WeChatWinDllAddr + g_WxCalls.fm.call1); + ForwardMsg_t funcForwardMsg = (ForwardMsg_t)(g_WeChatWinDllAddr + g_WxCalls.fm.call1); if (GetLocalIdandDbidx(msgid, &localId, &dbIdx) != 0) { LOG_ERROR("Failed to get localId, Please check id: {}", to_string(msgid)); return status;