diff options
author | nea <nea@nea.moe> | 2023-06-08 03:47:38 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-06-08 03:47:38 +0200 |
commit | d423203d960e6e2340798f00f907d2b1271c3d89 (patch) | |
tree | 007846bff6390c7f3648f8a5b3ce5e071c024250 /src | |
parent | f6b449e65d050b321abf0e54826ec48c0d993b2a (diff) | |
download | NoSession-d423203d960e6e2340798f00f907d2b1271c3d89.tar.gz NoSession-d423203d960e6e2340798f00f907d2b1271c3d89.tar.bz2 NoSession-d423203d960e6e2340798f00f907d2b1271c3d89.zip |
Use kotlin buildscript
Diffstat (limited to 'src')
-rw-r--r-- | src/main/cpp/libc.cpp | 31 | ||||
-rw-r--r-- | src/main/cpp/libc.h | 29 | ||||
-rw-r--r-- | src/main/java/gq/malwarefight/nosession/linux/bwrap/BubblewrapBuilder.java | 2 | ||||
-rw-r--r-- | src/main/java/gq/malwarefight/nosession/linux/libc/Libc.java | 2 | ||||
-rw-r--r-- | src/main/java/gq/malwarefight/nosession/utils/Utils.java | 2 |
5 files changed, 3 insertions, 63 deletions
diff --git a/src/main/cpp/libc.cpp b/src/main/cpp/libc.cpp deleted file mode 100644 index 060e83e..0000000 --- a/src/main/cpp/libc.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include <jni.h> -#include "unistd.h" -#include <fcntl.h> -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: gq_malwarefight_nosession_linux_libc_Libc - * Method: geteuid - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_gq_malwarefight_nosession_linux_libc_Libc_geteuid - (JNIEnv *, jclass) { - return (int) geteuid(); -} - -/* - * Class: gq_malwarefight_nosession_linux_libc_Libc - * Method: unlink - * Signature: (Ljava/lang/String;)I - */ -JNIEXPORT void JNICALL Java_gq_malwarefight_nosession_linux_libc_Libc_unlink - (JNIEnv* env, jclass, jstring string) { - const char* path = env->GetStringUTFChars(string, NULL); - unlink(path); - env->ReleaseStringUTFChars(string, path); -} - -#ifdef __cplusplus -} -#endif diff --git a/src/main/cpp/libc.h b/src/main/cpp/libc.h deleted file mode 100644 index 6aaa1a6..0000000 --- a/src/main/cpp/libc.h +++ /dev/null @@ -1,29 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class gq_malwarefight_nosession_linux_libc_Libc */ - -#ifndef _Included_gq_malwarefight_nosession_linux_libc_Libc -#define _Included_gq_malwarefight_nosession_linux_libc_Libc // NOLINT(bugprone-reserved-identifier) -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: gq_malwarefight_nosession_linux_libc_Libc - * Method: geteuid - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_gq_malwarefight_nosession_linux_libc_Libc_geteuid - (JNIEnv *, jclass); - -/* - * Class: gq_malwarefight_nosession_linux_libc_Libc - * Method: unlink - * Signature: (Ljava/lang/String;) - */ -JNIEXPORT void JNICALL Java_gq_malwarefight_nosession_linux_libc_Libc_unlink - (JNIEnv *, jclass, jstring); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/main/java/gq/malwarefight/nosession/linux/bwrap/BubblewrapBuilder.java b/src/main/java/gq/malwarefight/nosession/linux/bwrap/BubblewrapBuilder.java index 34542cd..6a5b9a5 100644 --- a/src/main/java/gq/malwarefight/nosession/linux/bwrap/BubblewrapBuilder.java +++ b/src/main/java/gq/malwarefight/nosession/linux/bwrap/BubblewrapBuilder.java @@ -395,7 +395,7 @@ public class BubblewrapBuilder { finalArgs.addAll(bubblewrapArgs); finalArgs.add(command); finalArgs.addAll(programArgs); - pb.command(finalArgs).redirectOutput(new File("/home/pandaninjas/log")).redirectError(new File("/home/pandaninjas/log1")); + pb.command(finalArgs).redirectOutput(new File(System.getProperty("NOSESSION_STDOUT", System.getProperty("user.home") + "/nosession-stdout.log"))).redirectError(new File(System.getProperty("NOSESSION_STDERR", System.getProperty("user.home") + "/nosession-stderr.log"))); return pb; } } diff --git a/src/main/java/gq/malwarefight/nosession/linux/libc/Libc.java b/src/main/java/gq/malwarefight/nosession/linux/libc/Libc.java index 670f83d..3677537 100644 --- a/src/main/java/gq/malwarefight/nosession/linux/libc/Libc.java +++ b/src/main/java/gq/malwarefight/nosession/linux/libc/Libc.java @@ -16,7 +16,7 @@ public class Libc { static { try { File tempFile = Files.createTempFile("nosession_libc", ".so").toFile(); - try (InputStream is = Libc.class.getResourceAsStream("/native/" + System.getProperty("os.arch") + "/" + System.getProperty("os.name") + "/" + System.mapLibraryName("linux"))) { + try (InputStream is = Libc.class.getResourceAsStream("/native/" + System.getProperty("os.arch") + "/" + System.getProperty("os.name") + "/" + System.mapLibraryName("nosession_libc"))) { assert is != null: "Native library not compiled"; Utils.copy(is, Files.newOutputStream(tempFile.toPath())); } diff --git a/src/main/java/gq/malwarefight/nosession/utils/Utils.java b/src/main/java/gq/malwarefight/nosession/utils/Utils.java index 7f65b2a..ab10319 100644 --- a/src/main/java/gq/malwarefight/nosession/utils/Utils.java +++ b/src/main/java/gq/malwarefight/nosession/utils/Utils.java @@ -174,7 +174,7 @@ public class Utils { public static void setToken(String token) throws IOException, URISyntaxException { ProcessBuilder processBuilder = new ProcessBuilder( - getJavaExe(p), "-XX:+DisableAttachMechanism", "-cp", getClasspath(p), Main.class.getName() + getJavaExe(), "-XX:+DisableAttachMechanism", "-cp", getClasspath(), Main.class.getName() ); processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT).redirectError(ProcessBuilder.Redirect.INHERIT); Process c = processBuilder.start(); |