Начинающий
- Статус
- Оффлайн
- Регистрация
- 18 Апр 2025
- Сообщения
- 107
- Реакции
- 1
- Выберите загрузчик игры
- Vanilla
| InvseeExploit | Bypass | ReallyWorld | Other |
InvseeExploit:
package tech.modules.combat;
import tech.events.AttackEvent;
import tech.main.modules.api.Category;
import tech.main.modules.api.Module;
import tech.main.modules.api.Register;
import tech.main.modules.settings.ModeSetting;
import tech.utils.client.main.IMinecraft;
import com.google.common.eventbus.Subscribe;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.inventory.ChestScreen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@Register(name = "InvseeExecutor", description = "Передает ник и инвентарь между клиентами", brand = Category.Combat)
public class InvseeExecutor extends Module implements IMinecraft {
private final ModeSetting clientMode = new ModeSetting("Режим клиента", "Отправитель", "Отправитель", "Приниматель");
private String lastVictim = null;
private List<ItemStack> receivedInventory = new ArrayList<>();
private String receivedVictimName = "";
private ServerSocket serverSocket;
private Thread serverThread;
private ScheduledExecutorService scheduler;
private static final int FIRST_CLIENT_PORT = 12446;
private static final int SECOND_CLIENT_PORT = 12445;
private static final int MAX_RETRIES = 10;
private static final long RETRY_DELAY_MS = 2000;
private static final long INVENTORY_REFRESH_MS = 500;
private boolean serverRunning = false;
private boolean connectionEstablished = false;
private Thread senderConnectionThread;
public InvseeExecutor() {
addSettings(clientMode);
}
[USER=1474073]@Subscribe[/USER]
public void onAttack(AttackEvent event) {
if (!clientMode.is("Отправитель")) return;
Entity target = event.entity;
if (target instanceof PlayerEntity && !AntiBot.isBot(target)) {
String victimName = target.getName().getString();
lastVictim = victimName;
sendNickToSecondClient(victimName);
}
}
private void executeInvsee(String victimName) {
Minecraft.getInstance().player.sendChatMessage("/invsee " + victimName);
}
private List<ItemStack> captureInventoryItems() {
List<ItemStack> items = new ArrayList<>();
Minecraft mc = Minecraft.getInstance();
if (mc.currentScreen instanceof ChestScreen) {
ChestScreen chestScreen = (ChestScreen) mc.currentScreen;
NonNullList<ItemStack> slots = chestScreen.getContainer().getInventory();
for (int i = 0; i < 36; i++) {
if (i < slots.size()) {
ItemStack stack = slots.get(i);
items.add(stack != null ? stack : ItemStack.EMPTY);
} else {
items.add(ItemStack.EMPTY);
}
}
}
return items;
}
private void sendNickToSecondClient(String victimName) {
new Thread(() -> {
int retries = 0;
while (retries < MAX_RETRIES && !Thread.currentThread().isInterrupted()) {
try (Socket socket = new Socket("localhost", SECOND_CLIENT_PORT);
PrintWriter out = new PrintWriter(socket.getOutputStream(), true)) {
out.println(victimName);
connectionEstablished = true;
return;
} catch (IOException e) {
retries++;
try {
Thread.sleep(RETRY_DELAY_MS);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
return;
}
}
}
}).start();
}
private void sendInventoryToFirstClient(List<ItemStack> inventory, String victimName) {
new Thread(() -> {
int retries = 0;
while (retries < MAX_RETRIES && !Thread.currentThread().isInterrupted()) {
try (Socket socket = new Socket("localhost", FIRST_CLIENT_PORT);
DataOutputStream out = new DataOutputStream(socket.getOutputStream())) {
out.writeUTF("INVSEE_DATA:" + victimName);
out.writeInt(inventory.size());
for (ItemStack stack : inventory) {
if (stack.isEmpty()) {
out.writeUTF("EMPTY");
} else {
ResourceLocation itemId = Registry.ITEM.getKey(stack.getItem());
int count = stack.getCount();
String nbt = stack.getTag() != null ? stack.getTag().toString() : "null";
out.writeUTF(itemId.toString());
out.writeInt(count);
out.writeUTF(nbt);
}
}
out.writeUTF("INVSEE_END");
connectionEstablished = true;
return;
} catch (IOException e) {
retries++;
try {
Thread.sleep(RETRY_DELAY_MS);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
return;
}
}
}
}).start();
}
public void startServer() {
if (serverRunning) return;
if (clientMode.is("Отправитель")) {
serverThread = new Thread(() -> {
try {
serverSocket = new ServerSocket(FIRST_CLIENT_PORT);
serverRunning = true;
while (!Thread.interrupted()) {
try (Socket socket = serverSocket.accept();
DataInputStream in = new DataInputStream(socket.getInputStream())) {
String header = in.readUTF();
if (header == null) continue;
if (header.startsWith("INVSEE_DATA:")) {
String victimName = header.substring(12);
List<ItemStack> inventory = new ArrayList<>();
int size = in.readInt();
for (int i = 0; i < size; i++) {
String itemData = in.readUTF();
if (itemData.equals("EMPTY")) {
inventory.add(ItemStack.EMPTY);
} else {
int count = in.readInt();
String nbt = in.readUTF();
ResourceLocation itemId = new ResourceLocation(itemData);
Item item = Registry.ITEM.getOrDefault(itemId);
ItemStack stack = new ItemStack(item, count);
if (!nbt.equals("null")) {
stack.setTag(JsonToNBT.getTagFromJson(nbt));
}
inventory.add(stack);
}
}
String endMarker = in.readUTF();
synchronized (this) {
receivedVictimName = victimName;
receivedInventory = inventory;
}
connectionEstablished = true;
}
} catch (CommandSyntaxException e) {
throw new RuntimeException(e);
}
}
} catch (IOException e) {
}
});
serverThread.start();
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(() -> {
if (lastVictim != null) {
sendNickToSecondClient(lastVictim);
}
}, 0, INVENTORY_REFRESH_MS, TimeUnit.MILLISECONDS);
} else if (clientMode.is("Приниматель")) {
serverThread = new Thread(() -> {
try {
serverSocket = new ServerSocket(SECOND_CLIENT_PORT);
serverRunning = true;
while (!Thread.interrupted()) {
try (Socket socket = serverSocket.accept();
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {
String victimName = in.readLine();
if (victimName != null && !victimName.isEmpty()) {
if (lastVictim == null || !lastVictim.equals(victimName)) {
lastVictim = victimName;
executeInvsee(victimName);
}
connectionEstablished = true;
}
}
}
} catch (IOException e) {
}
});
serverThread.start();
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(() -> {
if (lastVictim != null) {
List<ItemStack> inventory = captureInventoryItems();
sendInventoryToFirstClient(inventory, lastVictim);
}
}, INVENTORY_REFRESH_MS, INVENTORY_REFRESH_MS, TimeUnit.MILLISECONDS);
}
}
private void startSenderConnection() {
if (clientMode.is("Отправитель")) {
senderConnectionThread = new Thread(() -> {
while (!Thread.interrupted() && !connectionEstablished) {
try (Socket socket = new Socket("localhost", SECOND_CLIENT_PORT);
PrintWriter out = new PrintWriter(socket.getOutputStream(), true)) {
out.println("PING");
connectionEstablished = true;
} catch (IOException e) {
try {
Thread.sleep(RETRY_DELAY_MS);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
}
}
});
senderConnectionThread.start();
}
}
public InventoryData getReceivedData() {
synchronized (this) {
return new InventoryData(receivedInventory, receivedVictimName);
}
}
public boolean isFirstClient() {
return clientMode.is("Отправитель");
}
public String getLastVictim() {
return lastVictim != null ? lastVictim : "";
}
[USER=1367676]@override[/USER]
public void onEnable() {
super.onEnable();
lastVictim = null;
receivedInventory = new ArrayList<>();
receivedVictimName = "";
serverRunning = false;
connectionEstablished = false;
if (serverThread != null && serverThread.isAlive()) {
serverThread.interrupt();
}
if (senderConnectionThread != null && senderConnectionThread.isAlive()) {
senderConnectionThread.interrupt();
}
if (scheduler != null) {
scheduler.shutdownNow();
}
if (serverSocket != null) {
try {
serverSocket.close();
} catch (IOException ignored) {}
serverSocket = null;
}
startServer();
startSenderConnection();
}
[USER=1367676]@override[/USER]
public void onDisable() {
super.onDisable();
lastVictim = null;
receivedInventory = new ArrayList<>();
receivedVictimName = "";
serverRunning = false;
connectionEstablished = false;
if (serverThread != null) {
serverThread.interrupt();
serverThread = null;
}
if (senderConnectionThread != null) {
senderConnectionThread.interrupt();
senderConnectionThread = null;
}
if (scheduler != null) {
scheduler.shutdownNow();
scheduler = null;
}
if (serverSocket != null) {
try {
serverSocket.close();
} catch (IOException ignored) {}
serverSocket = null;
}
}
public static class InventoryData {
private final List<ItemStack> inventory;
private final String victimName;
public InventoryData(List<ItemStack> inventory, String victimName) {
this.inventory = inventory;
this.victimName = victimName;
}
public List<ItemStack> getInventory() {
return inventory;
}
public String getVictimName() {
return victimName;
}
}
}