LUACN论坛

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
热搜: YJWOW MagicStone BoL
查看: 365|回复: 1

3.35服务端 外挂检测源码(附git地址)

[复制链接]
发表于 2022-2-25 19:05:03 | 显示全部楼层 |阅读模式
本帖最后由 7858321 于 2022-2-25 07:11 PM 编辑

截取其中移动速度外挂的检测函数看一下


[color=var(--darkreader-text--color-prettylights-syntax-keyword)]void [color=var(--darkreader-text--color-prettylights-syntax-entity)]AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
{
    if (!sConfigMgr->GetOption<bool>("Anticheat.DetectSpeedHack", true))
        return;
    ObjectGuid key = player->GetGUID();
    // We also must check the map because the movementFlag can be modified by the client.
    // If we just check the flag, they could always add that flag and always skip the speed hacking detection.
    // 369 == DEEPRUN TRAM
    if (m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && player->GetMapId() == 369)
        return;
    uint32 distance2D = (uint32)movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos);
    uint8 moveType = 0;
    // we need to know HOW is the player moving
    // TO-DO: Should we check the incoming movement flags?
    if (player->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING))
        moveType = MOVE_SWIM;
    else if (player->IsFlying())
        moveType = MOVE_FLIGHT;
    else if (player->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
        moveType = MOVE_WALK;
    else
        moveType = MOVE_RUN;
    // how many yards the player can do in one sec.
    uint32 speedRate = (uint32)(player->GetSpeed(UnitMoveType(moveType)) + movementInfo.jump.xyspeed);
    // how long the player took to move to here.
    uint32 timeDiff = getMSTimeDiff(m_Players[key].GetLastMovementInfo().time, movementInfo.time);
    if (!timeDiff)
        timeDiff = 1;
    // this is the distance doable by the player in 1 sec, using the time done to move to this point.
    uint32 clientSpeedRate = distance2D * 1000 / timeDiff;
    // we did the (uint32) cast to accept a margin of tolerance
    if (clientSpeedRate > speedRate)
    {
        if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", false))
            LOG_INFO("module", "AnticheatMgr:: Speed-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString());
        BuildReport(player, SPEED_HACK_REPORT);
    }
}




可以看到在暴风与铁炉堡的矿道地铁是不对速度做检测的
下面是传送检测函数
[color=var(--darkreader-text--color-prettylights-syntax-keyword)]void [color=var(--darkreader-text--color-prettylights-syntax-entity)]AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementInfo)
{

    if (!sConfigMgr->GetOption<bool>("Anticheat.DetectTelePortHack", true))

        return;


    ObjectGuid key = player->GetGUID();


    if (m_Players[key].GetLastMovementInfo().pos.GetPositionX() == movementInfo.pos.GetPositionX())

        return;


    float lastX = m_Players[key].GetLastMovementInfo().pos.GetPositionX();

    float newX = movementInfo.pos.GetPositionX();


    float lastY = m_Players[key].GetLastMovementInfo().pos.GetPositionY();

    float newY = movementInfo.pos.GetPositionY();


    float xDiff = fabs(lastX - newX);

    float yDiff = fabs(lastY - newY);


    if ((xDiff >= 50.0f || yDiff >= 50.0f) && !player->CanTeleport())

    {

        if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))

        {

            // display warning at the center of the screen, hacky way?

            std::string str = "";

            str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport Hack Detected!";

            WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));

            data << str;

            sWorld->SendGlobalGMMessage(&data);

        }

        if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", false))

            LOG_INFO("module", "AnticheatMgr:: Teleport-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString());


        BuildReport(player, TELEPORT_HACK_REPORT);

    }

    else if (player->CanTeleport())

        player->SetCanTeleport(false);

}

就是进行坐标对比,相差大于50就....附上git地址,有兴趣可以看下GitHub源码地址

回复

使用道具 举报

发表于 2022-9-2 14:18:24 | 显示全部楼层
虽然看不懂,但是还是支持下。。。。。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

小黑屋|手机版|Archiver|LUACN论坛

GMT+8, 2026-11-13 08:45 AM , Processed in 0.019132 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表