GrimAnticheat / Grim

Fully async, multithreaded, predictive, open source, 3.01 reach, 1.005 timer, 0.01% speed, 99.99% antikb, "bypassable" 1.8-1.20 anticheat.
GNU General Public License v3.0
1.06k stars 296 forks source link

ESP Bypass #1298

Closed Zamx114514 closed 7 months ago

Zamx114514 commented 7 months ago

Describe the bypass and how to replicate it

I have bypassed ESP in any version of GrimAC. This function seriously affects the player experience. It is recommended to fix it.

/*

import net.ccbluex.liquidbounce.api.minecraft.client.entity.IEntity import net.ccbluex.liquidbounce.event.EventTarget import net.ccbluex.liquidbounce.event.Render2DEvent import net.ccbluex.liquidbounce.event.Render3DEvent import net.ccbluex.liquidbounce.features.module.Module import net.ccbluex.liquidbounce.features.module.ModuleCategory import net.ccbluex.liquidbounce.features.module.ModuleInfo import net.ccbluex.liquidbounce.features.module.modules.misc.AntiBot import net.ccbluex.liquidbounce.ui.font.GameFontRenderer.Companion.getColorIndex import net.ccbluex.liquidbounce.utils.ClientUtils import net.ccbluex.liquidbounce.utils.EntityUtils import net.ccbluex.liquidbounce.utils.extensions.isClientFriend import net.ccbluex.liquidbounce.utils.render.ColorUtils import net.ccbluex.liquidbounce.utils.render.ColorUtils.rainbow import net.ccbluex.liquidbounce.utils.render.RenderUtils import net.ccbluex.liquidbounce.utils.render.WorldToScreen import net.ccbluex.liquidbounce.utils.render.shader.shaders.GlowShader import net.ccbluex.liquidbounce.utils.render.shader.shaders.OutlineShader import net.ccbluex.liquidbounce.value.BoolValue import net.ccbluex.liquidbounce.value.FloatValue import net.ccbluex.liquidbounce.value.IntegerValue import net.ccbluex.liquidbounce.value.ListValue import org.lwjgl.opengl.GL11 import org.lwjgl.util.vector.Vector3f import java.awt.Color import kotlin.math.max import kotlin.math.min

@ModuleInfo(name = "ESP", description = "Allows you to see targets through walls.", category = ModuleCategory.RENDER) class ESP : Module() { @JvmField val modeValue = ListValue("Mode", arrayOf("Box", "OtherBox", "WireFrame", "2D", "Real2D", "Outline", "ShaderOutline", "ShaderGlow"), "Box")

@JvmField
val outlineWidth = FloatValue("Outline-Width", 3f, 0.5f, 5f)

@JvmField
val wireframeWidth = FloatValue("WireFrame-Width", 2f, 0.5f, 5f)
private val shaderOutlineRadius = FloatValue("ShaderOutline-Radius", 1.35f, 1f, 2f)
private val shaderGlowRadius = FloatValue("ShaderGlow-Radius", 2.3f, 2f, 3f)
private val colorRedValue = IntegerValue("R", 255, 0, 255)
private val colorGreenValue = IntegerValue("G", 255, 0, 255)
private val colorBlueValue = IntegerValue("B", 255, 0, 255)
private val colorRainbow = BoolValue("Rainbow", false)
private val colorTeam = BoolValue("Team", false)
private val botValue = BoolValue("Bots", true)

@EventTarget
fun onRender3D(event: Render3DEvent?) {
    val mode = modeValue.get()
    val mvMatrix = WorldToScreen.getMatrix(GL11.GL_MODELVIEW_MATRIX)
    val projectionMatrix = WorldToScreen.getMatrix(GL11.GL_PROJECTION_MATRIX)
    val real2d = mode.equals("real2d", ignoreCase = true)

    if (real2d) {
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT)
        GL11.glEnable(GL11.GL_BLEND)
        GL11.glDisable(GL11.GL_TEXTURE_2D)
        GL11.glDisable(GL11.GL_DEPTH_TEST)
        GL11.glMatrixMode(GL11.GL_PROJECTION)
        GL11.glPushMatrix()
        GL11.glLoadIdentity()
        GL11.glOrtho(0.0, mc.displayWidth.toDouble(), mc.displayHeight.toDouble(), 0.0, -1.0, 1.0)
        GL11.glMatrixMode(GL11.GL_MODELVIEW)
        GL11.glPushMatrix()
        GL11.glLoadIdentity()
        GL11.glDisable(GL11.GL_DEPTH_TEST)
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA)
        classProvider.getGlStateManager().enableTexture2D()
        GL11.glDepthMask(true)
        GL11.glLineWidth(1.0f)
    }

    for (entity in mc.theWorld!!.loadedEntityList) {
        if (!classProvider.isEntityLivingBase(entity) || !botValue.get() && AntiBot.isBot(entity.asEntityLivingBase())) continue
        if (entity != mc.thePlayer && EntityUtils.isSelected(entity, false)) {
            val entityLiving = entity.asEntityLivingBase()
            val color = getColor(entityLiving)

            when (mode.toLowerCase()) {
                "box", "otherbox" -> RenderUtils.drawEntityBox(entity, color, !mode.equals("otherbox", ignoreCase = true))
                "2d" -> {
                    val renderManager = mc.renderManager
                    val timer = mc.timer
                    val posX: Double = entityLiving.lastTickPosX + (entityLiving.posX - entityLiving.lastTickPosX) * timer.renderPartialTicks - renderManager.renderPosX
                    val posY: Double = entityLiving.lastTickPosY + (entityLiving.posY - entityLiving.lastTickPosY) * timer.renderPartialTicks - renderManager.renderPosY
                    val posZ: Double = entityLiving.lastTickPosZ + (entityLiving.posZ - entityLiving.lastTickPosZ) * timer.renderPartialTicks - renderManager.renderPosZ
                    RenderUtils.draw2D(entityLiving, posX, posY, posZ, color.rgb, Color.BLACK.rgb)
                }
                "real2d" -> {
                    val renderManager = mc.renderManager
                    val timer = mc.timer
                    val bb = entityLiving.entityBoundingBox
                            .offset(-entityLiving.posX, -entityLiving.posY, -entityLiving.posZ)
                            .offset(entityLiving.lastTickPosX + (entityLiving.posX - entityLiving.lastTickPosX) * timer.renderPartialTicks,
                                    entityLiving.lastTickPosY + (entityLiving.posY - entityLiving.lastTickPosY) * timer.renderPartialTicks,
                                    entityLiving.lastTickPosZ + (entityLiving.posZ - entityLiving.lastTickPosZ) * timer.renderPartialTicks)
                            .offset(-renderManager.renderPosX, -renderManager.renderPosY, -renderManager.renderPosZ)
                    val boxVertices = arrayOf(doubleArrayOf(bb.minX, bb.minY, bb.minZ), doubleArrayOf(bb.minX, bb.maxY, bb.minZ), doubleArrayOf(bb.maxX, bb.maxY, bb.minZ), doubleArrayOf(bb.maxX, bb.minY, bb.minZ), doubleArrayOf(bb.minX, bb.minY, bb.maxZ), doubleArrayOf(bb.minX, bb.maxY, bb.maxZ), doubleArrayOf(bb.maxX, bb.maxY, bb.maxZ), doubleArrayOf(bb.maxX, bb.minY, bb.maxZ))
                    var minX = Float.MAX_VALUE
                    var minY = Float.MAX_VALUE
                    var maxX = -1f
                    var maxY = -1f
                    for (boxVertex in boxVertices) {
                        val screenPos = WorldToScreen.worldToScreen(Vector3f(boxVertex[0].toFloat(), boxVertex[1].toFloat(), boxVertex[2].toFloat()), mvMatrix, projectionMatrix, mc.displayWidth, mc.displayHeight)
                                ?: continue
                        minX = min(screenPos.x, minX)
                        minY = min(screenPos.y, minY)
                        maxX = max(screenPos.x, maxX)
                        maxY = max(screenPos.y, maxY)
                    }
                    if (minX > 0 || minY > 0 || maxX <= mc.displayWidth || maxY <= mc.displayWidth) {
                        GL11.glColor4f(color.red / 255.0f, color.green / 255.0f, color.blue / 255.0f, 1.0f)
                        GL11.glBegin(GL11.GL_LINE_LOOP)
                        GL11.glVertex2f(minX, minY)
                        GL11.glVertex2f(minX, maxY)
                        GL11.glVertex2f(maxX, maxY)
                        GL11.glVertex2f(maxX, minY)
                        GL11.glEnd()
                    }
                }
            }
        }
    }

    if (real2d) {
        GL11.glEnable(GL11.GL_DEPTH_TEST)
        GL11.glMatrixMode(GL11.GL_PROJECTION)
        GL11.glPopMatrix()
        GL11.glMatrixMode(GL11.GL_MODELVIEW)
        GL11.glPopMatrix()
        GL11.glPopAttrib()
    }
}

@EventTarget
fun onRender2D(event: Render2DEvent) {
    val mode = modeValue.get().toLowerCase()
    val partialTicks = event.partialTicks
    val shader = (if (mode.equals("shaderoutline", ignoreCase = true)) OutlineShader.OUTLINE_SHADER else if (mode.equals("shaderglow", ignoreCase = true)) GlowShader.GLOW_SHADER else null)
            ?: return
    val radius = if (mode.equals("shaderoutline", ignoreCase = true)) shaderOutlineRadius.get() else if (mode.equals("shaderglow", ignoreCase = true)) shaderGlowRadius.get() else 1f

    renderNameTags = false
    try {
        //search entities
        val entityMap = HashMap<Color, ArrayList<IEntity>>()
        for (entity in mc.theWorld!!.loadedEntityList) {
            if (!EntityUtils.isSelected(entity, false)) continue
            if (AntiBot.isBot(entity.asEntityLivingBase()) && !botValue.get()) continue
            //can draw
            val color = getColor(entity)
            if (!entityMap.containsKey(color)) {
                entityMap.put(color, ArrayList())
            }
            entityMap[color]!!.add(entity)
        }
        //then draw it
        for ((color, arr) in entityMap) {
            shader.startDraw(partialTicks)
            for (entity in arr) {
                mc.renderManager.renderEntityStatic(entity, partialTicks, true)
            }
            shader.stopDraw(color, radius, 1f)
        }
    } catch (ex: Exception) {
        ClientUtils.getLogger().error("An error occurred while rendering all entities for shader esp", ex)
    }
    renderNameTags = true
    shader.stopDraw(getColor(null), radius, 1f)
}

override val tag: String
    get() = modeValue.get()

fun getColor(entity: IEntity?): Color {
    run {
        if (entity != null && classProvider.isEntityLivingBase(entity)) {
            val entityLivingBase = entity.asEntityLivingBase()

            if (entityLivingBase.hurtTime > 0)
                return Color.RED
            if (classProvider.isEntityPlayer(entityLivingBase) && entityLivingBase.asEntityPlayer().isClientFriend())
                return Color.BLUE

            if (colorTeam.get()) {
                val chars: CharArray = (entityLivingBase.displayName ?: return@run).formattedText.toCharArray()
                var color = Int.MAX_VALUE
                for (i in chars.indices) {
                    if (chars[i] != '§' || i + 1 >= chars.size) continue
                    val index = getColorIndex(chars[i + 1])
                    if (index < 0 || index > 15) continue
                    color = ColorUtils.hexColors[index]
                    break
                }

                return Color(color)
            }
        }
    }

    return if (colorRainbow.get()) rainbow() else Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get())
}

companion object {
    @JvmField
    var renderNameTags = true
}

}

Grim version

all

Server version

all

Plugins

grimac

MachineBreaker commented 7 months ago

Unless you mess somehow with the tracked entities position being sent to the client (which i think is not possible), there's no way to detect ESP