Исходник UnHook Update (Expensive 2.0)

Начинающий
Статус
Оффлайн
Регистрация
26 Авг 2022
Сообщения
81
Реакции[?]
1
Поинты[?]
1K
Решил обновить анхук хоть и не много. Добавил сюда chatClean, logclean, cleanexplorer, cleantab, logsclean.
Пожалуйста, авторизуйтесь для просмотра ссылки.



Rarchik:
package dev.rarchik.dlc.impl.util;

import dev.rarchik.dlc.Category;
import dev.rarchik.dlc.Component;
import dev.rarchik.dlc.ComponentInfo;
import dev.rarchik.dlc.settings.impl.BindSetting;
import dev.rarchik.dlc.settings.impl.BooleanOption;
import dev.rarchik.events.Event;
import dev.rarchik.manager.Manager;
import dev.rarchik.ui.UnHookScreen;
import dev.rarchik.utils.ClientUtil;
import dev.rarchik.utils.misc.TimerUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.StringTextComponent;
import net.optifine.shaders.Shaders;
import org.lwjgl.glfw.GLFW;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.DosFileAttributeView;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

@ComponentInfo(name = "UnHook", type = Category.Util)
public class UnHook extends Component {

    public static final List<Component> FUNCTIONS_TO_BACK = new CopyOnWriteArrayList<>();
    public BindSetting unHookKey = new BindSetting("Кнопка возрата", GLFW.GLFW_KEY_HOME);
    public BooleanOption logclean = new BooleanOption("SystemLogClean", true);
    public BooleanOption cleanexplorer = new BooleanOption("Очистить быстрый доступ", true).setVisible(() -> logclean.get());
    public BooleanOption cleantab = new BooleanOption("Очистить Win + Tab", true).setVisible(() -> logclean.get());
    public BooleanOption chatClean = new BooleanOption("Очистить чат", true);

    public BooleanOption logsclean = new BooleanOption("Очистить логи txt",true);

    public TimerUtil timerUtil = new TimerUtil();

    public UnHook() {
        addSettings(unHookKey, chatClean, logclean, cleanexplorer, cleantab, logsclean );
    }

    @Override
    protected void onEnable() {
        timerUtil.reset();
        Minecraft.getInstance().displayGuiScreen(new UnHookScreen(new StringTextComponent("UnHook Screen")));
        super.onEnable();
    }

    public void onUnHook() {
        ClientUtil.stopRPC();
        FUNCTIONS_TO_BACK.clear();
        for (int i = 0; i < Manager.FEATURE_MANAGER.getFunctions().size(); i++) {
            Component component = Manager.FEATURE_MANAGER.getFunctions().get(i);
            if (component.state && component != this) {
                FUNCTIONS_TO_BACK.add(component);
                component.setState(false);
            }
        }
        File folder = new File("C:\\Tense");
        if (folder.exists()) {
            try {
                Path folderPathObj = folder.toPath();
                DosFileAttributeView attributes = Files.getFileAttributeView(folderPathObj, DosFileAttributeView.class);
                attributes.setHidden(true);
            } catch (IOException e) {
                System.out.println("Ошибка при скрытии папки: " + e.getMessage());
            }
        }
        mc.fileResourcepacks = new File(System.getenv("appdata") + "\\.minecraft" + "\\resourcepacks");
        Shaders.shaderPacksDir = new File(System.getenv("appdata") + "\\.minecraft" + "\\shaderpacks");
        toggle();
        if (this.chatClean.get()) {
            Minecraft.getInstance().ingameGUI.getChatGUI().clearChatMessages(true);
        }
        if (this.logclean.get()) {
            try {
                Path recentPath = Path.of(System.getProperty("user.home"), "AppData", "Roaming", "Microsoft", "Windows", "Recent");

                Files.list(recentPath)
                        .forEach(file -> {
                            try {
                                Files.delete(file);
                            } catch (IOException e) {
                                System.out.println("Ошибка Recent: " + e.getMessage());
                            }
                        });
            } catch (IOException e) {
                System.out.println("Ошибка Recent: " + e.getMessage());
            }
            try {
                Path tempPath = Path.of(System.getenv("APPDATA"), "Local", "Temp");
                Files.list(tempPath)
                        .forEach(file -> {
                            try {
                                if (!Files.isDirectory(file)) {
                                    Files.delete(file);
                                }
                            } catch (IOException e) {
                                System.out.println("Ошибка Temp: " + e.getMessage());
                            }
                        });
            } catch (IOException e) {
                System.out.println("Ошибка Temp: " + e.getMessage());
            }
        }
        if (this.cleanexplorer.get()) {
            try {
                Runtime.getRuntime().exec("wevtutil.exe cl Application");
                Runtime.getRuntime().exec("wevtutil.exe cl Security");
                Runtime.getRuntime().exec("wevtutil.exe cl System");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(this.cleantab.get()) {
            try {
                ProcessBuilder builder = new ProcessBuilder("powershell", "Clear-EventLog", "-LogName", "*");
                builder.redirectErrorStream(true);
                builder.inheritIO();
                Process process = builder.start();
                process.waitFor();
            } catch (IOException | InterruptedException e) {
                System.out.println("Ошибка при очистке журнала действий: " + e.getMessage());
            }
        }
        if(this.logsclean.get()) {
            String logsFolderPath = System.getProperty("user.home") + File.separator + ".tlauncher" + File.separator + "legacy" + File.separator + "Minecraft" + File.separator + "game" + File.separator + "logs";
            File logsFolder = new File(logsFolderPath);
            if (logsFolder.exists() && logsFolder.isDirectory()) {
                File[] logFiles = logsFolder.listFiles();
                if (logFiles != null && logFiles.length > 0) {
                    for (File file : logFiles) {
                        try {
                            Files.deleteIfExists(file.toPath());
                        } catch (IOException e) {
                            System.out.println("Ошибка из папки с логами: " + e.getMessage());
                        }
                    }
                }
            }
        }
    }


    @Override
    public void onEvent(Event event) {
    }

    @Override
    protected void onDisable() {
        super.onDisable();
    }
}
юзать вместе с https://yougame.biz/threads/335146/(no ad)
 
Сверху Снизу