Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Badlion Spoof #884

Open
wants to merge 2 commits into
base: 2.15-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/main/java/keystrokesmod/event/ClientBrandEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package keystrokesmod.event;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.minecraftforge.fml.common.eventhandler.Event;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
public class ClientBrandEvent extends Event {
private String brand;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package keystrokesmod.mixins.impl.network;

import keystrokesmod.event.ClientBrandEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(FMLCommonHandler.class)
public abstract class MixinFMLCommonHandler {

@Inject(method = "getModName", at = @At("RETURN"), remap = false, cancellable = true)
private void getModName(@NotNull CallbackInfoReturnable<String> cir) {
ClientBrandEvent event = new ClientBrandEvent(cir.getReturnValue());
MinecraftForge.EVENT_BUS.post(event);
cir.setReturnValue(event.getBrand());
}
}
106 changes: 56 additions & 50 deletions src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java
Original file line number Diff line number Diff line change
@@ -1,75 +1,81 @@
package keystrokesmod.module.impl.exploit;

import keystrokesmod.event.ClientBrandEvent;
import keystrokesmod.event.SendPacketEvent;
import keystrokesmod.module.Module;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.ModeSetting;
import keystrokesmod.module.setting.impl.LiteralSubMode;
import keystrokesmod.module.setting.impl.ModeValue;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;


public class ClientSpoofer extends Module {
private static SpoofMode currentSpoof = SpoofMode.FORGE;
public final ButtonSetting cancelForgePacket = new ButtonSetting("Cancel Forge packet", false);
private final ModeSetting mode = new ModeSetting("Mode", SpoofMode.getNames(), 0);
public static String customBrand = null;

private final ModeValue mode;
private final ButtonSetting noForge;
private final ButtonSetting cancelForgePacket;

public ClientSpoofer() {
super("ClientSpoofer", category.exploit);
this.registerSetting(mode, cancelForgePacket);
}

public static BrandInfo getBrandName() {
return new BrandInfo(currentSpoof.brand);
}

public void onDisable() {
currentSpoof = SpoofMode.FORGE;
}

@Override
public void onUpdate() {
currentSpoof = SpoofMode.values()[(int) mode.getInput()];
this.registerSetting(mode = new ModeValue("Mode", this)
.add(new LiteralSubMode("Vanilla", this))
.add(new LiteralSubMode("Forge", this))
.add(new LiteralSubMode("Lunar", this))
.add(new LiteralSubMode("Badlion", this))
.add(new LiteralSubMode("Cancel", this))
.add(new LiteralSubMode("null", this))
.add(new LiteralSubMode("Custom", this))

);
this.registerSetting(noForge = new ButtonSetting("No forge", false));
this.registerSetting(cancelForgePacket = new ButtonSetting("Cancel FMLProxyPacket", false));
}

@SubscribeEvent
public void onSendPacket(@NotNull SendPacketEvent event) {
if (event.getPacket() instanceof FMLProxyPacket && cancelForgePacket.isToggled()) {
if (event.getPacket() instanceof FMLProxyPacket
&& cancelForgePacket.isToggled()) {
event.setCanceled(true);
}
}


enum SpoofMode {
FORGE("Forge", "FML,Forge"),
VANILLA("Vanilla", "vanilla"),
LUNAR("Lunar", "lunarclient:v2.16.0-2426"),
CHEATBREAKER("Cheatbreaker", "CB"),
GEYSER("Geyser", "Geyser"),
LABYMOD("LabyMod", "LMC"),
;

private static final String[] MODES = Arrays.stream(values()).map(spoofMode -> spoofMode.name).toArray(String[]::new);
public final String name;
public final String brand;

SpoofMode(String name, String brand) {
this.name = name;
this.brand = brand;
}

public static String @NotNull [] getNames() {
return MODES;
if (event.getPacket() instanceof C17PacketCustomPayload
&& mode.getSelected().getPrettyName().equals("Cancel")) {
event.setCanceled(true);
}
}

public static class BrandInfo {
public final String brand;

public BrandInfo(String brand) {
this.brand = brand;
@SubscribeEvent
public void onClientBrand(@NotNull ClientBrandEvent event) {
String brand = event.getBrand();

switch (mode.getSelected().getPrettyName()) {
case "Vanilla":
brand = "vanilla";
break;
case "Forge":
if (noForge.isToggled()) {
brand = "fml";
} else {
brand = "fml,forge";
}
break;
case "Lunar":
brand = "lunarclient:v2.18.3-2451";
break;
case "Badlion":
brand = "badlion";
break;
case "null":
brand = null;
break;
case "Custom":
brand = customBrand;
break;
}

event.setBrand(brand);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.Objects;

public class Watermark extends Module {
public static final String VERSION = "2.14";
public static final String VERSION = "2.14.1";
public static final Map<String, ResourceLocation> WATERMARK = new Object2ObjectOpenHashMap<>();

public static String customName = "CustomClient";
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/keystrokesmod/utility/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import keystrokesmod.module.Module;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.client.Settings;
import keystrokesmod.module.impl.exploit.ClientSpoofer;
import keystrokesmod.module.impl.fun.NoteBot;
import keystrokesmod.module.impl.minigames.DuelsStats;
import keystrokesmod.module.impl.other.ChatAI;
Expand Down Expand Up @@ -275,6 +276,14 @@ public static void rCMD(@NotNull String c) {

KillMessage.killMessage = c.substring(12);
print("&aSet killmessage to " + KillMessage.killMessage, 1);
} else if (firstArg.equals("clientspoofer")) {
if (!hasArgs) {
print(invSyn, 1);
return;
}

ClientSpoofer.customBrand = c.substring(14);
print("&aSet clientspoofer custom brand to " + ClientSpoofer.customBrand, 1);
} else if (firstArg.equals("binds")) {
for (Module module : Raven.getModuleManager().getModules()) {
if (module.getKeycode() != 0) {
Expand Down Expand Up @@ -541,6 +550,7 @@ public static void rCMD(@NotNull String c) {
print("1 cname [name]", 0);
print("2 " + FakeChat.command + " [msg]", 0);
print("4 killmessage [message]", 0);
print("4 clientspoofer [brand]", 0);
print(String.format("5 clientname [name (current is '%s')]", Watermark.customName), 0);
print("6 chat <args>", 0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mixins.raven.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"gui.MixinGuiMultiplayer",
"gui.MixinGuiScreen",
"gui.MixinGuiSlot",
"network.MixinClientSpoofer",
"network.MixinFMLCommonHandler",
"network.MixinNetHandlerPlayClient",
"render.ItemRendererAccessor",
"render.MixinBlockRendererDispatcher",
Expand Down