L L4D2node

CRConServer::HandleFailedRconAuth

0x0020b990 · 839 bytes · __thiscall

_ZN11CRConServer20HandleFailedRconAuthERK8netadr_s

Decompiled

undefined (2 params)

/* CRConServer::HandleFailedRconAuth(netadr_s const&) */

undefined4 __thiscall CRConServer::HandleFailedRconAuth(CRConServer *this,netadr_s *param_1)

{
  float fVar1;
  float fVar2;
  ushort uVar3;
  undefined2 uVar4;
  char cVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  CUtlLinkedList<float,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>>
  *pCVar11;
  int iVar12;
  int *piVar13;
  longdouble lVar14;
  float local_20 [4];
  
  iVar10 = 0;
  iVar8 = *(int *)(this + 0x38);
  if (0 < iVar8) {
    do {
      cVar5 = netadr_s::CompareAdr
                        (param_1,(netadr_s *)(*(int *)(this + 0x2c) + iVar10 * 0x2c + 4),true);
      if (cVar5 != '\0') {
        piVar13 = (int *)(iVar10 * 0x2c + *(int *)(this + 0x2c));
        if (piVar13 != (int *)0x0) {
          pCVar11 = (CUtlLinkedList<float,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>>
                     *)(piVar13 + 4);
          goto LAB_0020b9f5;
        }
        break;
      }
      iVar10 = iVar10 + 1;
    } while (iVar10 != iVar8);
    iVar10 = 0;
    if (0x1f < iVar8) {
      while (iVar12 = iVar10, iVar10 = iVar12 + 1, iVar10 != iVar8) {
        while (iVar12 != -1) {
          cVar5 = FailedRCon_t::operator<
                            ((FailedRCon_t *)(*(int *)(this + 0x2c) + iVar10 * 0x2c),
                             (FailedRCon_t *)(iVar12 * 0x2c + *(int *)(this + 0x2c)));
          if (cVar5 != '\0') {
            iVar12 = iVar10;
          }
          iVar10 = iVar10 + 1;
          if (iVar10 == iVar8) goto LAB_0020bbed;
        }
      }
LAB_0020bbed:
      iVar9 = iVar12 * 0x2c;
      pCVar11 = (CUtlLinkedList<float,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>>
                 *)(iVar9 + *(int *)(this + 0x2c) + 0x10);
      CUtlLinkedList<float,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>>
      ::RemoveAll(pCVar11);
      CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>::Purge
                ((CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short> *)pCVar11);
      iVar8 = *(int *)(this + 0x38);
      iVar10 = (iVar8 - iVar12) + -1;
      if (0 < iVar10) {
        _V_memmove((void *)(*(int *)(this + 0x2c) + iVar9),
                   (void *)(*(int *)(this + 0x2c) + 0x2c + iVar9),iVar10 * 0x2c);
        iVar8 = *(int *)(this + 0x38);
      }
      iVar8 = iVar8 + -1;
      *(int *)(this + 0x38) = iVar8;
      goto LAB_0020bc73;
    }
  }
  iVar8 = *(int *)(this + 0x38);
LAB_0020bc73:
  iVar8 = CUtlVector<CRConServer::FailedRCon_t,CUtlMemory<CRConServer::FailedRCon_t,int>>::
          InsertBefore((CUtlVector<CRConServer::FailedRCon_t,CUtlMemory<CRConServer::FailedRCon_t,int>>
                        *)(this + 0x2c),iVar8);
  piVar13 = (int *)(iVar8 * 0x2c + *(int *)(this + 0x2c));
  piVar13[1] = *(int *)param_1;
  pCVar11 = (CUtlLinkedList<float,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>>
             *)(piVar13 + 4);
  piVar13[2] = *(int *)(param_1 + 4);
  uVar4 = *(undefined2 *)(param_1 + 8);
  *piVar13 = 0;
  *(undefined2 *)(piVar13 + 3) = uVar4;
  CUtlLinkedList<float,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>>
  ::RemoveAll(pCVar11);
LAB_0020b9f5:
  *piVar13 = *piVar13 + 1;
  lVar14 = (longdouble)CBaseServer::GetTime((CBaseServer *)&sv);
  local_20[0] = (float)lVar14;
  CUtlLinkedList<float,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>>
  ::InsertBefore(pCVar11,0xffff,local_20);
  uVar3 = *(ushort *)((int)piVar13 + 0x22);
  while (0x14 < uVar3) {
    CUtlLinkedList<float,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<float,unsigned_short>,unsigned_short>>
    ::Unlink(pCVar11,0);
    *(short *)(piVar13[4] + 6) = (short)piVar13[8];
    *(undefined2 *)(piVar13 + 8) = 0;
    uVar3 = *(ushort *)((int)piVar13 + 0x22);
  }
  iVar8 = *(int *)(sv_rcon_maxfailures._28_4_ + 0x30);
  if (iVar8 < *(int *)(sv_rcon_minfailures._28_4_ + 0x30)) {
    ConVar::SetValue(0x3ead00);
    ConVar::SetValue(0x3eaca0);
    iVar8 = *(int *)(sv_rcon_maxfailures._28_4_ + 0x30);
  }
  if (*piVar13 <= iVar8) {
    iVar8 = *(ushort *)((int)piVar13 + 0x22) - 1;
    if (iVar8 == -1) {
      iVar10 = 0;
    }
    else {
      iVar12 = iVar8 * 8;
      iVar10 = 0;
      do {
        fVar1 = *(float *)(piVar13[4] + iVar12);
        fVar2 = *(float *)(sv_rcon_minfailuretime._28_4_ + 0x2c);
        lVar14 = (longdouble)CBaseServer::GetTime((CBaseServer *)&sv);
        if ((float)lVar14 <= fVar1 + fVar2) {
          iVar10 = iVar10 + 1;
        }
        iVar8 = iVar8 + -1;
        iVar12 = iVar12 + -8;
      } while (iVar8 != -1);
    }
    if (iVar10 <= *(int *)(sv_rcon_minfailures._28_4_ + 0x30)) {
      return 0;
    }
  }
  uVar6 = netadr_s::ToString((netadr_s *)(piVar13 + 1),true);
  ConMsg("Banning %s for rcon hacking attempts\n",uVar6);
  uVar6 = netadr_s::ToString((netadr_s *)(piVar13 + 1),true);
  uVar6 = va("addip %i %s\n",*(undefined4 *)(sv_rcon_banpenalty._28_4_ + 0x30),uVar6);
  uVar7 = Cbuf_GetCurrentPlayer();
  Cbuf_AddText(uVar7,uVar6,0);
  cVar5 = NET_IsDedicated();
  if (cVar5 != '\0') {
    Cbuf_Execute();
  }
  return 1;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)