Rise 5.99 AutoGroomer module 1 files, 105 lines

Rise 5.99 AutoGroomer: Full Source Analysis

AutoGroomer sends scripted harassment chat: every 60 ticks it broadcasts a message picked from a fixed pool of 16 hardcoded lines, or with DM Messages enabled it sends /msg <name> <message> to every…

dev/rise/module/impl/other/AutoGroomer.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-08-13

Packets This Module Uses

Analysis

Overview

AutoGroomer sends scripted harassment chat: every 60 ticks it broadcasts a message picked from a fixed pool of 16 hardcoded lines, or with DM Messages enabled it sends /msg <name> <message> to every non-bot, visible player within 8 blocks (distance squared < 64) - once per player per world, or repeatedly every 20 ticks in Spam mode. The Chat Bypass toggle interleaves a random symbol from a five-symbol set after every character to defeat text filters. All traffic goes out as C01PacketChatMessage through the NetHandler's direct queue, and a per-world entity-id list keeps targets from being re-messaged until a world change or module toggle clears it.

Dispatch

onPreMotion runs the whole module. With DM Messages off, it sends one public chat message every 60 ticks (ticksExisted % 60 == 0) and returns. With DM Messages on, it iterates mc.theWorld.playerEntities and targets every player that is not the local player, not invisible, not registered in AntiBot.bots, and within 64 squared distance; each target receives a C01PacketChatMessage built as '/msg ' + name + ' ' + message. The ids list of entity ids gates each player to a single message per world, unless Spam mode is enabled - Spam both drops the dedupe and changes the cadence gate to every 20 ticks.

Chat bypass

When Chat Bypass is enabled, the message is rebuilt character by character: each letter is appended followed by a random character drawn from the array '⛍⛌⛗⛟', roughly doubling the message length. The goal is to break substring-based filters that look for the banned phrases inside the fixed message pool - the inserted symbols sit between every letter, so no contiguous banned substring survives. The pool itself is hardcoded (16 lines selected by randomInt), and the same pool is used for both public chat and DMs.

State lifecycle

The ids list is the only state. It is cleared on every WorldChangedEvent, on module enable, and on module disable, so a player is eligible to be groomed again after any world change or toggle cycle. Because the module holds no timer of its own and relies entirely on ticksExisted arithmetic, the cadence (60 ticks public, 20 ticks spam) is tied to the client's tick counter and drifts with lag and GUI pauses.

source AutoGroomer.java

AutoGroomer.java105 lines · JavaOriginal ↗
1
package dev.rise.module.impl.other;
2
3
import dev.rise.event.impl.motion.PreMotionEvent;
4
import dev.rise.event.impl.other.WorldChangedEvent;
5
import dev.rise.module.Module;
6
import dev.rise.module.api.ModuleInfo;
7
import dev.rise.module.enums.Category;
8
import dev.rise.module.impl.combat.AntiBot;
9
import dev.rise.setting.impl.BooleanSetting;
10
import net.minecraft.entity.player.EntityPlayer;
11
import net.minecraft.network.play.client.C01PacketChatMessage;
12
13
import java.util.ArrayList;
14
import java.util.Arrays;
15
import java.util.List;
16
17
@ModuleInfo(name = "AutoGroomer", description = "Grooms people for you", category = Category.OTHER)
18
public final class AutoGroomer extends Module {
19
20
    private final char[] chars = new char[]{
21
            '⛍', '⛌', '⛗', '⛗', '⛟'
22
    };
23
    private final List<Integer> ids = new ArrayList<>();
24
    private final List<String> messages = Arrays.asList("can I have some tittie pics?", "do you wanna be above or below?",
25
            "I am gonna be pounding you 24/7", "I am gonna send you something okay? no sharing :wink:", "I am fine below or above",
26
            "you are gonna be riding this dick all night", "oh I am creaming just looking at you", "I want to make you cum.",
27
            "my balls are gonna be dry tonight thanks to you", "I am gonna relieve you all night", "daddy is ready.",
28
            "you will be screaming my name tonight", "fly up here and you can have as much as you want",
29
            "lick it off like that, until I ram your mouth.", "daddy wants your mouth on all of this tonight",
30
            "I bet you like daddy pounding you so hard that your knees give out and drag your face forward as I literally pound you flat into the bed.");
31
32
    private final BooleanSetting chatBypass = new BooleanSetting("Chat Bypass", this, false);
33
    private final BooleanSetting dm = new BooleanSetting("DM Messages", this, false);
34
    private final BooleanSetting spam = new BooleanSetting("Spam", this, false);
35
36
    @Override
37
    public void onPreMotion(final PreMotionEvent event) {
38
        if (!dm.isEnabled() && mc.thePlayer.ticksExisted % 60 == 0) {
39
            String message = messages.get(randomInt(0, messages.size()));
40
41
            if (chatBypass.isEnabled()) {
42
                final StringBuilder bypass = new StringBuilder(message.length() * 2);
43
44
                for (int i = 0; i < message.length(); i++) {
45
                    final char character = message.charAt(i);
46
                    final char randomChar = chars[randomInt(0, chars.length)];
47
48
                    bypass.append(character).append(randomChar);
49
                }
50
51
                message = bypass.toString();
52
            }
53
54
            mc.thePlayer.sendChatMessage(message);
55
56
            return;
57
        }
58
59
        if (spam.isEnabled() && mc.thePlayer.ticksExisted % 20 != 0) return;
60
61
        for (final EntityPlayer player : mc.theWorld.playerEntities) {
62
            if (player != mc.thePlayer && !player.isInvisible() && !AntiBot.bots.contains(player)
63
                    && player.getDistanceSqToEntity(mc.thePlayer) < 64) {
64
65
                if (!ids.contains(player.getEntityId()) || spam.isEnabled()) {
66
                    String message = messages.get(randomInt(0, messages.size()));
67
68
                    if (chatBypass.isEnabled()) {
69
                        final StringBuilder bypass = new StringBuilder(message.length() * 2);
70
71
                        for (int i = 0; i < message.length(); i++) {
72
                            final char character = message.charAt(i);
73
                            final char randomChar = chars[randomInt(0, chars.length)];
74
75
                            bypass.append(character).append(randomChar);
76
                        }
77
78
                        message = bypass.toString();
79
                    }
80
81
                    mc.getNetHandler().addToSendQueue(new C01PacketChatMessage(
82
                            "/msg " + player.getName() + " " + message
83
                    ));
84
85
                    ids.add(player.getEntityId());
86
                }
87
            }
88
        }
89
    }
90
91
    @Override
92
    public void onWorldChanged(final WorldChangedEvent event) {
93
        ids.clear();
94
    }
95
96
    @Override
97
    protected void onDisable() {
98
        ids.clear();
99
    }
100
101
    @Override
102
    protected void onEnable() {
103
        ids.clear();
104
    }
105
}

What this file does

The module is fully self-contained in one class. onPreMotion branches between public chat (every 60 ticks) and DM mode (per-player /msg within 64 squared distance, deduped by the ids list, re-armed every 20 ticks in Spam mode), builds the bypass-obfuscated message when Chat Bypass is on, and pushes C01PacketChatMessage packets through addToSendQueue. onWorldChanged, onEnable and onDisable all clear the ids list so targets become eligible again.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat Text (chat frequency and repeat similarity)

Text.java331 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.chat;
16
17
import java.util.Collections;
18
import java.util.LinkedList;
19
import java.util.List;
20
import java.util.Map;
21
22
import org.bukkit.entity.Player;
23
24
import fr.neatmonster.nocheatplus.NCPAPIProvider;
25
import fr.neatmonster.nocheatplus.checks.Check;
26
import fr.neatmonster.nocheatplus.checks.CheckType;
27
import fr.neatmonster.nocheatplus.checks.chat.analysis.MessageLetterCount;
28
import fr.neatmonster.nocheatplus.checks.chat.analysis.WordLetterCount;
29
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.LetterEngine;
30
import fr.neatmonster.nocheatplus.checks.combined.CombinedData;
31
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
32
import fr.neatmonster.nocheatplus.components.registry.feature.INotifyReload;
33
import fr.neatmonster.nocheatplus.config.ConfigFile;
34
import fr.neatmonster.nocheatplus.config.ConfigManager;
35
import fr.neatmonster.nocheatplus.players.IPlayerData;
36
import fr.neatmonster.nocheatplus.utilities.ColorUtil;
37
import fr.neatmonster.nocheatplus.utilities.StringUtil;
38
39
/**
40
 * Some alternative more or less advanced analysis methods.
41
 * @author asofold
42
 *
43
 */
44
public class Text extends Check implements INotifyReload {
45
46
    private LetterEngine engine = null;
47
48
    /** Not really cancelled but above threshold for actions. */
49
    private String lastCancelledMessage = "";
50
    private long lastCancelledTime = 0;
51
52
    private String lastGlobalMessage = "";
53
    private long lastGlobalTime = 0;
54
55
    public Text() {
56
        super(CheckType.CHAT_TEXT);
57
        init();
58
    }
59
60
    /**
61
     * Start analysis.
62
     * @param player
63
     *          The player who issued the message.
64
     * @param message
65
     *          The message to check.
66
     * @param captcha 
67
     *          Used for starting captcha on failure, if configured so.
68
     * @param alreadyCancelled 
69
     * @return
70
     */
71
    public boolean check(final Player player, final String message, 
72
                         final ChatConfig cc, final IPlayerData pData,
73
                         final ICaptcha captcha, boolean isMainThread, final boolean alreadyCancelled) {
74
        final ChatData data = pData.getGenericInstance(ChatData.class);
75
        synchronized (data) {
76
            return unsafeCheck(player, message, captcha, cc, data, pData, isMainThread, alreadyCancelled);
77
        }
78
    }
79
80
    private void init() {
81
        // Set some things from the global config.
82
        final ConfigFile config = ConfigManager.getConfigFile();
83
        final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
84
        if (engine != null) {
85
            engine.clear();
86
            api.removeComponent(engine);
87
        }
88
        engine = new LetterEngine(config);
89
        api.addComponent(engine);
90
    }
91
92
    @Override
93
    public void onReload() {
94
        synchronized(engine) {
95
            engine.clear();
96
        }
97
        init();
98
    }
99
100
    /**
101
     * Check without further synchronization.
102
     * @param player
103
     * @param message
104
     * @param captcha
105
     * @param cc
106
     * @param data
107
     * @param isMainThread 
108
     * @param alreadyCancelled 
109
     * @return
110
     */
111
    private boolean unsafeCheck(final Player player, final String message, final ICaptcha captcha,
112
                                final ChatConfig cc, final ChatData data, final IPlayerData pData,
113
                                boolean isMainThread, final boolean alreadyCancelled) {
114
115
        // Test captcha.
116
        if (captcha.shouldCheckCaptcha(player, cc, data, pData)) {
117
            captcha.checkCaptcha(player, message, cc, data, isMainThread);
118
            return true;
119
        } 
120
        else if (alreadyCancelled) {
121
            // Skip checking.
122
            return true;
123
        }
124
125
        final long time = System.currentTimeMillis();
126
        final String lcMessage = message.trim().toLowerCase();
127
        boolean cancel = false;
128
        final boolean debug = pData.isDebugActive(type);
129
        final List<String> debugParts;
130
        if (debug) {
131
            debugParts = new LinkedList<String>();
132
            debugParts.add("Message (length=" + message.length()+"): ");
133
        }
134
        else debugParts = null;
135
136
        // Update the frequency interval weights.
137
        data.chatFrequency.update(time);
138
139
        // Score for this message (violation score).
140
        float score = 0;
141
        final MessageLetterCount letterCounts = new MessageLetterCount(message);
142
        final int msgLen = message.length();
143
144
145
146
        // (Following: random/made up criteria.)
147
        // TODO: Create tests for all methods with wordlists, fake chat (refactor for that).
148
        // Full message processing. ------------
149
        // Upper case.
150
        if (letterCounts.fullCount.upperCase > msgLen / 3) {
151
            // TODO: Regard chunks of 48 or so letters of the message for this?
152
            final float wUpperCase = 0.6f * letterCounts.fullCount.getUpperCaseRatio();
153
            score += wUpperCase  * cc.textMessageUpperCase;
154
        }
155
156
        // Letters vs. word length.
157
        if (msgLen > 4) {
158
            final float fullRep = letterCounts.fullCount.getLetterCountRatio();
159
            // Long messages: very small and very big are bad !
160
            // 128 is a quick attempt to make one long message possible on 1.11.
161
            final float wRepetition = (float) Math.min(msgLen, 128) / 15.0f * Math.abs(0.5f - fullRep);
162
            score += wRepetition * cc.textMessageLetterCount;
163
164
            // Number of words vs. length of message
165
            final float fnWords = (float) letterCounts.words.length / (float) msgLen;
166
            if (fnWords > 0.75f) { // TODO: balance or configure or remove ?
167
                score += fnWords  * cc.textMessagePartition;
168
            }
169
        }
170
171
        final CombinedData cData = pData.getGenericInstance(CombinedData.class);
172
        final long timeout = 8000; // TODO: maybe set dynamically in data.
173
        // Repetition of last message.
174
        if (cc.textMsgRepeatSelf != 0f && time - data.chatLastTime < timeout) {
175
            if (StringUtil.isSimilar(lcMessage, data.chatLastMessage, 0.8f)) {
176
                final float timeWeight = (float) (timeout - (time - data.chatLastTime)) / (float) timeout; 
177
                score += cc.textMsgRepeatSelf * timeWeight;
178
            }
179
        }
180
        // Repetition of last global message.
181
        if (cc.textMsgRepeatGlobal != 0f && time - lastGlobalTime < timeout) {
182
            if (StringUtil.isSimilar(lcMessage, lastGlobalMessage, 0.8f)) {
183
                final float timeWeight = (float) (timeout - (time - lastGlobalTime)) / (float) timeout; 
184
                score += cc.textMsgRepeatGlobal * timeWeight;
185
            }
186
        }
187
        // Repetition of last cancelled message.
188
        if (cc.textMsgRepeatCancel != 0f && time - lastCancelledTime < timeout) {
189
            if (StringUtil.isSimilar(lcMessage, lastCancelledMessage, 0.8f)) {
190
                final float timeWeight = (float) (timeout - (time - lastCancelledTime)) / (float) timeout; 
191
                score += cc.textMsgRepeatCancel * timeWeight;
192
            }
193
        }
194
        // Chat quickly after join.
195
        if (cc.textMsgAfterJoin != 0f && time - cData.lastJoinTime < timeout) {
196
            final float timeWeight = (float) (timeout - (time - cData.lastJoinTime)) / (float) timeout;
197
            score += cc.textMsgAfterJoin * timeWeight; 
198
        }
199
        // Chat without moving.
200
        if (cc.textMsgNoMoving != 0f && time - cData.lastMoveTime > timeout) {
201
            score += cc.textMsgNoMoving;
202
        }
203
204
205
206
        // Per word checks. -------------------
207
        float wWords = 0.0f;
208
        final float avwLen = (float) msgLen / (float) letterCounts.words.length; 
209
        for (final WordLetterCount word : letterCounts.words) {
210
            float wWord = 0.0f;
211
            final int wLen = word.word.length();
212
            // TODO: ? used letters vs. word length.
213
214
            // Length of word vs. av. word length.
215
            final float fLenAv = Math.abs(avwLen - (float) wLen) / avwLen;
216
            wWord += fLenAv * cc.textMessageLengthAv;
217
218
            // Length of word vs. message length;
219
            final float fLenMsg = (float) wLen / (float) msgLen;
220
            wWord += fLenMsg * cc.textMessageLengthMsg;
221
222
            // Not letter:
223
            float notLetter = word.getNotLetterRatio();
224
            notLetter *= notLetter;
225
            wWord += notLetter * cc.textMessageNoLetter;
226
227
            wWord *= wWord; // TODO: quadratic ? (configurable)
228
            wWords += wWord;
229
        }
230
        wWords /= (float) letterCounts.words.length;
231
        score += wWords;
232
233
        if (debug && score > 0f) {
234
            debugParts.add("Simple score: " + StringUtil.fdec3.format(score));
235
        }
236
237
        // Engine:
238
        // TODO: more fine grained sync !
239
        float wEngine = 0f;
240
        final Map<String, Float> engMap;
241
        synchronized (engine) {
242
            engMap = engine.process(letterCounts, player.getName(), cc, data);
243
            // TODO: more fine grained sync !s
244
            // TODO: different methods (add or max or add+max or something else).
245
            for (final Float res : engMap.values()) {
246
                if (cc.textEngineMaximum) {
247
                    wEngine = Math.max(wEngine, res.floatValue());
248
                }
249
                else wEngine += res.floatValue();
250
            }
251
        }
252
        score += wEngine;
253
254
255
        // Wrapping it up. --------------------
256
        // Add weight to frequency counts.
257
        final float normalScore = Math.max(cc.textFreqNormMin, score);
258
        data.chatFrequency.add(time, normalScore);
259
        final float accumulated = cc.textFreqNormWeight * data.chatFrequency.score(cc.textFreqNormFactor);
260
        final boolean normalViolation = accumulated > cc.textFreqNormLevel;
261
        final float shortTermScore = Math.max(cc.textFreqShortTermMin, score);
262
        data.chatShortTermFrequency.add(time, shortTermScore);
263
        // TODO: very short term (1st bucket) or do it indirectly.
264
        final float shortTermAccumulated = cc.textFreqShortTermWeight * data.chatShortTermFrequency.score(cc.textFreqShortTermFactor);
265
        final boolean shortTermViolation = shortTermAccumulated > cc.textFreqShortTermLevel;
266
267
        if (normalViolation || shortTermViolation) {
268
            lastCancelledMessage = lcMessage;
269
            lastCancelledTime = time;
270
271
            final double added;
272
            if (shortTermViolation) {
273
                added = (shortTermAccumulated - cc.textFreqShortTermLevel)/ 3.0;
274
            } 
275
            else added = (accumulated - cc.textFreqNormLevel) / 10.0; 
276
            data.textVL += added;
277
278
            if (captcha.shouldStartCaptcha(player, cc, data, pData)) {
279
                captcha.sendNewCaptcha(player, cc, data);
280
                cancel = true;
281
            }
282
            else {
283
                if (shortTermViolation) {
284
                    if (executeActions(player, data.textVL, added, cc.textFreqShortTermActions).willCancel()) {
285
                        cancel = true;
286
                    }
287
                }
288
                else if (normalViolation) {
289
                    if (executeActions(player, data.textVL, added, cc.textFreqNormActions).willCancel()) {
290
                        cancel = true;
291
                    }
292
                }
293
            }
294
        }
295
        else if (cc.chatWarningCheck && time - data.chatWarningTime > cc.chatWarningTimeout && (100f * accumulated / cc.textFreqNormLevel > cc.chatWarningLevel || 100f * shortTermAccumulated / cc.textFreqShortTermLevel > cc.chatWarningLevel)) {
296
            NCPAPIProvider.getNoCheatPlusAPI().sendMessageOnTick(player.getName(), ColorUtil.replaceColors(cc.chatWarningMessage));
297
            data.chatWarningTime = time;
298
        }
299
        else {
300
            data.textVL *= 0.95;
301
            if (cc.textAllowVLReset && normalScore < 2.0f * cc.textFreqNormWeight && shortTermScore < 2.0f * cc.textFreqShortTermWeight) {
302
                // Reset the VL.
303
                // Maybe elaborate on resetting conditions (after some timeout just divide by two or so?).
304
                data.textVL = 0.0;
305
            }
306
        }
307
308
        if (debug) {
309
            final List<String> keys = new LinkedList<String>(engMap.keySet());
310
            Collections.sort(keys);
311
            for (String key : keys) {
312
                Float s = engMap.get(key);
313
                if (s.floatValue() > 0.0f)
314
                    debugParts.add(key + ":" + StringUtil.fdec3.format(s));
315
            }
316
            if (wEngine > 0.0f)
317
                debugParts.add("Engine score (" + (cc.textEngineMaximum?"max":"sum") + "): " + StringUtil.fdec3.format(wEngine));
318
319
            debugParts.add("Final score: " +  StringUtil.fdec3.format(score));
320
            debugParts.add("Normal: min=" +  StringUtil.fdec3.format(cc.textFreqNormMin) +", weight=" +  StringUtil.fdec3.format(cc.textFreqNormWeight) + " => accumulated=" + StringUtil.fdec3.format(accumulated));
321
            debugParts.add("Short-term: min=" +  StringUtil.fdec3.format(cc.textFreqShortTermMin) +", weight=" +  StringUtil.fdec3.format(cc.textFreqShortTermWeight) + " => accumulated=" + StringUtil.fdec3.format(shortTermAccumulated));
322
            debugParts.add("vl: " + StringUtil.fdec3.format(data.textVL));
323
            debug(player, StringUtil.join(debugParts, " | "));
324
            debugParts.clear();
325
        }
326
327
        lastGlobalMessage = data.chatLastMessage = lcMessage;
328
        lastGlobalTime = data.chatLastTime = time;
329
        return cancel;
330
    }
331
}

How it counteracts this module

NCP's Text check scores every chat message into data.chatFrequency and data.chatShortTermFrequency (frequency buckets over a sliding window) and adds weighted penalties when a message repeats the player's own recent message (textMsgRepeatSelf), matches a globally recent message (textMsgRepeatGlobal), or arrives too soon after joining or with no movement (textMsgAfterJoin, textMsgNoMoving), all within an 8-second timeout. AutoGroomer cycles a fixed pool of 16 identical lines, so repeat-similarity fires as soon as the pool loops within the timeout window, and Spam or DM mode bursts several C01s inside one tick, blowing past the short-term frequency level. The score is multiplied by a time weight and feeds the standard violation/action pipeline, so sustained grooming accumulates VL even at the slow 60-tick cadence.

anticheat Commands (command rate)

Commands.java117 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.chat;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.checks.Check;
20
import fr.neatmonster.nocheatplus.checks.CheckType;
21
import fr.neatmonster.nocheatplus.players.IPlayerData;
22
import fr.neatmonster.nocheatplus.utilities.ColorUtil;
23
import fr.neatmonster.nocheatplus.utilities.TickTask;
24
25
/**
26
 * Check only for commands
27
 * @author asofold
28
 *
29
 */
30
public class Commands extends Check {
31
32
    public Commands() {
33
        super(CheckType.CHAT_COMMANDS);
34
    }
35
    
36
    /**
37
     * Checks a player for command spam
38
     * 
39
     * @param player
40
     * @param message
41
     * @param cc
42
     * @param pData
43
     * @param captcha
44
     * @return true if successful.
45
     */
46
    public boolean check(final Player player, final String message, 
47
                         final ChatConfig cc, final IPlayerData pData, 
48
                         final ICaptcha captcha) {
49
50
        final long now = System.currentTimeMillis();
51
        final int tick = TickTask.getTick();
52
        final ChatData data = pData.getGenericInstance(ChatData.class);
53
        final boolean captchaEnabled = !cc.captchaSkipCommands && pData.isCheckActive(CheckType.CHAT_CAPTCHA, player); 
54
        if (captchaEnabled){
55
            synchronized (data) {
56
                if (captcha.shouldCheckCaptcha(player, cc, data, pData)){
57
                    captcha.checkCaptcha(player, message, cc, data, true);
58
                    return true;
59
                }
60
            }
61
        }
62
63
        // Rest of the check is done without sync, because the data is only used by this check.
64
        // Weight might later be read from some prefix tree (also known / unknown).
65
        final float weight = 1f;
66
        data.commandsWeights.add(now, weight);
67
        if (tick < data.commandsShortTermTick) {
68
            // TickTask got reset.
69
            data.commandsShortTermTick = tick;
70
            data.commandsShortTermWeight = 1.0;
71
        }
72
        else if (tick - data.commandsShortTermTick < cc.commandsShortTermTicks) {
73
            if (!pData.getCurrentWorldData().shouldAdjustToLag(type) 
74
                || TickTask.getLag(50L * (tick - data.commandsShortTermTick), true) < 1.3f) {
75
                // Add up.
76
                data.commandsShortTermWeight += weight;
77
            }
78
            else {
79
                // Reset, too much lag.
80
                data.commandsShortTermTick = tick;
81
                data.commandsShortTermWeight = 1.0;
82
            }
83
        }
84
        else{
85
            // Reset.
86
            data.commandsShortTermTick = tick;
87
            data.commandsShortTermWeight = 1.0;
88
        }
89
90
        final float nw = data.commandsWeights.score(1f);
91
        final double violation = Math.max(nw - cc.commandsLevel, data.commandsShortTermWeight - cc.commandsShortTermLevel);
92
93
        if (violation > 0.0) {
94
            data.commandsVL += violation;
95
            // TODO: Evaluate if sync(data) is necessary or better for executeActions.
96
            if (captchaEnabled) {
97
                synchronized (data) {
98
                    captcha.sendNewCaptcha(player, cc, data);
99
                }
100
                return true;
101
            }
102
            else if (executeActions(player, data.commandsVL, violation, cc.commandsActions).willCancel()) {
103
                return true;
104
            }
105
        }
106
        else if (cc.chatWarningCheck && now - data.chatWarningTime > cc.chatWarningTimeout && (100f * nw / cc.commandsLevel > cc.chatWarningLevel || 100f * data.commandsShortTermWeight / cc.commandsShortTermLevel > cc.chatWarningLevel)){
107
            player.sendMessage(ColorUtil.replaceColors(cc.chatWarningMessage));
108
            data.chatWarningTime = now;
109
        }
110
        else {
111
            // TODO: This might need invalidation with time.
112
            data.commandsVL *= 0.99;
113
        }
114
        return false;
115
    }
116
117
}

How it counteracts this module

Every DM AutoGroomer sends is a command (/msg ...), so it flows through NCP's Commands check, which scores commands per second in data.commandsShortTermWeight and compares against cc.commandsShortTermLevel (violation = max(nw - commandsLevel, shortTermWeight - shortTermLevel)). DM mode iterates all nearby players in a single onPreMotion and queues a /msg for each, so a lobby full of targets produces a burst of commands in the same tick - the exact short-term spike the check is built to catch. Even the public-chat mode is unaffected, but any server running Commands with default levels kills the DM variant within one burst.

anticheat Captcha (auto-armed chat gate)

Captcha.java115 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.chat;
16
17
import java.util.concurrent.ThreadLocalRandom;
18
19
import org.bukkit.entity.Player;
20
21
import fr.neatmonster.nocheatplus.checks.Check;
22
import fr.neatmonster.nocheatplus.checks.CheckType;
23
import fr.neatmonster.nocheatplus.players.DataManager;
24
import fr.neatmonster.nocheatplus.players.IPlayerData;
25
import fr.neatmonster.nocheatplus.utilities.ColorUtil;
26
27
/**
28
 * NOTE: EARLY REFACTORING STATE, MOST METHODS NEED SYNC OVER DATA !
29
 * @author mc_dev
30
 *
31
 */
32
public class Captcha extends Check implements ICaptcha{
33
34
    public Captcha() {
35
        super(CheckType.CHAT_CAPTCHA);
36
    }
37
38
    @Override
39
    public void checkCaptcha(Player player, String message, ChatConfig cc, ChatData data, boolean isMainThread) {
40
        // Correct answer to the captcha?
41
        if (message.equals(data.captchaGenerated)) {
42
            // Yes, clear their data and do not worry anymore about them.
43
            data.reset();
44
            data.captchaStarted = false;
45
            player.sendMessage(ColorUtil.replaceColors(cc.captchaSuccess));
46
        } 
47
        else {
48
            // Increment their tries number counter.
49
            data.captchTries++;
50
            data.captchaVL ++;
51
            // Have they failed too man times?
52
            if (data.captchTries > cc.captchaTries) {
53
                // Find out if we need to kick the player or not.
54
                executeActions(player, data.captchaVL, 1, cc.captchaActions);
55
                // (Resetting captcha tries is done on quit/kick).
56
            }
57
            // Display the question again (if not kicked).
58
            if (player.isOnline()) {
59
                sendCaptcha(player, cc, data);
60
            }
61
        }
62
    }
63
64
    @Override
65
    public void sendNewCaptcha(Player player, ChatConfig cc, ChatData data) {
66
        // Display a captcha to the player.
67
        generateCaptcha(cc, data, true);
68
        sendCaptcha(player, cc, data);
69
        data.captchaStarted = true;
70
    }
71
72
    @Override
73
    public void generateCaptcha(ChatConfig cc, ChatData data, boolean reset) {
74
        if (reset) data.captchTries = 0;
75
        final char[] chars = new char[cc.captchaLength];
76
        for (int i = 0; i < cc.captchaLength; i++) {
77
            chars[i] = cc.captchaCharacters.charAt(ThreadLocalRandom.current().nextInt(cc.captchaCharacters.length()));
78
        }
79
        data.captchaGenerated = new String(chars);
80
    }
81
82
    @Override
83
    public void resetCaptcha(Player player){
84
        final IPlayerData pData = DataManager.getPlayerData(player);
85
        ChatData data = pData.getGenericInstance(ChatData.class);
86
        synchronized (data) {
87
            resetCaptcha(player, pData.getGenericInstance(ChatConfig.class), data, pData);
88
        }
89
    }
90
91
    @Override
92
    public void resetCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {
93
        data.captchTries = 0;
94
        if (shouldCheckCaptcha(player, cc, data, pData) || shouldStartCaptcha(player, cc, data, pData)){
95
            generateCaptcha(cc, data, true);
96
        }
97
    }
98
99
    @Override
100
    public void sendCaptcha(Player player, ChatConfig cc, ChatData data) {
101
        player.sendMessage(ColorUtil.replaceColors(cc.captchaQuestion.replace("[captcha]", data.captchaGenerated)));
102
    }
103
104
    @Override
105
    public boolean shouldStartCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {
106
        // TODO: Only call if IWorldData.isCheckActive(CHAT_CAPTCHA) has returned true?
107
        return !data.captchaStarted && pData.isCheckActive(CheckType.CHAT_CAPTCHA, player);
108
    }
109
110
    @Override
111
    public boolean shouldCheckCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {
112
        // TODO: Only call if IWorldData.isCheckActive(CHAT_CAPTCHA) has returned true?
113
        return data.captchaStarted  && pData.isCheckActive(CheckType.CHAT_CAPTCHA, player);
114
    }
115
}

How it counteracts this module

NCP's Captcha check arms a chat gate on suspicion: the player must answer a server-generated question before chat is allowed again, and a wrong or missing answer repeats the question and raises the violation. AutoGroomer has no captcha logic at all - it answers whatever it was about to send, which is never the captcha answer - so the moment any other check (Text frequency, Commands rate) arms the gate, every subsequent groomed message becomes a captcha failure. The module cannot self-recover because it cannot parse the question prompt it receives on S02PacketChat.

anticheat LetterEngine (obfuscation character analysis)

LetterEngine.java153 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.chat.analysis.engine;
16
17
import java.util.ArrayList;
18
import java.util.HashMap;
19
import java.util.List;
20
import java.util.Map;
21
22
import org.bukkit.entity.Player;
23
24
import fr.neatmonster.nocheatplus.checks.CheckType;
25
import fr.neatmonster.nocheatplus.checks.chat.ChatConfig;
26
import fr.neatmonster.nocheatplus.checks.chat.ChatData;
27
import fr.neatmonster.nocheatplus.checks.chat.analysis.MessageLetterCount;
28
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.processors.FlatWords;
29
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.processors.FlatWords.FlatWordsSettings;
30
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.processors.SimilarWordsBKL;
31
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.processors.SimilarWordsBKL.SimilarWordsBKLSettings;
32
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.processors.WordPrefixes;
33
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.processors.WordPrefixes.WordPrefixesSettings;
34
import fr.neatmonster.nocheatplus.checks.chat.analysis.engine.processors.WordProcessor;
35
import fr.neatmonster.nocheatplus.components.data.IData;
36
import fr.neatmonster.nocheatplus.components.registry.feature.ConsistencyChecker;
37
import fr.neatmonster.nocheatplus.components.registry.feature.IHaveCheckType;
38
import fr.neatmonster.nocheatplus.components.registry.feature.IRemoveData;
39
import fr.neatmonster.nocheatplus.config.ConfPaths;
40
import fr.neatmonster.nocheatplus.config.ConfigFile;
41
import fr.neatmonster.nocheatplus.logging.StaticLog;
42
43
44
/**
45
 * Process words.
46
 * @author asofold
47
 *
48
 */
49
public class LetterEngine implements IRemoveData, IHaveCheckType, ConsistencyChecker{
50
51
    /** Global processors */
52
    protected final List<WordProcessor> processors = new ArrayList<WordProcessor>();
53
54
    /**
55
     * Mapping players to data.
56
     */
57
    protected final EnginePlayerDataMap dataMap;
58
59
    public LetterEngine(ConfigFile config){
60
        // Add word processors.
61
        // NOTE: These settings should be compared to the per player settings done in the EnginePlayerConfig constructor.
62
        if (config.getBoolean(ConfPaths.CHAT_TEXT_GL_WORDS_CHECK, false)) {
63
            FlatWordsSettings settings = new FlatWordsSettings();
64
            settings.maxSize = 1000;
65
            settings.applyConfig(config, ConfPaths.CHAT_TEXT_GL_WORDS);
66
            processors.add(new FlatWords("glWords",settings));
67
        }
68
        if (config.getBoolean(ConfPaths.CHAT_TEXT_GL_PREFIXES_CHECK , false)) {
69
            WordPrefixesSettings settings = new WordPrefixesSettings();
70
            settings.maxAdd = 2000;
71
            settings.applyConfig(config, ConfPaths.CHAT_TEXT_GL_PREFIXES);
72
            processors.add(new WordPrefixes("glPrefixes", settings));
73
        }
74
        if (config.getBoolean(ConfPaths.CHAT_TEXT_GL_SIMILARITY_CHECK , false)) {
75
            SimilarWordsBKLSettings settings = new SimilarWordsBKLSettings();
76
            settings.maxSize = 1000;
77
            settings.applyConfig(config, ConfPaths.CHAT_TEXT_GL_SIMILARITY);
78
            processors.add(new SimilarWordsBKL("glSimilarity", settings));
79
        }
80
        // TODO: At least expiration duration configurable? (Entries expire after 10 minutes.)
81
        dataMap = new EnginePlayerDataMap(600000L, 100, 0.75f);
82
    }
83
84
    public Map<String, Float> process(final MessageLetterCount letterCount, final String playerName, final ChatConfig cc, final ChatData data) {
85
        final Map<String, Float> result = new HashMap<String, Float>();
86
        // Global processors.
87
        if (cc.textGlobalCheck) {
88
            for (final WordProcessor processor : processors) {
89
                try {
90
                    result.put(processor.getProcessorName(), processor.process(letterCount) * cc.textGlobalWeight);
91
                }
92
                catch( final Exception e) {
93
                    StaticLog.logSevere("chat.text: processor("+processor.getProcessorName()+") generated an exception: " + e.getClass().getSimpleName() + ": " + e.getMessage());
94
                    StaticLog.logSevere(e);
95
                    continue;
96
                }
97
            }
98
        }
99
100
        // Per player processors.
101
        if (cc.textPlayerCheck) {
102
            final EnginePlayerData engineData = dataMap.get(playerName, cc); 
103
            for (final WordProcessor processor : engineData.processors){
104
                try {
105
                    result.put(processor.getProcessorName(), processor.process(letterCount) * cc.textPlayerWeight);
106
                }
107
                catch( final Exception e) {
108
                    StaticLog.logSevere("chat.text: processor("+processor.getProcessorName()+") generated an exception: " + e.getClass().getSimpleName() + ": " + e.getMessage());
109
                    StaticLog.logSevere(e);
110
                    continue;
111
                }
112
            }
113
        }
114
115
        return result;
116
    }
117
118
    public void clear() {
119
        for (WordProcessor processor : processors) {
120
            processor.clear();
121
        }
122
        processors.clear();
123
        dataMap.clear();
124
    }
125
126
    @Override
127
    public IData removeData(final String playerName) {
128
        return dataMap.remove(playerName);
129
    }
130
131
    @Override
132
    public void removeAllData() {
133
        dataMap.clear();
134
    }
135
136
    @Override
137
    public final CheckType getCheckType() {
138
        return CheckType.CHAT_TEXT;
139
    }
140
141
    @Override
142
    public void checkConsistency(final Player[] onlinePlayers) {
143
        // Use consistency checking to release some memory.
144
        final long now = System.currentTimeMillis();
145
        if (now < dataMap.lastExpired) {
146
            dataMap.clear();
147
            return;
148
        }
149
        if (now - dataMap.lastExpired > dataMap.durExpire) {
150
            dataMap.expire(now - dataMap.durExpire);
151
        }
152
    }
153
}

How it counteracts this module

LetterEngine is the consistency engine behind NCP's chat analysis: it maintains a per-player character frequency model and evaluates each incoming message's letter distribution for anomalies, configured with threshold weights for letter and character usage. AutoGroomer's Chat Bypass interleaves a fixed five-symbol set ('⛍⛌⛗⛟') after every letter, which doubles message length and produces a perfectly regular letter-symbol-letter-symbol alternation - a character distribution no human typing produces. Because the same pool of lines cycles repeatedly, the per-player frequency model sees the same anomalous composition again and again, pushing the consistency score steadily up and making the bypass worse than useless on NCP servers running the engine.

← Back to Analysis Hub