![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Nice and obfuscated
Well since Scorpions4ever had come with a modified version of one posted at ioccc.org I thought it would be nice to try and deobfuscate one which still works on my (V)C-compiler, which is configured at warning level 3. (So no errors at this level allowed)
Obfuscated: #define P(X)j=write(1,X,1)
#define C 39
int M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N,
*d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0;
s<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!=M[k]>=16))a[f++
]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-16*!j;M[g]=
c|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P(" ");for(s=C;--s;P("_")
)P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))P("| "+(*u/4)%2
);}Deobfuscated #define P(X)j=write(1,X,1)
#define C 39
int M[5000] = {2};
int *u = M,N[5000];
int R = 22;
int a[4];
int l[] = {0,-1,C-1,-1};
int m[] = {1,-C,-1,C};
int *b = N;
int *d=N;
int c,e,f,g,i,j,k,s;
main()
{
for( M[i=C*R-1] = 24; f|d >= b;)
{
c=M[g=i];
i=e;
for( s=f=0; s<4; s++ )
if( (k=m[s]+g)>=0 && k<C*R&&l[s]!=k%C && (!M[k] || !j && c >= 16 != M[k] >= 16))
a[f++] = s;
if(f)
{
f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];
j = j < f ? f : j;
f += c&-16*!j;
M[g] = c|1<<s;
M[*d++=e]=f|1<<(s+2)%4;
}
else
e = d > b++ ? b[-1]: e;
}
P(" ");
for(s=C; --s; P("_"))
P(" ");
for(; P("\n"),R--; P("|"))
for(e = C; e--; P("_ "+(*u++/8)%2))
P("| " + (*u/4)%2);
}
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Oo oo I got another one deobfuscated:
Obfuscated: #include "stdio.h"
#define xyxx char
#define xyyxx putchar
#define xyyyxx while
#define xxyyyx int
#define xxxyyx main
#define xyxyxy if
#define xyyxyy '\n'
xyxx *xyx [] = {
"]I^x[i]k\\I^o[IZ~\\IZ~[I^|[I^l[I^j[I^}[I^n[i]m\\I]h",
"]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~[IZ|_IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm_IZh",
"]IZx\\IZx[I^k[I\\o]IZ~\\IZ~\\I]|[IZl_I^j]IZ}]I^n[IZm\\IZm_IZh",
"]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~_IZ|[IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm]IZh",
"]I^x[i]k\\IZo_I^~[I^|[I^l[IZj\\IZj]IZ}]I^n[i]m^IZh",'\0'};/*xyyxyxyxxxyxxxyy*/
xyxx *xyyx; xxyyyx xyyyx,xyyyyx,xyyyyyx=0x59,xyyyyyyx=0x29,/*yxxyxyyyxxyyyxyy*/
xxyx=0x68;xxxyyx(){xyyyyx=0;xyyyxx(xyx[xyyyyx]){xyyx=xyx[xyyyyx++];/*xyyyxxyx*/
xyyyxx(*xyyx){xyyyx= *xyyx++-xyyyyyx;xyyyxx(xyyyx--)xyyxx(*xyyx-xyyyyyyx);/*x*/
xyxyxy(*xyyx==xxyx)xyyxx(xyyxyy);*xyyx++;}}}/*xyxyxyyyyxxyxxxyyyxyyyxyxxyyy*/Deobfuscated: #include <stdio.h>
char *crypt [] =
{
"]I^x[i]k\\I^o[IZ~\\IZ~[I^|[I^l[I^j[I^}[I^n[i]m\\I]h",
"]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~[IZ|_IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm_IZh",
"]IZx\\IZx[I^k[I\\o]IZ~\\IZ~\\I]|[IZl_I^j]IZ}]I^n[IZm\\IZm_IZh",
"]IZx\\IZx[IZk\\IZk[IZo_IZ~\\IZ~_IZ|[IZl_IZj\\IZj]IZ}]IZn_IZm\\IZm]IZh",
"]I^x[i]k\\IZo_I^~[I^|[I^l[IZj\\IZj]IZ}]I^n[i]m^IZh",'\0'
};
char *array;
int one, two, three=0x59, four=0x29, five=0x68;
main()
{
two = 0;
while(crypt[two])
{
array=crypt[two++];
while(*array)
{
one = *array++ - three;
while(one--)
putchar(*array-four);
if(*array==five)
putchar('\n');
*array++;
}
}
}
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates Last edited by nnxion; Jun 8th, 2005 at 1:49 PM. |
|
|
|
|
|
#3 |
|
Professional Programmer
|
Go for my sig
It's not that bad. It's in C++ btw.
__________________
% rc4 hexkey < input > output
#define S ,t=s[i],s[i]=s[j],s[j]=t /* rc4 hexkey <file */
unsigned char k[256],s[256],i,j,t;main(c,v,e)char**v;{++v;while(++i)s[
i]=i;for(c=0;*(*v)++;k[c++]=e)sscanf((*v)++-1,"%2x",&e);while(j+=s[i]
+k[i%c]S,++i);for(j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;} |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Is there a program that replaces #defined things with their pre-processed equivalents?
|
|
|
|
|
|
#5 | |
|
Newbie
Join Date: Jun 2005
Location: Vienna, Austria
Posts: 15
Rep Power: 0
![]() |
Quote:
for instance (on Linux): gcc -E program.c >output.c |
|
|
|
|
|
|
#6 | |
|
Programmer
Join Date: Jun 2005
Posts: 86
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Danke.
|
|
|
|
|
|
#8 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
rofl... the C Preprocesser (cpp)
Same thing the compiler uses to do it! |
|
|
|
|
|
#9 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Don't leave the include files though when using the -E option, it will get you a lot of things you don't want.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#10 |
|
Programming Guru
![]() |
*gives uni lecturer obfuscated c code*
*uni lecturer fails code due to not understanding it* *i cry*
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity." - Albert Einstein |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|