server-spoof module

server-spoof: Minecraft 26.3 cheat module, full source for every implementation (1 client: Meteor Client).

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.

Meteor ClientMiscsrc/main/java/meteordevelopment/meteorclient/systems/modules/misc/ServerSpoof.javaJava · 170 lines · 6.7 KB

Spoof client brand, resource pack and channels.

Settingsspoof-brandbrandresource-packblock-channelschannels
ServerSpoof.javaJava · Minecraft 26.2 · 170 lines · 6.7 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.misc;
7
8
import meteordevelopment.meteorclient.events.packets.PacketEvent;
9
import meteordevelopment.meteorclient.events.world.TickEvent;
10
import meteordevelopment.meteorclient.settings.*;
11
import meteordevelopment.meteorclient.systems.modules.Categories;
12
import meteordevelopment.meteorclient.systems.modules.Module;
13
import meteordevelopment.meteorclient.utils.Utils;
14
import meteordevelopment.meteorclient.utils.misc.text.RunnableClickEvent;
15
import meteordevelopment.orbit.EventHandler;
16
import net.minecraft.ChatFormatting;
17
import net.minecraft.network.chat.ClickEvent;
18
import net.minecraft.network.chat.Component;
19
import net.minecraft.network.chat.HoverEvent;
20
import net.minecraft.network.chat.MutableComponent;
21
import net.minecraft.network.protocol.common.ClientboundResourcePackPushPacket;
22
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
23
import net.minecraft.network.protocol.common.ServerboundResourcePackPacket;
24
import net.minecraft.network.protocol.common.custom.BrandPayload;
25
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
26
import net.minecraft.resources.Identifier;
27
import org.apache.commons.lang3.Strings;
28
29
import java.net.MalformedURLException;
30
import java.net.URI;
31
import java.net.URISyntaxException;
32
import java.net.URL;
33
import java.util.List;
34
35
public class ServerSpoof extends Module {
36
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
37
38
    private final Setting<Boolean> spoofBrand = sgGeneral.add(new BoolSetting.Builder()
39
        .name("spoof-brand")
40
        .description("Whether or not to spoof the brand.")
41
        .defaultValue(true)
42
        .build()
43
    );
44
45
    private final Setting<String> brand = sgGeneral.add(new StringSetting.Builder()
46
        .name("brand")
47
        .description("Specify the brand that will be send to the server.")
48
        .defaultValue("vanilla")
49
        .visible(spoofBrand::get)
50
        .build()
51
    );
52
53
    private final Setting<Boolean> resourcePack = sgGeneral.add(new BoolSetting.Builder()
54
        .name("resource-pack")
55
        .description("Spoof accepting server resource pack.")
56
        .defaultValue(false)
57
        .build()
58
    );
59
60
    private final Setting<Boolean> blockChannels = sgGeneral.add(new BoolSetting.Builder()
61
        .name("block-channels")
62
        .description("Whether or not to block some channels.")
63
        .defaultValue(true)
64
        .build()
65
    );
66
67
    private final Setting<List<String>> channels = sgGeneral.add(new StringListSetting.Builder()
68
        .name("channels")
69
        .description("If the channel contains the keyword, this outgoing channel will be blocked.")
70
        .defaultValue("fabric", "minecraft:register")
71
        .visible(blockChannels::get)
72
        .build()
73
    );
74
75
    private MutableComponent msg;
76
    public boolean silentAcceptResourcePack = false;
77
78
    public ServerSpoof() {
79
        super(Categories.Misc, "server-spoof", "Spoof client brand, resource pack and channels.");
80
81
        runInMainMenu = true;
82
    }
83
84
    @EventHandler
85
    private void onPacketSend(PacketEvent.Send event) {
86
        if (!isActive()) return;
87
88
        if (event.packet instanceof ServerboundCustomPayloadPacket(CustomPacketPayload payload)) {
89
            Identifier id = payload.type().id();
90
91
            if (blockChannels.get()) {
92
                for (String channel : channels.get()) {
93
                    if (Strings.CI.contains(id.toString(), channel)) {
94
                        event.cancel();
95
                        return;
96
                    }
97
                }
98
            }
99
100
            if (spoofBrand.get() && id.equals(BrandPayload.TYPE.id())) {
101
                ServerboundCustomPayloadPacket spoofedPacket = new ServerboundCustomPayloadPacket(new BrandPayload(brand.get()));
102
103
                event.sendSilently(spoofedPacket);
104
                event.cancel();
105
            }
106
        }
107
108
        // we want to accept the pack silently to prevent the server detecting you bypassed it when logging in
109
        if (silentAcceptResourcePack && event.packet instanceof ServerboundResourcePackPacket) event.cancel();
110
    }
111
112
    @EventHandler
113
    private void onPacketReceive(PacketEvent.Receive event) {
114
        if (!isActive() || !resourcePack.get()) return;
115
        if (!(event.packet instanceof ClientboundResourcePackPushPacket packet)) return;
116
117
        event.cancel();
118
        event.connection.send(new ServerboundResourcePackPacket(packet.id(), ServerboundResourcePackPacket.Action.ACCEPTED));
119
        event.connection.send(new ServerboundResourcePackPacket(packet.id(), ServerboundResourcePackPacket.Action.DOWNLOADED));
120
        event.connection.send(new ServerboundResourcePackPacket(packet.id(), ServerboundResourcePackPacket.Action.SUCCESSFULLY_LOADED));
121
122
        msg = Component.literal("This server has ");
123
        msg.append(packet.required() ? "a required " : "an optional ").append("resource pack. ");
124
125
        MutableComponent link = Component.literal("[Open URL]");
126
        link.setStyle(link.getStyle()
127
            .withColor(ChatFormatting.BLUE)
128
            .withUnderlined(true)
129
            .withClickEvent(new ClickEvent.OpenUrl(URI.create(packet.url())))
130
            .withHoverEvent(new HoverEvent.ShowText(Component.literal("Click to open the pack url")))
131
        );
132
133
        MutableComponent acceptance = Component.literal("[Accept Pack]");
134
        acceptance.setStyle(acceptance.getStyle()
135
            .withColor(ChatFormatting.DARK_GREEN)
136
            .withUnderlined(true)
137
            .withClickEvent(new RunnableClickEvent(() -> {
138
                URL url = getParsedResourcePackUrl(packet.url());
139
                if (url == null) error("Invalid resource pack URL: " + packet.url());
140
                else {
141
                    silentAcceptResourcePack = true;
142
                    mc.getDownloadedPackSource().pushPack(packet.id(), url, packet.hash());
143
                }
144
            }))
145
            .withHoverEvent(new HoverEvent.ShowText(Component.literal("Click to accept and apply the pack.")))
146
        );
147
148
        msg.append(link).append(" ");
149
        msg.append(acceptance).append(".");
150
    }
151
152
    @EventHandler
153
    private void onTick(TickEvent.Pre event) {
154
        if (!isActive() || !Utils.canUpdate() || msg == null) return;
155
156
        info(msg);
157
        msg = null;
158
    }
159
160
    private static URL getParsedResourcePackUrl(String url) {
161
        try {
162
            URL uRL = new URI(url).toURL();
163
            String string = uRL.getProtocol();
164
            return !"http".equals(string) && !"https".equals(string) ? null : uRL;
165
        } catch (MalformedURLException | URISyntaxException _) {
166
            return null;
167
        }
168
    }
169
}
170