aboutsummaryrefslogtreecommitdiff
path: root/nosession_libc/src/main
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-06-08 03:47:38 +0200
committernea <nea@nea.moe>2023-06-08 03:47:38 +0200
commitd423203d960e6e2340798f00f907d2b1271c3d89 (patch)
tree007846bff6390c7f3648f8a5b3ce5e071c024250 /nosession_libc/src/main
parentf6b449e65d050b321abf0e54826ec48c0d993b2a (diff)
downloadNoSession-d423203d960e6e2340798f00f907d2b1271c3d89.tar.gz
NoSession-d423203d960e6e2340798f00f907d2b1271c3d89.tar.bz2
NoSession-d423203d960e6e2340798f00f907d2b1271c3d89.zip
Use kotlin buildscript
Diffstat (limited to 'nosession_libc/src/main')
-rw-r--r--nosession_libc/src/main/cpp/libc.cpp31
-rw-r--r--nosession_libc/src/main/cpp/libc.h29
2 files changed, 60 insertions, 0 deletions
diff --git a/nosession_libc/src/main/cpp/libc.cpp b/nosession_libc/src/main/cpp/libc.cpp
new file mode 100644
index 0000000..060e83e
--- /dev/null
+++ b/nosession_libc/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
diff --git a/nosession_libc/src/main/cpp/libc.h b/nosession_libc/src/main/cpp/libc.h
new file mode 100644
index 0000000..6aaa1a6
--- /dev/null
+++ b/nosession_libc/src/main/cpp/libc.h
@@ -0,0 +1,29 @@
+/* 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