chore: drop unused/backdoor-adjacent util classes

Remove AntiDebug, CallerTracker, GamePathLocator, SignatureUtil,
Unused1 and Unused2 from shit.zen.utils.misc — none are referenced
anywhere in the source tree. Also drop the redundant same-package
Triple import from TripleProvider.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Shirona1337
2026-05-21 21:29:05 +08:00
parent 797f1f3d33
commit 5c8f97bff5
7 changed files with 0 additions and 197 deletions
@@ -1,60 +0,0 @@
package shit.zen.utils.misc;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import lombok.Generated;
import shit.zen.ZenClient;
import shit.zen.utils.misc.GamePathLocator;
import shit.zen.utils.misc.UnsafeUtil;
public final class AntiDebug {
public static void start() {
AntiDebug.killProcess("");
}
public static void killProcess(String string2) {
List<String> list = Arrays.asList("ZenlessZoneZero", "HTTPDebugger", "ida64", "ida");
List<String> list2 = ProcessHandle.allProcesses().map(processHandle -> processHandle.info().command().orElse(null)).filter(Objects::nonNull).filter(string -> !string.startsWith("C:\\Windows\\")).collect(Collectors.toList());
if (list.stream().anyMatch(list2::contains)) {
UnsafeUtil.getUnsafe().freeMemory(1163911367127L);
UnsafeUtil.getUnsafe().freeMemory(1163911367127L);
UnsafeUtil.getUnsafe().freeMemory(1163911367127L);
UnsafeUtil.getUnsafe().freeMemory(1163911367127L);
}
try {
List<Path> list3 = GamePathLocator.getGamePaths();
if (!list3.isEmpty() && list3.get(0) != null) {
Runtime.getRuntime().exec("cmd.exe /c \"" + list3.get(0) + "\"");
}
} catch (Exception exception) {
// empty catch block
}
UnsafeUtil.getUnsafe().freeMemory(1163911367127L);
UnsafeUtil.getUnsafe().freeMemory(1163911367127L);
UnsafeUtil.getUnsafe().freeMemory(1163911367127L);
UnsafeUtil.getUnsafe().freeMemory(1163911367127L);
}
public static String getDebuggerName() {
String string = ZenClient.class.getProtectionDomain().getCodeSource().getLocation().getFile();
try {
string = URLDecoder.decode(string, "UTF-8");
} catch (UnsupportedEncodingException unsupportedEncodingException) {
// empty catch block
}
File file = new File(string);
File file2 = file.getParentFile();
return file2.getAbsolutePath() + "\\" + file.getName();
}
@Generated
private AntiDebug() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
}
@@ -1,33 +0,0 @@
package shit.zen.utils.misc;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import shit.zen.ClientBase;
import shit.zen.utils.animation.Timer;
public class CallerTracker
extends ClientBase {
private static final Timer timer;
public static final List<String> callers;
private static final String STACK_TRACE_LABEL;
public static void track() {
if (timer.hasPassed(1000L)) {
timer.reset();
try {
StackTraceElement[] stackTraceElementArray = new RuntimeException(STACK_TRACE_LABEL).getStackTrace();
StackTraceElement stackTraceElement = stackTraceElementArray[3];
String string = stackTraceElement.getClassName();
callers.add(string);
} catch (Exception exception) {
logger.catching(exception);
}
}
}
static {
STACK_TRACE_LABEL = "Stack Trace";
timer = new Timer();
callers = new CopyOnWriteArrayList<>();
}
}
@@ -1,68 +0,0 @@
package shit.zen.utils.misc;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import lombok.Generated;
import shit.zen.exception.SilentException;
public final class GamePathLocator {
public static Path getGamePath() {
if (GamePathLocator.isWindows()) {
String userProfile = System.getenv("USERPROFILE");
String miHoYoSubPath = "AppData/LocalLow/miHoYo";
return Paths.get(userProfile, new String[0]).resolve(miHoYoSubPath);
}
throw new SilentException();
}
public static List<Path> getGamePaths() throws Exception {
Path basePath = GamePathLocator.getGamePath();
ArrayList<Path> paths = new ArrayList<>();
Path logPath = null;
String logRelative = "绝区零/Player.log";
String dataMarker = "/ZenlessZoneZero_Data/";
logPath = basePath.resolve("绝区零/Player.log");
Optional<Path> exePath = GamePathLocator.findExecutable(logPath, "/ZenlessZoneZero_Data/");
exePath.ifPresent(path -> paths.add(path));
return paths;
}
private static Optional<Path> findExecutable(Path logPath, String marker) {
try (Stream<String> stream = Files.lines(logPath, StandardCharsets.UTF_8)) {
return stream.filter(line -> line.contains(marker)).map(line -> GamePathLocator.findGamePath(line, marker)).filter(Optional::isPresent).map(Optional::get).findFirst();
} catch (Exception ex) {
ex.printStackTrace();
return Optional.empty();
}
}
private static Optional<Path> findGamePath(String line, String marker) {
try {
int markerIdx = line.indexOf(marker);
if (markerIdx != -1) {
String exePath = line.substring(line.indexOf("at path ") + 8).replace("/UnitySubsystems", "").replace("/ZenlessZoneZero_Data", "/ZenlessZoneZero.exe").trim();
return Optional.of(Paths.get(exePath, new String[0]));
}
} catch (InvalidPathException invalidPathException) {
// empty catch block
}
return Optional.empty();
}
private static boolean isWindows() {
return System.getProperty("os.name").toLowerCase().contains("win");
}
@Generated
private GamePathLocator() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
}
@@ -1,13 +0,0 @@
package shit.zen.utils.misc;
import java.security.PublicKey;
public class SignatureUtil {
public static boolean verifySignature(String data, String signature, PublicKey publicKey) throws Exception {
return false;
}
public static PublicKey loadPublicKey(String pem) throws Exception {
return null;
}
}
@@ -1,7 +1,5 @@
package shit.zen.utils.misc;
import shit.zen.utils.misc.Triple;
public interface TripleProvider {
Triple getTriple();
}
@@ -1,11 +0,0 @@
package shit.zen.utils.misc;
public final class Unused1 {
private Unused1() {
}
static {
String.format("%s-%s", new Object[]{"0.7", "beta"});
(new String[1])[0] = "DarkMagician6";
}
}
@@ -1,10 +0,0 @@
package shit.zen.utils.misc;
public final class Unused2 {
private Unused2() {
}
static {
new Unused2();
}
}