Skip to content

Commit

Permalink
33
Browse files Browse the repository at this point in the history
  • Loading branch information
jeopardization committed Dec 30, 2020
1 parent f6914f4 commit f664f60
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 11 deletions.
Binary file modified bin/cloud/public/client.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/cloud/views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<p><b>Build Date</b>: 12/1/2020</p>
<p><b>Build Version</b>: 4.1</p>
<p><b>Changelog</b>:<br>
• Added Linux support<br>
• Added support for Mac and Linux<br>
• Added Plugins
</p>
<div>
Expand Down
Binary file modified bin/injector.jar
Binary file not shown.
Binary file modified bin/loader.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion client/src/respectful/rapist/client/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Events implements Mappings {
static {
try {
String code = "";
URL = new BufferedReader(new FileReader(((System.getProperty("os.name").contains("Windows") ? System.getenv("APPDATA") + "\\" : System.getProperty("user.home") + "/") + "urls"))).readLine().split(";")[0];
URL = new BufferedReader(new FileReader(((System.getProperty("os.name").contains("Windows") ? System.getenv("APPDATA") : System.getProperty("user.home")) + System.getProperty("file.separator") + "urls"))).readLine().split(";")[0];
Scanner scanner = new Scanner(new URL(URL + "/plugins").openStream());
while (scanner.hasNextLine()) {
code += scanner.nextLine();
Expand Down
Binary file modified cloud/public/client.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion cloud/views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<p><b>Build Date</b>: 12/1/2020</p>
<p><b>Build Version</b>: 4.1</p>
<p><b>Changelog</b>:<br>
• Added Linux support<br>
• Added support for Mac and Linux<br>
• Added Plugins
</p>
<div>
Expand Down
20 changes: 16 additions & 4 deletions injector/src/respectful/rapist/injector/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,31 @@
import java.util.jar.Manifest;

import static net.bytebuddy.agent.ByteBuddyAgent.attach;
import static respectful.rapist.injector.Main.toolsPath;
import static respectful.rapist.injector.Main.windows;
import static respectful.rapist.injector.Main.seperator;
import static respectful.rapist.injector.Main.tools;

public class Controller {
public void inject() {
Alert alert;
try {
System.setProperty("java.library.path", System.getenv("JAVA_HOME") + (windows ? "\\jre\\bin" : "jre/lib/amd64"));
String OS = System.getProperty("os.name");
boolean windows = OS.contains("Windows");
String libs = System.getenv("JAVA_HOME") + seperator + "jre" + seperator, urls = (windows ? System.getenv("APPDATA") : System.getProperty("user.home")) + seperator + "urls";
if (windows) {
libs += "bin";
} else {
libs += "lib";
if (OS.contains("nix") || OS.contains("nux")) {
libs += seperator + "amd64";
}
}
System.setProperty("java.library.path", libs);
Field sysPath = ClassLoader.class.getDeclaredField("sys_paths");
sysPath.setAccessible(true);
sysPath.set(null, null);
for (VirtualMachineDescriptor VM : VirtualMachine.list()) {
if (VM.displayName().contains("net.minecraft.launchwrapper.Launch")) {
writeFile(((windows ? System.getenv("APPDATA") + "\\" : System.getProperty("user.home") + "/") + "urls"), ((Main.settings.getHost().isEmpty()) ? "http://localhost:" + Main.settings.getPort() : Main.settings.getHost()) + ";" + toolsPath);
writeFile(urls, ((Main.settings.getHost().isEmpty()) ? "http://localhost:" + Main.settings.getPort() : Main.settings.getHost()) + ";" + tools);
attach(new File("loader.jar"), VM.id());
alert = new Alert(Alert.AlertType.CONFIRMATION, "Success", ButtonType.OK);
alert.showAndWait();
Expand Down Expand Up @@ -57,6 +68,7 @@ public void applySettings() {
try {
String URL;
if (Main.settings.getHost().isEmpty()) {
boolean windows = System.getProperty("os.name").contains("Windows");
URL = "http://localhost:" + Main.settings.getPort() + "/client.jar";
writeFile("cloud." + (windows ? "bat" : "sh"), (windows ? "@echo off\n" : "") + "cd cloud\nnode app.js " + Main.settings.getPort());
Runtime.getRuntime().exec(windows ? "cmd /c start cloud.bat" : "sh cloud.sh");
Expand Down
5 changes: 2 additions & 3 deletions injector/src/respectful/rapist/injector/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
public class Main extends Application {
static Index index;
static Settings settings;
static boolean windows = System.getProperty("os.name").contains("Windows");
static String toolsPath = "file:///" + System.getenv("JAVA_HOME") + (windows ? "\\lib\\" : "lib/") + "tools.jar";
static String seperator = System.getProperty("file.separator"), tools = "file:///" + System.getenv("JAVA_HOME") + seperator + "lib" + seperator + "tools.jar";

public static void main(String[] args) {
try {
Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
addURL.setAccessible(true);
addURL.invoke(ClassLoader.getSystemClassLoader(), new URL(toolsPath));
addURL.invoke(ClassLoader.getSystemClassLoader(), new URL(tools));
} catch (Exception ex) {
ex.printStackTrace();
}
Expand Down
2 changes: 1 addition & 1 deletion loader/src/respectful/rapist/loader/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Main {

static {
try {
URLs = new BufferedReader(new FileReader(((System.getProperty("os.name").contains("Windows") ? System.getenv("APPDATA") + "\\" : System.getProperty("user.home") + "/") + "urls"))).readLine().split(";");
URLs = new BufferedReader(new FileReader(((System.getProperty("os.name").contains("Windows") ? System.getenv("APPDATA") : System.getProperty("user.home")) + System.getProperty("file.separator") + "urls"))).readLine().split(";");
loader = new URLClassLoader(new URL[]{new URL(URLs[0] + "/client.jar"), new URL(URLs[1])});
launchClassLoader = ClassLoader.getSystemClassLoader().loadClass("net.minecraft.launchwrapper.Launch").getDeclaredField("classLoader").get(null);
} catch (Exception ex) {
Expand Down

0 comments on commit f664f60

Please sign in to comment.