mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Влезаем в лаунчер через agent. (#202)
* [FIX] Правки градла. * [FEATURE] Скрипт для скачивания. * [DOCS] Правки readme. * [FIX][DOCS] Удален неактуальная папка docs. * [DOCS] Готов readme. * [FIX] Launcher sign. * [FEATURE] Модули по новому. * [FIX] Способ влезть в лаунчер через agent. * [ANY] Обновлены модули (там фикс JarSigner). * [FEATURE] ListDownloader.
This commit is contained in:
parent
0194ab7a5b
commit
695758aa18
11 changed files with 81 additions and 48 deletions
|
@ -1,6 +1,8 @@
|
|||
def mainClassName = "ru.gravit.launchserver.LaunchServer"
|
||||
def mainAgentName = "ru.gravit.launchserver.StarterAgent"
|
||||
|
||||
evaluationDependsOn(':Launcher')
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url "https://oss.sonatype.org/content/repositories/snapshots"
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
import java.util.List;
|
||||
|
||||
public class ClientLauncherWrapper {
|
||||
public static final String MAGIC_ARG = "-Djdk.attach.allowAttachSelf";
|
||||
|
||||
public static void main(String[] arguments) throws IOException, InterruptedException {
|
||||
LogHelper.printVersion("Launcher");
|
||||
LogHelper.printLicense("Launcher");
|
||||
|
@ -36,6 +38,8 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
|||
JVMHelper.addSystemPropertyToArgs(args, DirBridge.CUSTOMDIR_PROPERTY);
|
||||
JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_CUSTOMDIR_PROPERTY);
|
||||
JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_OPTDIR_PROPERTY);
|
||||
Collections.addAll(args, MAGIC_ARG);
|
||||
Collections.addAll(args, "-XX:+DisableAttachMechanism");
|
||||
Collections.addAll(args, "-javaagent:".concat(pathLauncher));
|
||||
Collections.addAll(args, "-cp");
|
||||
Collections.addAll(args, pathLauncher);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.Request;
|
||||
import ru.gravit.launcher.request.update.LegacyLauncherRequest;
|
||||
import ru.gravit.launcher.serialize.HInput;
|
||||
import ru.gravit.launcher.serialize.HOutput;
|
||||
import ru.gravit.launcher.serialize.stream.StreamObject;
|
||||
|
@ -34,8 +35,6 @@
|
|||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.nio.file.attribute.PosixFilePermission;
|
||||
import java.util.*;
|
||||
import java.util.Timer;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public final class ClientLauncher {
|
||||
private static Gson gson = new Gson();
|
||||
|
@ -301,7 +300,6 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl
|
|||
public static Process launch(
|
||||
HashedDir assetHDir, HashedDir clientHDir,
|
||||
ClientProfile profile, Params params, boolean pipeOutput) throws Throwable {
|
||||
// Write params file (instead of CLI; Mustdie32 API can't handle command line > 32767 chars)
|
||||
LogHelper.debug("Writing ClientLauncher params");
|
||||
ClientLauncherContext context = new ClientLauncherContext();
|
||||
clientStarted = false;
|
||||
|
@ -368,6 +366,7 @@ public static Process launch(
|
|||
// Add classpath and main class
|
||||
String pathLauncher = IOHelper.getCodeSource(ClientLauncher.class).toString();
|
||||
context.pathLauncher = pathLauncher;
|
||||
Collections.addAll(context.args, ClientLauncherWrapper.MAGIC_ARG);
|
||||
Collections.addAll(context.args, profile.getJvmArgs());
|
||||
profile.pushOptionalJvmArgs(context.args);
|
||||
Collections.addAll(context.args, "-Djava.library.path=".concat(params.clientDir.resolve(NATIVES_DIR).toString())); // Add Native Path
|
||||
|
@ -434,7 +433,6 @@ public static void main(String... args) throws Throwable {
|
|||
engine.runtimeProvider.init(true);
|
||||
engine.runtimeProvider.preLoad();
|
||||
LauncherGuardManager.initGuard(true);
|
||||
// Read and delete params file
|
||||
LogHelper.debug("Reading ClientLauncher params");
|
||||
Params params;
|
||||
ClientProfile profile;
|
||||
|
@ -445,8 +443,6 @@ public static void main(String... args) throws Throwable {
|
|||
try (HInput input = new HInput(socket.getInputStream())) {
|
||||
params = new Params(input);
|
||||
profile = gson.fromJson(input.readString(0), ClientProfile.class);
|
||||
|
||||
// Read hdirs
|
||||
assetHDir = new HashedDir(input);
|
||||
clientHDir = new HashedDir(input);
|
||||
}
|
||||
|
@ -462,8 +458,8 @@ public static void main(String... args) throws Throwable {
|
|||
Launcher.modulesManager.initModules();
|
||||
// Verify ClientLauncher sign and classpath
|
||||
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
||||
//TODO: GO TO DIGEST
|
||||
//SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherDigest, publicKey);
|
||||
//Warning - experimental.
|
||||
SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherDigest, Launcher.getConfig().publicKey);
|
||||
LinkedList<Path> classPath = resolveClassPathList(params.clientDir, profile.getClassPath());
|
||||
for (Path classpathURL : classPath) {
|
||||
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
dependencies {
|
||||
compile project(':libLauncher')
|
||||
compile 'org.java-websocket:Java-WebSocket:1.3.9'
|
||||
compile 'org.apache.httpcomponents:httpclient:4.5.7'
|
||||
compileOnly 'com.google.guava:guava:26.0-jre'
|
||||
compile files('../compat/authlib/authlib-clean.jar')
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package ru.gravit.launcher.downloader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.ResponseHandler;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.client.LaxRedirectStrategy;
|
||||
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
|
||||
public class ListDownloader {
|
||||
public void download(String base, List<String> applies, Path dstDirFile) throws IOException, URISyntaxException {
|
||||
try(CloseableHttpClient httpclient = HttpClients.custom()
|
||||
.setRedirectStrategy(new LaxRedirectStrategy())
|
||||
.build()) {
|
||||
|
||||
HttpGet get = null;
|
||||
for (String apply : applies) {
|
||||
URI u = new URL(base.concat(apply)).toURI();
|
||||
if (get == null) get = new HttpGet(u);
|
||||
else {
|
||||
get.reset();
|
||||
get.setURI(u);
|
||||
}
|
||||
httpclient.execute(get, new FileDownloadResponseHandler(dstDirFile.resolve(apply)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class FileDownloadResponseHandler implements ResponseHandler<Path> {
|
||||
private final Path target;
|
||||
public FileDownloadResponseHandler(Path target) {
|
||||
this.target = target;
|
||||
}
|
||||
@Override
|
||||
public Path handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
|
||||
InputStream source = response.getEntity().getContent();
|
||||
IOHelper.transfer(source, this.target);
|
||||
return this.target;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,9 @@
|
|||
# Modification of the launcher sashok724's v3 from Gravit [![Build Status](https://travis-ci.com/GravitLauncher/Launcher.svg?branch=master)](https://travis-ci.com/GravitLauncher/Launcher)
|
||||
* Discord channel: https://discord.gg/aJK6nMN
|
||||
* [See license](LICENSE)
|
||||
* Changes: [ru-ru](docs/RU-changes.md#Изменения) [en-us](docs/EN-changes.md#changes)
|
||||
* [See code of conduct](CODE_OF_CONDUCT.md)
|
||||
* [WIKI](https://launcher.gravit.pro)
|
||||
* Get it (requires cURL):
|
||||
```sh
|
||||
curl -s https://raw.githubusercontent.com/GravitLauncher/Launcher/master/get_it.sh | sh
|
||||
```
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
# Changes
|
||||
* Build with Gradle
|
||||
* The code is free of many dirty "hacks" that depend on the implementation and undocumented features of a particular JVM
|
||||
* Removed JVM installation
|
||||
* Brute-force attack protection
|
||||
* Launcher compiles and runs with JDK 10
|
||||
* Patched launchwrapper with Java 10 support
|
||||
* ClassPath is not visible in the start line
|
||||
* Symlinks are fully allowed without restrictions
|
||||
* Removed an undocumented feature which allowed to use JavaScript plugins on server side
|
||||
* Various improvements and bugfixes
|
||||
* Split into 5 modules instead of two
|
||||
* The old bypasses don't work
|
||||
* Partially modified structure of the classes
|
||||
* Bug fixes in the main branch of the launcher
|
||||
* Ability to install different skins on different servers
|
||||
* Send HWID
|
||||
* Flexible exe settings when building
|
||||
* And much more!
|
|
@ -1,19 +0,0 @@
|
|||
# Изменения
|
||||
* Сборка Gradle
|
||||
* Код избавлен от множества грязных "хаков", зависящих от реализации и недокументированных особенностей конкретной JVM
|
||||
* Вырезана установка своей JVM
|
||||
* Защита от брута пароля
|
||||
* Лаунчер комплируется и запускается с JDK 10
|
||||
* Патч launchwrapper с поддержкой Java 10
|
||||
* ClassPath не виден в строке запуска
|
||||
* Полностью разрешены симлинки без ограничений
|
||||
* Вырезана недокументированная возможность использования JavaScript плагинов на стороне сервера
|
||||
* Различные исправления и доработки
|
||||
* Разбиение на 5 модулей вместо двух
|
||||
* Старые обходы не работают
|
||||
* Частично изменена структура классов
|
||||
* Исправления багов из основной ветки лаунчера
|
||||
* Возможность устанавливать разные скины на разные сервера
|
||||
* Отправка HWID
|
||||
* Гибкая настройка параметров exe при сборке
|
||||
* И многое другое!
|
4
get_it.sh
Executable file
4
get_it.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
git clone https://github.com/GravitLauncher/Launcher.git
|
||||
sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules
|
||||
git submodule update --init --recursive
|
7
module.gradle
Normal file
7
module.gradle
Normal file
|
@ -0,0 +1,7 @@
|
|||
dependencies {
|
||||
compileOnly project(':LaunchServer')
|
||||
}
|
||||
jar {
|
||||
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
}
|
||||
|
2
modules
2
modules
|
@ -1 +1 @@
|
|||
Subproject commit be22f5b74912bda8df26ce888af994f330cc8934
|
||||
Subproject commit 8df678bed74b671ba0f0866f8f215fd42e467c03
|
Loading…
Reference in a new issue