fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. // These strings are never used maliciously but will appear in the binary
  6. const char *FAKE_C2 = "http://e...content-available-to-author-only...e.com/login.php";
  7. const char *FAKE_KEY = "1234-5678-ABCD-EFGH";
  8. const char *CMD = "cmd.exe /c del C:\\Windows\\System32\\important.dll";
  9.  
  10. void suspicious_function() {
  11. // This function does nothing but references the strings
  12. printf("Simulating malicious behavior...\n");
  13. printf("Connecting to: %s\n", FAKE_C2);
  14. }
  15.  
  16. int main() {
  17. printf("This is a benign program for educational analysis.\n");
  18. printf("It performs no harmful actions.\n");
  19.  
  20. // To ensure the compiler doesn't optimize the strings away, we reference them
  21. if (strcmp(FAKE_KEY, "0000") == 0) {
  22. suspicious_function();
  23. }
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0.01s 5304KB
stdin
/*  Berechnung des Hamming-Abstandes zwischen zwei 128-Bit Werten in 	*/
/*	einer Textdatei. 													*/
/*  Die Werte müssen auf einer separaten Zeile gespeichert sein			*/
/* 																		*/
/*	Erstellt: 17.5.2010													*/
/*  Autor: Thomas Scheffler												*/

#include <stdio.h>
#include <stdlib.h>

#define ARRAY_SIZE 32

unsigned Hamdist(unsigned x, unsigned y)
{
  unsigned dist = 0, val = x ^ y;
 
  // Count the number of set bits
  while(val)
  {
    ++dist; 
    val &= val - 1;
  }
 
  return dist;
}



int main (void)
{
	char hex;
	int i;
	int a[ARRAY_SIZE];
	int b[ARRAY_SIZE];
	int hamDist = 0;
	FILE* fp;
	
	//Arrays mit 0 initialisieren
	for (i = 0; i < ARRAY_SIZE; ++i)
	{
  		a[i] = 0;
  		b[i] = 0;
	}

	
	fp = fopen("hex.txt","r");
	if (fp == NULL) 
	{
		printf("Die Datei hex.txt wurde nicht gefunden!");
		exit(EXIT_FAILURE);
	}

	i=0;
	printf("1.Zeile einlesen.\n");

 	while((hex=fgetc(fp))!='\n' && hex != EOF)
    {
        a[i]=strtol(&hex,0,16);
		i++;
    }
	i=0;
	printf("2.Zeile einlesen.\n");

 	while((hex=fgetc(fp))!='\n' && hex != EOF)
    {
    	b[i]=strtol(&hex,0,16);
        i++;
    }
	fclose(fp);

	printf("Hamming-Abweichung pro Nibble:\n");
	for (i = 0; i < ARRAY_SIZE; ++i)
	{
		printf ("%i\t%i\t%i\n",a[i],b[i],Hamdist(a[i],b[i]));
		hamDist += Hamdist(a[i],b[i]);
	}
	printf ("\nHamming-Abweichung der Hash-Werte:%d\n",hamDist);
}

stdout
This is a benign program for educational analysis.
It performs no harmful actions.