示例#1
0
void ChatControler::_getMesage(service::ErrorInfo &info, int64 targetId, std::vector<service::MsgPtr>msgPtr)
{
    qDebug() << Q_FUNC_INFO << msgPtr.size();
    MsgList msgList;
    //std::shared_ptr<service::Msg> msg;

    for(auto msg:msgPtr){
        if(msg->msgtype == 2||msg->msgtype == 8){
            std::shared_ptr<service::MsgText> msgText = std::dynamic_pointer_cast<service::MsgText>(msg);
            Msg item;
            item.activeType = QString::number(msgText->active_type);
            item.body = QString::fromStdString(utils::MsgUtils::getText(msgText->body));
            item.fromid = QString::number(msgText->fromid);
            item.localid = QString::number(msgText->localid);
            item.msgid = QString::number(msgText->msgid);
            item.msgProperties = QString::fromStdString(msgText->msg_properties);
            item.msgtype = QString::number(msgText->msgtype);
            item.relatedMsgid = QString::number(msgText->related_msgid);
            item.targetid = QString::number(msgText->targetid);
            item.time = QString::number(msgText->time);
            item.toid = QString::number(msgText->toid);
            msgList.insert(msgList.size(),item);
        }
   }
    if(!info.code()){
        emit getMessagesBack(true,targetId,msgList);
    }else{
        emit getMessagesBack(true,targetId,msgList);
    }
}
示例#2
0
CCrypto::CCrypto()
	: Encrypt_Detour( NULL ), Decrypt_Detour( NULL )
{
	CSimpleScan steamClientScan( "steamclient.dll" );


	SymmetricEncryptWithIVFn pEncrypt = NULL;
	bool bEncrypt = steamClientScan.FindFunction(
		"\x53\x8B\xDC\x83\xEC\x08\x83\xE4\xF0\x83\xC4\x04\x55\x8B\x6B\x04\x89\x6C\x24\x04\x8B\xEC\x64\xA1\x00\x00\x00\x00",
		"xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
		(void **)&pEncrypt
	);

	Encrypt_Orig = pEncrypt;

	g_pLogger->LogConsole( "CCrypto::SymmetricEncryptWithIV = 0x%x\n", Encrypt_Orig );


	SymmetricDecryptRecoverIVFn pDecrypt = NULL;
	bool bDecrypt = steamClientScan.FindFunction(
		"\x55\x8B\xEC\x81\xEC\x04\x01\x00\x00\x83\x7D\x08\x00\x53",
		"xxxxxxxxxxxxxx",
		(void **)&pDecrypt
	);

	Decrypt_Orig = pDecrypt;

	g_pLogger->LogConsole( "CCrypto::SymmetricDecryptRecoverIV = 0x%x\n", Decrypt_Orig );


	char *pGetMessageList = NULL;
	bool bGetMessageList = steamClientScan.FindFunction(
		"\xA1\x00\x00\x00\x00\xA8\x01\x75\x00\x83\xC8\x01\xB9\x00\x00\x00\x00\x0056",
		"x????xxx?xxxx????x",
		(void **)&pGetMessageList
	);

	if (bGetMessageList)
	{
		const uint32 uMessageListStartPtrOffset = 38;
		const uint32 uMessageListEndPtrOffset = uMessageListStartPtrOffset + 26;

		MsgInfo_t *pInfos = *(MsgInfo_t **)( pGetMessageList + uMessageListStartPtrOffset );
		MsgInfo_t *pEndInfos = *(MsgInfo_t **)( pGetMessageList + uMessageListEndPtrOffset );
		uint16 numMessages = ( ( int )pEndInfos - ( int )pInfos ) / sizeof( MsgInfo_t );

		g_pLogger->LogConsole( "pGetMessageList = 0x%x\npInfos = 0x%x\nnumMessages = %d\n", pGetMessageList, pInfos, numMessages );


		for ( uint16 x = 0 ; x < numMessages; x++ )
		{
			eMsgList.insert( MsgPair( pInfos->eMsg, pInfos ) );

			pInfos++;
		}

		if ( eMsgList.size() != 0 )
		{
			// should only delete our existing files if we have something new to dump
			g_pLogger->DeleteFile( "emsg_list.txt", false );
			g_pLogger->DeleteFile( "emsg_list_detailed.txt", false );

			for ( MsgList::iterator iter = eMsgList.begin() ; iter != eMsgList.end() ; iter++ )
			{
				MsgInfo_t *pInfo = iter->second;

				g_pLogger->LogFile( "emsg_list.txt", false, "\t%s = %d,\r\n", pInfo->pchMsgName, pInfo->eMsg );
				g_pLogger->LogFile( "emsg_list_detailed.txt", false, "\t%s = %d, // flags: %d, server type: %d\r\n", pInfo->pchMsgName, pInfo->eMsg, pInfo->nFlags, pInfo->k_EServerTarget );
			}

			g_pLogger->LogConsole( "Dumped emsg list! (%d messages)\n", eMsgList.size() );
		}
		else
		{
			g_pLogger->LogConsole( "Unable to dump emsg list: No messages! (Offset changed?)\n" );
		} 
	}
	else
	{
		g_pLogger->LogConsole( "Unable to find GetMessageList.\n" );
	}

	SymmetricEncryptWithIVFn encrypt = CCrypto::SymmetricEncryptWithIV;
	SymmetricDecryptRecoverIVFn decrypt = CCrypto::SymmetricDecryptRecoverIV;

	if ( bEncrypt )
	{
		Encrypt_Detour = new CSimpleDetour((void **) &Encrypt_Orig, (void*) encrypt);
		Encrypt_Detour->Attach();

		g_pLogger->LogConsole( "Detoured SymmetricEncryptWithIV!\n" );
	}
	else
	{
		g_pLogger->LogConsole( "Unable to hook SymmetricEncryptWithIV: Func scan failed.\n" );
	}

	if ( bDecrypt )
	{
		Decrypt_Detour = new CSimpleDetour((void **) &Decrypt_Orig, (void*) decrypt);
		Decrypt_Detour->Attach();

		g_pLogger->LogConsole( "Detoured SymmetricDecryptRecoverIV!\n" );
	}
	else
	{
		g_pLogger->LogConsole( "Unable to hook SymmetricDecryptRecoverIV: Func scan failed.\n" );
	}
}