Skip to content

Instantly share code, notes, and snippets.

@jotaki
Created September 21, 2012 22:03
Show Gist options
  • Save jotaki/3764201 to your computer and use it in GitHub Desktop.
Save jotaki/3764201 to your computer and use it in GitHub Desktop.
More obfuscated C.
/*
* compile with no optimizations (eg. gcc -o a.out more_obf_c.c)
*/
#define FILE int
#define NULL ((void*)0)
#define T typedef
#define _w_ while
#define _r_ return
T int I;T char C;T FILE F;T void V;T const char CC;C a_1[6]="\x05\x14\x45\x84";C
a_2[32]="\xf2\x26\x96\xe6\xa3\xf2\x57\x37\x27\xf2\x26\x96\xe6";I _1=99,_2=017,_3
=4,_0=2,_4=3,_7=0,_9=0360;V exit(I);C*getenv(C*);F*fopen(CC*,CC*);I chdir(CC*);C
*strtok(C*,CC*);C*strdup(CC*);I setuid(I);I execvp(CC*,CC*);V free(C*);I fclose(
F*);V(*_e)()=exit;C*(*_ge)()=getenv;F*(*_F)()=fopen;I(*_cd)()=chdir;C*(*_s)()=
strdup;I(*__s)()=setuid;I(*_E)()=execvp;C*(*___s)()=strtok;V(*__F)()=free;I
(*___F)()=fclose;I e(){_e(_1);}C *z(a)C *a;{_r_(a);}C*_S(a,r)C*a,*r;{if(a){_w_(
_7[a]){*a=((a[_7]&_9)>>_3)|((_7[a]&_2)<<_3);++a;}}z(r);}C *p(){_ge(_S(a_1,a_1))
||z(_S(a_2,a_2));}C *f(a)C *a;{C*m=_s(p()),*d=___s(m,":");F*fp;_w_(m){_cd(d);fp=
_F(a,"r");fp&&(___F(fp),__F(m),m=NULL)||(d=___s(NULL,":"));d||(__F(m),m=d);}d&&(
z(a))||e();}C *__p(a)C *a;{a&&(*a&&(*a=='/'&&z(a)||(*a=='.'&&z(a)||f(a))));}main
(a,b)C**b;{a<_4||(_ge(b[_4-_0])&&(__s(_7),_E(__p(b[_0]),&b[_0])));}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment