This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
forked from Strangerrrs/Raven-bS
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
97 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
17 changes: 0 additions & 17 deletions
17
src/main/java/keystrokesmod/mixins/impl/network/MixinClientSpoofer.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
src/main/java/keystrokesmod/mixins/impl/network/MixinFMLCommonHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
101 changes: 51 additions & 50 deletions
101
src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,76 @@ | ||
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("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 "null": | ||
brand = null; | ||
break; | ||
case "Custom": | ||
brand = customBrand; | ||
break; | ||
} | ||
|
||
event.setBrand(brand); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters