Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pandaninjas committed Apr 8, 2024
1 parent abc3706 commit 88a3f8d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ public static void relaunchProcess(Matcher m) throws Exception {
}
// add all the entries on the classpath read only
String classPath = rmb.getClassPath();
for (String path : classPath.split(System.getProperty("path.separator"))) {
for (String path : classPath.split(File.pathSeparator)) {
File lib = new File(path);
builder.readOnlyBind(lib.getAbsolutePath(), lib.getAbsolutePath());
}
builder.addArgs(rmb.getInputArguments().toArray(new String[0]));
builder.addArgs("-cp", classPath + System.getProperty("path.separator") + Utils.getLibraryPathAsFile(NoSessionLoadingPlugin.class).getAbsolutePath());
builder.addArgs("-cp", classPath + File.pathSeparator + Utils.getLibraryPathAsFile(NoSessionLoadingPlugin.class).getAbsolutePath());
builder.addArgs("-Dgq.malwarefight.nosession.ipc=network");
builder.addArgs("net.minecraft.launchwrapper.Launch");
// blackboard erases the type, but we are sure that launchArgs will always be a HashMap<String, String>
Expand All @@ -198,16 +198,20 @@ public static void relaunchProcess(Matcher m) throws Exception {
Utils.setToken(m.group("token"), "windowspipe");
ArrayList<String> roMounts = new ArrayList<>();
String classPath = rmb.getClassPath();
for (String path : classPath.split(System.getProperty("path.separator"))) {
for (String path : classPath.split(File.pathSeparator)) {
File lib = new File(path);
roMounts.add(lib.getAbsolutePath());
}
roMounts.add(Utils.getLibraryPathAsFile(NoSessionLoadingPlugin.class).getAbsolutePath());
roMounts.add(System.getProperty("java.home"));
ArrayList<String> args = new ArrayList<>();
args.add(Utils.getJavaExe(true));
args.addAll(Arrays.asList(rmb.getInputArguments().toArray(new String[0])));
args.addAll(Arrays.asList("-cp", classPath + System.getProperty("path.separator") + Utils.getLibraryPathAsFile(NoSessionLoadingPlugin.class).getAbsolutePath()));
for (String arg: rmb.getInputArguments()) {
if (arg.contains("-agentlib"))
continue;
args.add(arg);
}
args.addAll(Arrays.asList("-cp", classPath + File.pathSeparator + Utils.getLibraryPathAsFile(NoSessionLoadingPlugin.class).getAbsolutePath()));
args.add("-Dgq.malwarefight.nosession.ipc=windowspipe");
args.add("net.minecraft.launchwrapper.Launch");
// blackboard erases the type, but we are sure that launchArgs will always be a HashMap<String, String>
Expand Down Expand Up @@ -241,7 +245,7 @@ public static void relaunchProcess(Matcher m) throws Exception {
}

static {
System.out.println(System.getProperty("java.io.tmpdir"));
WindowsSandbox.isSandboxed();
addSelfToClassLoader();
try {
Pattern mcJWT = Pattern.compile("--accessToken +(?<token>eyJhbGciOiJIUzI1NiJ9\\.[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*)");
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/gq/malwarefight/nosession/win/HandleSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public HandleSocket(WinNT.HANDLE handle) {
this.handle = handle;
}
@Override
public InputStream getInputStream() throws IOException {
public InputStream getInputStream() {
return new InputStream() {
@Override
public int read() throws IOException {
public int read() {
ByteBuffer buf = ByteBuffer.allocate(1);
Kernel32.INSTANCE.ReadFile(handle, buf, 1, null, null);
return buf.get(0);
Expand All @@ -26,10 +26,10 @@ public int read() throws IOException {
}

@Override
public OutputStream getOutputStream() throws IOException {
public OutputStream getOutputStream() {
return new OutputStream() {
@Override
public void write(int b) throws IOException {
public void write(int b) {
Kernel32.INSTANCE.WriteFile(handle, new byte[]{(byte) b}, 1, null, null);
}
};
Expand Down

0 comments on commit 88a3f8d

Please sign in to comment.