CSGO: Proper fake ban using RetrieveMessage hook
EGCResults __fastcall Hook_RetrieveMessage(void* ecx, void* edx, uint32_t *punMsgType, void *pubDest, uint32_t cubDest, uint32_t *pcubMsgSize)
{
static auto ofunc = SteamGameCoordinator_hook.get_original(2);
EGCResults status = ofunc(ecx, punMsgType, pubDest, cubDest, pcubMsgSize);
uint32_t messageType = *punMsgType & 0x7FFFFFFF;
if (messageType == k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello)
{
CMsgGCCStrike15_v2_MatchmakingGC2ClientHello Message;
Message.ParsePartialFromArray((void*)((DWORD)pubDest + 8), *pcubMsgSize - 8);
if (p_Settings.fakeban) {
Message.clear_player_cur_xp();
Message.clear_player_level();
Message.mutable_ranking()->set_rank_id(0);
if (p_Settings.fakevac) {
Message.mutable_ranking()->set_wins(-1);
Message.clear_penalty_reason();
Message.clear_penalty_seconds();
Message.set_vac_banned(1);
} else {
Message.mutable_ranking()->set_wins(-1);
Message.clear_vac_banned();
Message.set_penalty_reason(p_Settings.fakebantype);
Message.set_penalty_seconds(35996400);
if (p_Settings.fakebantimer == 0 && p_Settings.banexpire) {
Message.set_penalty_seconds(1);
}
if (p_Settings.fakebantimer != 0) {
Message.set_penalty_seconds((p_Settings.fakebantimer * 60) * 60);
}
}
}
if (!p_Settings.fakeban) {
Message.mutable_ranking()->set_wins(g_PreviousWins); // figure it out not 2 hard :3
Message.mutable_ranking()->set_rank_id(p_Settings.profile_mmrank);
}
Message.mutable_commendation()->set_cmd_friendly(p_Settings.profile_cmdfriendly);
Message.mutable_commendation()->set_cmd_teaching(p_Settings.profile_cmdteacher);
Message.mutable_commendation()->set_cmd_leader(p_Settings.profile_cmdleader);
Message.SerializeToArray((void*)((DWORD)pubDest + 8), Message.ByteSize());
uint32_t msgsize = *pcubMsgSize;
*pcubMsgSize = Message.ByteSize() + 8;
}
g_convar->ConsoleColorPrintf(Color::Green, "[->] [%d]\n", *punMsgType & 0x7FFFFFFF);
if (status != k_EGCResultOK)
return status;
return status;
}
Yeah, I know this already got posted or something similar this just restores and removes rank aswell to look more legit. Enjoy.
|