PoiNtEr->: Obfuscation in C language

                             Difference between a dream and an aim. A dream requires soundless sleep, whereas an aim requires sleepless efforts.

Search This Blog

Sunday, February 5, 2012

Obfuscation in C language


Obfuscated code is source or machine code that has been made difficult to understand for humans. Programmers may deliberately obfuscate code to conceal its purpose (security through obscurity) or its logic to prevent tampering, deter reverse engineering, or as a puzzle or recreational challenge for someone reading the source code. Programs known as obfuscators transform readable code into obfuscated code using various techniques.



Here are some examples:


#include <stdio.h>
#include <string.h>

#define THIS printf(
#define IS "%s\n"
#define OBFUSCATION ,foo);

int main(int argc, char *argv[])
{
int a = 0; char bar[32]; char foo[32];

strcpy(bar,"@h3eglhl1o. >w%o#rtlwdl!S");
for (a = 0; a < 26; a++) { foo[a/2] = bar[++a];};

THIS IS OBFUSCATION
}




#include <stdio.h>

#define THIS printf(
#define IS "%s\n"
#define OBFUSCATION ,v);

int main(c, v) char *v; int c; {
int a = 0; char f[32];
switch (c) {
case 0:
THIS IS OBFUSCATION
break;
case 34123:
for (a = 0; a < 13; a++) { f[a] = v[a*2+1];};
main(0,f);
break;
default:
main(34123,"@h3eglhl1o. >w%o#rtlwdl!S\0m");
break;
}
}


//And this one is my favourite:

#include <stdio.h>

int main(_, v)
char *v;
int _;
{
int a = 0;
char f[32];
double h[2];
h[0]=45292775039072015337818294777291233712602010484058537980040406998970839318606056371509860242635882146978279213248651686802679563341689205906929782860027147085585265808044138098435189023634024174787897560970443372888064.000000;
h[1]=3128538534511332261918672279229556317285759752605416115598070041899378872817093630416887111860103398785722686012631945249157285604833757170839557924130404226629497105702414794620928.000000
;

printf("%s\n",(char *)h);

}



:::Have any problem then feel free to leave comment:::


No comments:

Post a Comment