ServerSpoof module

ServerSpoof: Minecraft 26.3 cheat module, full source for every implementation (1 client: OfflineClient).

1 implementationMISC

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

OfflineClientMISCsrc/main/java/com/jellypudding/offlineclient/modules/misc/ServerSpoof.javaJava · 117 lines · 4.9 KB

Reports a plain client to the server.

SettingsBrandBlock channelsBlock resource packs
ServerSpoof.javaJava · Minecraft 26.2 · 117 lines · 4.9 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.misc;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.PacketReceiveEvent;
5
import com.jellypudding.offlineclient.event.events.PacketSendEvent;
6
import com.jellypudding.offlineclient.module.Category;
7
import com.jellypudding.offlineclient.module.Module;
8
import com.jellypudding.offlineclient.setting.BoolSetting;
9
import com.jellypudding.offlineclient.setting.TextSetting;
10
import com.jellypudding.offlineclient.util.ChatUtil;
11
import com.jellypudding.offlineclient.util.PacketUtil;
12
import com.jellypudding.offlineclient.util.TextLines;
13
import net.minecraft.ChatFormatting;
14
import net.minecraft.network.chat.ClickEvent;
15
import net.minecraft.network.chat.Component;
16
import net.minecraft.network.chat.MutableComponent;
17
import net.minecraft.network.protocol.common.ClientboundResourcePackPushPacket;
18
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
19
import net.minecraft.network.protocol.common.ServerboundResourcePackPacket;
20
import net.minecraft.network.protocol.common.custom.BrandPayload;
21
import net.minecraft.resources.Identifier;
22
23
import java.net.URI;
24
import java.util.Locale;
25
26
public final class ServerSpoof extends Module {
27
28
    private final TextSetting brand = new TextSetting("Brand",
29
        "Client name the server is told. Leave it empty to send the real one.", "vanilla");
30
    private final BoolSetting blockChannels = new BoolSetting("Block channels",
31
        "Drop the loader plugin messages that give the mod list away.", true);
32
    private final TextLines channels = new TextLines("Channels",
33
        "How many channel names to drop.", "fabric", "minecraft:register", "minecraft:unregister",
34
        "minecraft:version").plain().under(blockChannels);
35
    private final BoolSetting resourcePack = new BoolSetting("Block resource packs",
36
        "Tells the server a required pack loaded without ever downloading it.", false);
37
38
    public ServerSpoof() {
39
        super("ServerSpoof", "Reports a plain client to the server.", Category.MISC);
40
        addSettings(brand, blockChannels);
41
        addSettings(channels.settings());
42
        addSettings(resourcePack);
43
        searchTags("server spoof", "brand", "vanilla spoof", "anti fabric", "resource pack");
44
    }
45
46
    // Joining a server tells it you are on a loader unless this is already running.
47
    @Override
48
    public boolean enabledByDefault() {
49
        return true;
50
    }
51
52
    @Override
53
    public String getSuffix() {
54
        return brand.isBlank() ? null : brand.getValue();
55
    }
56
57
    // The brand goes out during the configuration phase before a world exists.
58
    // Fired on the netty thread.
59
    @Subscribe
60
    private void onPacketSend(PacketSendEvent event) {
61
        if (!(event.getPacket() instanceof ServerboundCustomPayloadPacket packet)) {
62
            return;
63
        }
64
        Identifier id = packet.payload().type().id();
65
66
        if (id.equals(BrandPayload.TYPE.id())) {
67
            if (!brand.isBlank()) {
68
                event.setPacket(new ServerboundCustomPayloadPacket(
69
                    new BrandPayload(brand.getValue())));
70
            }
71
            return;
72
        }
73
        if (blockChannels.isOn() && isFingerprint(id)) {
74
            event.cancel();
75
        }
76
    }
77
78
    // The push is swallowed and answered as though the pack had loaded.
79
    @Subscribe
80
    private void onPacketReceive(PacketReceiveEvent event) {
81
        if (!resourcePack.isOn()
82
            || !(event.getPacket() instanceof ClientboundResourcePackPushPacket packet)) {
83
            return;
84
        }
85
        event.cancel();
86
        answer(packet, ServerboundResourcePackPacket.Action.ACCEPTED);
87
        answer(packet, ServerboundResourcePackPacket.Action.DOWNLOADED);
88
        answer(packet, ServerboundResourcePackPacket.Action.SUCCESSFULLY_LOADED);
89
        announce(packet);
90
    }
91
92
    private static void answer(ClientboundResourcePackPushPacket packet,
93
                               ServerboundResourcePackPacket.Action action) {
94
        PacketUtil.send(new ServerboundResourcePackPacket(packet.id(), action));
95
    }
96
97
    private static void announce(ClientboundResourcePackPushPacket packet) {
98
        MutableComponent line = Component.literal("§7Blocked a "
99
            + (packet.required() ? "required" : "optional") + " resource pack. ");
100
        MutableComponent link = Component.literal("[Open URL]")
101
            .withStyle(style -> style.applyFormat(ChatFormatting.AQUA)
102
                .withClickEvent(new ClickEvent.OpenUrl(URI.create(packet.url()))));
103
        ChatUtil.component(line.append(link));
104
    }
105
106
    // Names are matched anywhere in the channel with case ignored.
107
    private boolean isFingerprint(Identifier id) {
108
        String full = id.toString().toLowerCase(Locale.ROOT);
109
        for (String name : channels.all()) {
110
            if (full.contains(name.trim().toLowerCase(Locale.ROOT))) {
111
                return true;
112
            }
113
        }
114
        return false;
115
    }
116
}
117