mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-12 21:36:21 -04:00
删除 FractureiserDetector (#3313)
This commit is contained in:
parent
b624cebc08
commit
d3e9511aca
@ -20,7 +20,6 @@ package org.jackhuang.hmcl;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.control.Alert;
|
||||
import org.jackhuang.hmcl.ui.AwtUtils;
|
||||
import org.jackhuang.hmcl.util.FractureiserDetector;
|
||||
import org.jackhuang.hmcl.util.SelfDependencyPatcher;
|
||||
import org.jackhuang.hmcl.ui.SwingUtils;
|
||||
import org.jackhuang.hmcl.java.JavaRuntime;
|
||||
@ -70,7 +69,6 @@ public final class Main {
|
||||
|
||||
checkJavaFX();
|
||||
verifyJavaFX();
|
||||
detectFractureiser();
|
||||
|
||||
Launcher.main(args);
|
||||
}
|
||||
@ -94,13 +92,6 @@ public final class Main {
|
||||
}
|
||||
}
|
||||
|
||||
private static void detectFractureiser() {
|
||||
if (FractureiserDetector.detect()) {
|
||||
LOG.error("Detected that this computer is infected by fractureiser");
|
||||
showErrorAndExit(i18n("fatal.fractureiser"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkJavaFX() {
|
||||
try {
|
||||
SelfDependencyPatcher.patch();
|
||||
|
@ -1,57 +0,0 @@
|
||||
package org.jackhuang.hmcl.util;
|
||||
|
||||
import org.jackhuang.hmcl.util.platform.OperatingSystem;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* @see <a href="https://github.com/fractureiser-investigation/fractureiser">fractureiser-investigation/fractureiser</a>
|
||||
* @see <a href="https://prismlauncher.org/news/cf-compromised-alert/#automated-script">[MALWARE WARNING] "fractureiser" malware in many popular Minecraft mods and modpacks</a>
|
||||
*/
|
||||
public final class FractureiserDetector {
|
||||
private FractureiserDetector() {
|
||||
}
|
||||
|
||||
private static final class FractureiserException extends Exception {
|
||||
}
|
||||
|
||||
public static boolean detect() {
|
||||
try {
|
||||
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
|
||||
Path appdata = Paths.get(System.getProperty("user.home"), "AppData");
|
||||
if (Files.isDirectory(appdata)) {
|
||||
check(appdata.resolve("Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\run.bat"));
|
||||
|
||||
Path falseEdgePath = appdata.resolve("Local\\Microsoft Edge");
|
||||
if (Files.exists(falseEdgePath)) {
|
||||
check(falseEdgePath.resolve(".ref"));
|
||||
check(falseEdgePath.resolve("client.jar"));
|
||||
check(falseEdgePath.resolve("lib.dll"));
|
||||
check(falseEdgePath.resolve("libWebGL64.jar"));
|
||||
check(falseEdgePath.resolve("run.bat"));
|
||||
}
|
||||
}
|
||||
} else if (OperatingSystem.CURRENT_OS.isLinuxOrBSD()) {
|
||||
Path dataDir = Paths.get(System.getProperty("user.home"), ".config", ".data");
|
||||
if (Files.exists(dataDir)) {
|
||||
check(dataDir.resolve(".ref"));
|
||||
check(dataDir.resolve("client.jar"));
|
||||
check(dataDir.resolve("lib.jar"));
|
||||
}
|
||||
}
|
||||
} catch (FractureiserException e) {
|
||||
return true;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void check(Path path) throws FractureiserException {
|
||||
if (Files.isRegularFile(path)) {
|
||||
throw new FractureiserException();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user