aboutsummaryrefslogtreecommitdiff
path: root/src/main/cpp/libc.cpp
diff options
context:
space:
mode:
authorPandaNinjas <admin@malwarefight.gq>2023-05-19 17:15:46 -0400
committerPandaNinjas <admin@malwarefight.gq>2023-05-19 17:15:46 -0400
commitd30a5775fab3f4e8968e4066a5e59a4b953d8870 (patch)
treeb530ea31755685193192230f5e570947caf2cba1 /src/main/cpp/libc.cpp
parentca67ac4481ce308d42ab33defdee2e54e2ca82ab (diff)
downloadNoSession-d30a5775fab3f4e8968e4066a5e59a4b953d8870.tar.gz
NoSession-d30a5775fab3f4e8968e4066a5e59a4b953d8870.tar.bz2
NoSession-d30a5775fab3f4e8968e4066a5e59a4b953d8870.zip
stuff
Diffstat (limited to 'src/main/cpp/libc.cpp')
-rw-r--r--src/main/cpp/libc.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/cpp/libc.cpp b/src/main/cpp/libc.cpp
new file mode 100644
index 0000000..060e83e
--- /dev/null
+++ b/src/main/cpp/libc.cpp
@@ -0,0 +1,31 @@
+#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