home *** CD-ROM | disk | FTP | other *** search
- Subject: v15i110: International Obfuscated C Code Contest, Part06/07
- Newsgroups: comp.sources.unix
- Sender: sources
- Approved: rsalz@uunet.UU.NET
-
- Submitted-by: Landon Curt Noll <chongo@uts.amdahl.com>
- Posting-number: Volume 15, Issue 110
- Archive-name: ioccc/part06
-
- # This is a shell archive. Remove anything before this line, then
- # unpack it by saving it in a file and typing "sh file". (Files
- # unpacked will be owned by you and have default permissions.)
- #
- # This archive contains:
- #
- # ./1987/Makefile ./1987/README ./1987/biggar.c ./1987/biggar.hint
- # ./1987/heckbert.c ./1987/heckbert.hint ./1987/hines.c ./1987/hines.hint
- # ./1987/korn.c ./1987/korn.hint ./1987/lievaart.c ./1987/lievaart.hint
- # ./1987/lievaart2.c ./1987/rules ./1987/wall.c ./1987/wall.hint
- # ./1987/westley.c ./1987/westley.hint
-
- echo x - ./1987/Makefile
- sed -e 's/^X//' > "./1987/Makefile" << '//E*O*F ./1987/Makefile//'
- X# %W% %G% %U%
- X#
- X# 1987 makefile
- X
- XSHELL=/bin/sh
- XWINNERS=heckbert wall westley hines korn biggar lievaart lievaart2
- X
- X# for System V style systems
- XOPSYS=-Dindex=strchr
- X# for BSD style systems
- X#OPSYS=
- X
- Xall: ${WINNERS}
- X
- Xheckbert: heckbert.c
- X cc ${OPSYS} $? -o $@
- Xwall: wall.c
- X cc $? -o $@
- Xwestley: westley.c
- X cc $? -o $@
- Xhines: hines.c
- X cc $? -o $@
- Xkorn: korn.c
- X cc $? -o $@
- Xbiggar: biggar.c
- X cc -DC="R>0" -DI="if(T)O" -DO="c=write(1,&c,1);" \
- X -DP="main(){X}" -DR="read(0,&c,1)" -DT="c!=015" \
- X -DW="while(C)I" -DX="char c;W" $? -o $@
- Xlievaart: lievaart.c
- X cc $? -o $@
- X# not an official entry
- Xlievaart2: lievaart2.c
- X cc $? -o $@
- X
- Xclean:
- X rm -f core
- Xclobber: clean
- X rm -f ${WINNERS}
- Xinstall: all
- X @echo are you kidding'??'
- //E*O*F ./1987/Makefile//
-
- echo x - ./1987/README
- sed -e 's/^X//' > "./1987/README" << '//E*O*F ./1987/README//'
- X1987 marked the "The Fourth International Obfuscated C Code Contest"
- X
- XThe rules for 1987 suggested even more categories than in 1986. Hints
- Xfor what to do and not to do were also given in the rules. For
- Xexample, a simple excessive abuse of /lib/cpp was discouraged unless
- Xthe abuse was unusual. The mailboxes for the contest were moved from
- Xnsc to amdahl. The practice of posting a preliminary set of rules for
- Xthe next year was started this year.
- X
- XRules and results were posted to comp.lang.c, comp.unix.wizards with
- Xan announcement in news.announce.important. Micro/Systems Journal
- Xpublished the 1987 winners. Mark Horton included a version of the 1987
- Xwinners in an appendix of his C book. The first announcement of
- Xwinners at the Summer 87 Usenix was helped by a small fly that
- Xdanced all over the foils.
- //E*O*F ./1987/README//
-
- echo x - ./1987/biggar.c
- sed -e 's/^X//' > "./1987/biggar.c" << '//E*O*F ./1987/biggar.c//'
- XP;
- //E*O*F ./1987/biggar.c//
-
- echo x - ./1987/biggar.hint
- sed -e 's/^X//' > "./1987/biggar.hint" << '//E*O*F ./1987/biggar.hint//'
- XBest Abuse of the Rules: <sdcrdcf!markb> Mark Biggar
- X
- X Mark Biggar
- X UNiSYS - System Development Group, Santa Monica
- X 2525 Colorado AV MD 91-01
- X Santa Monica, CA
- X 90406
- X
- XCompile with:
- X
- X cc -DC="R>0" -DI="if(T)O" -DO="c=write(1,&c,1);" -DP="main(){X}"\
- X -DR="read(0,&c,1)" -DT="c!=015" -DW="while(C)I" -DX="char c;W" markb.c
- X
- XPasses BSD and UTS lint. At least one version of lint is thrown into
- Xan infinite loop by this entry.
- X
- XTry: ... | markb | od -c (remember to compile as indicated above)
- X
- XBy changing the compile line you can make this program do anything you
- Xwant. This is a very efficient way to transfer source, though it
- Xincreases the size of Makefiles.
- X
- XWith only slight variations, this program can be set to many uses.
- XConsider how easy it would be to release Un*x source in this form;
- Xso what if the make files grow a little! :-)
- X
- XOne vendor's lint got hung in an infinite loop over this entry!
- X
- XFYI: We will let Mark get away with this truly sick entry this time, but
- X for the future on we have placed a limit on the size of a compile line.
- X
- XAlso see our comment in Larry Wall's entry regarding Mark's contribution.
- //E*O*F ./1987/biggar.hint//
-
- echo x - ./1987/heckbert.c
- sed -e 's/^X//' > "./1987/heckbert.c" << '//E*O*F ./1987/heckbert.c//'
- X#include <ctype.h>
- X#include <stdio.h>
- X#define _ define
- X#_ A putchar
- X#_ B return
- X#_ C index
- Xchar*r,c[300001],*d=">=<=!===||&&->++-->><<",*i,*l,*j,*m,*k,*n,*h,*y;e,u=1,v,w,
- Xf=1,p,s,x;main(a,b)char**b;{p=a>1?atoi(b[1]):79;r=c+read(0,j=l=i=c,300000);v=g(
- Xj,&m);for(k=m;v!=2;j=k,m=n,v=w,k=m){w=g(k,&n);if(v==1&&m-j==1&&*j==35)e&&A(10),
- Xe=f=0;if(!f&&v==3&&(char*)C(j,10)<m)A(10),e=0,f=1;else if(v>2&&(u||w)&&(f||u)&&
- X(l-i>1||*i!=61||n-k>1||!C("-*&",*k)))continue;else if(v==3)if(f&&e+1+n-k>p&&e)A
- X(10),e=0;else A(32),e++;else{if(f&&e+m-j>p&&e)A(10),e=0;e+=m-j;k=j;while(k<m)A(
- X*k++);}i=j;l=m;u=v;}e&&A(10);}g(j,m)char*j,**m;{if(j>=r)B*m=j,2;s=isdigit(*j)||
- X*j==46&&isdigit(j[1]);for(h=j;h<r;h++)if(!isalnum(*h)&&*h!=95&&(!s||*h!=46)&&(!
- Xs||h[-1]!=101&&h[-1]!=69||!C("+-",*h)))break;if(h>j)B*m=h,0;x=1;for(h=j;h<r&&C(
- X" \t\n",*h);h++);if(h>j)h--,x=3;if(*j==34||*j==39)for(h=j+1;h<r&&*h!=*j;h++)if(
- X*h==92)h++;for(y=d;*y&&strncmp(y,j,2);y+=2);if(*y)h=j+1;if(!strncmp("/*",j,2)){
- Xh=j+2;while(*++h!=42||*++h!=47);x=4;}*m=h+1;B x;}
- //E*O*F ./1987/heckbert.c//
-
- echo x - ./1987/heckbert.hint
- sed -e 's/^X//' > "./1987/heckbert.hint" << '//E*O*F ./1987/heckbert.hint//'
- XBest Obfuscator of Programs: <pixar!ph> Paul Heckbert
- X
- X Paul Heckbert
- X Pixar
- X
- XTry: ph 40 < ph.c > foo.c; cc foo.c -o ph
- X ph 20 < a_C_prog.c > bar.c; cc bar.c
- X
- XThe judges used this program to fold up very long lines which the
- XBSD fold(1) was unable to process. This program has been added
- Xto the contest tool chest.
- X
- XOn System V systems, compile with: -Dindex=strchr.
- XTo compile on a 16 bit machine, change 300000's to 30000.
- //E*O*F ./1987/heckbert.hint//
-
- echo x - ./1987/hines.c
- sed -e 's/^X//' > "./1987/hines.c" << '//E*O*F ./1987/hines.c//'
- X#include <stdio.h>
- X#include <malloc.h>
- Xmain(togo,toog)
- Xint togo;
- Xchar *toog[];
- X{char *ogto, tgoo[80];FILE *ogot; int oogt=0, ootg, otog=79,
- Xottg=1;if ( togo== ottg) goto gogo; goto goog; ggot:
- Xif ( fgets( tgoo, otog, ogot)) goto gtgo; goto gott;
- Xgtot: exit(); ogtg: ++oogt; goto ogoo; togg: if ( ootg > 0)
- Xgoto oggt; goto ggot; ogog: if ( !ogot) goto gogo;
- Xgoto ggto; gtto: printf( "%d goto \'s\n", oogt); goto
- Xgtot; oggt: if ( !memcmp( ogto, "goto", 4)) goto otgg;
- Xgoto gooo; gogo: exit( ottg); tggo: ootg= strlen(tgoo);
- Xgoto tgog; oogo: --ootg; goto togg; gooo: ++ogto; goto
- Xoogo; gott: fclose( ogot); goto gtto; otgg: ogto= ogto +3;
- Xgoto ogtg; tgog: ootg-=4;goto togg; gtgo: ogto= tgoo;
- Xgoto tggo; ogoo: ootg-=3;goto gooo; goog: ogot= fopen(
- Xtoog[ ottg], "r"); goto ogog; ggto: ogto= tgoo; goto
- Xggot;}
- //E*O*F ./1987/hines.c//
-
- echo x - ./1987/hines.hint
- sed -e 's/^X//' > "./1987/hines.hint" << '//E*O*F ./1987/hines.hint//'
- XWorst Style: <grebyn!avalon> Spencer Hines
- X
- X Spencer Hines
- X OnLine Computer Systems
- X 4200 Farragut Street
- X Hyattsville, MD
- X 20781
- X USA
- X
- XTry: avalon avalon.c
- X
- XThis program was designed to maximize the bother function for
- Xstructured programmers. This program takes goto statements to their
- Xlogical conclusion. The layout and choice of names are classic.
- X
- XWe consider this to be a beautiful counter-example for Frank Rubin's
- Xletter to ACM form titled: `` "GOTO Considered Harmful" Considered Harmful ''.
- XSee the Communications of the ACM, March 1987, Page 195-196.
- //E*O*F ./1987/hines.hint//
-
- echo x - ./1987/korn.c
- sed -e 's/^X//' > "./1987/korn.c" << '//E*O*F ./1987/korn.c//'
- X main() { printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}
- //E*O*F ./1987/korn.c//
-
- echo x - ./1987/korn.hint
- sed -e 's/^X//' > "./1987/korn.hint" << '//E*O*F ./1987/korn.hint//'
- XBest One Liner: <ulysses!dgk> David Korn
- X
- X David Korn
- X AT&T Bell Labs
- X MH 3C-526B, AT&T Bell Labs
- X Murray Hill, NJ
- X 07974
- X USA
- X
- XThe Judges believe that this is the best one line entry ever received.
- XCompile on a UN*X system, or at least using a C implementation that
- Xfakes it. Very few people are able to determine what this program
- Xdoes by visual inspection. I suggest that you stop reading this
- Xsection right now and see if you are one of the few people who can.
- X
- XSeveral points are important to understand in this program:
- X
- X 1) What is the symbol `unix' and what is its value in the program?
- X Clearly `unix' is not a function, and since `unix' is not declared
- X to be a data type (such as int, char, struct foo, enum, ...)
- X what must `unix' be?
- X
- X 2) What is the value of the symbol "have"? (hint: the value is
- X NOT 4 characters, or 'h', or a string) Consider the fact that:
- X
- X char *x;
- X
- X defines a pointer to a character (i.e. an address), and that
- X the `=' assigns things is compatible types. Since:
- X
- X x = "have";
- X
- X is legal C, what type of value is "have"?
- X
- X 3) Note that the following expressions yield the same value:
- X
- X x[3] *(x+3) *(3+x)
- X
- X since addition is communitive. What can be said about the value:
- X
- X 3[x]
- X
- XDavid Korn's /bin/ksh provides us with a greatly improved version of
- Xthe /bin/sh. The source for v7's /bin/sh greatly inspired this contest.
- //E*O*F ./1987/korn.hint//
-
- echo x - ./1987/lievaart.c
- sed -e 's/^X//' > "./1987/lievaart.c" << '//E*O*F ./1987/lievaart.c//'
- X#define D define
- X#D Y return
- X#D R for
- X#D e while
- X#D I printf
- X#D l int
- X#D C y=v+111;H(x,v)*y++= *x
- X#D H(a,b)R(a=b+11;a<b+89;a++)
- X#D s(a)t=scanf("%d",&a)
- Xl V[1100],u,r[]={-1,-11,-10,-9,1,11,10,9},h[]={11,18,81,88},ih[]={22,27,72,77},
- Xbz,lv=60,*x,*y,m,t;S(d,v,f,a,b)l*v;{l c=0,*n=v+100,bw=d<u-1?a:-9000,w,z,i,zb,q=
- X3-f;if(d>u){R(w=i=0;i<4;i++)w+=(m=v[h[i]])==f?300:m==q?-300:(t=v[ih[i]])==f?-50
- X:t==q?50:0;return w;}H(z,0){if(GZ(v,z,f,100)){c++;w= -S(d+1,n,q,-b,-bw);if(w>bw
- X){zb=z;bw=w;if(w>=b||w>=8003)Y w;}}}if(!c){bz=0;C;Y-S(d+1,n,q,-b,-bw);}bz=zb;Y
- Xd>=u-1?bw+(c<<3):bw;}main(){R(;t<1100;t+=100)R(m=0;m<100;m++)V[t+m]=m<11||m>88
- X||(m+1)%10<2?3:0;V[44]=V[55]=1;V[45]=V[54]=2;I("Level:");s(u);e(lv>0){do{I("Yo\
- Xu:");s(m);}e(!GZ(V,m,2,0)&&m!=99);if(m!=99)lv--;if(lv<15&&u<10)u+=2;I("Wait\n")
- X;I("Value:%d\n",S(0,V,1,-9000,9000));I("move: %d\n",(lv-=GZ(V,bz,1,0),bz));}}GZ
- X(v,z,f,o)l*v;{l*j,q=3-f,g=0,i,h,*k=v+z;if(*k==0)R(i=7;i>=0;i--){j=k+(h=r[i]);e(
- X*j==q)j+=h;if(*j==f&&j-h!=k){if(!g){g=1;C;}e(j!=k)*((j-=h)+o)=f;}}Y g;}
- //E*O*F ./1987/lievaart.c//
-
- echo x - ./1987/lievaart.hint
- sed -e 's/^X//' > "./1987/lievaart.hint" << '//E*O*F ./1987/lievaart.hint//'
- XGrand Prize: <botter!rblieva> Roemer B. Lievaart
- X
- X Roemer B. Lievaart
- X VU Informatica
- X Churchilllaan 173-IV
- X Amsterdam, The Netherlands
- X
- XWe believe that you too will be amazed at just how much power Mr. Lievaart
- Xpacked into 1024 bytes!
- X
- XThis Plays the game of reversi (Othello)! Compile and run. It then
- Xasks for a playing level. Enter 0-10 (easy-hard). It then asks for
- Xyour move. A move is a number within 11-88, or a 99 to pass. Illegal
- Xmoves (except for an illegal pass) are rejected. Then the computer
- Xdoes its move (or a 0 to pass), until the board is full. It plays
- Xrather well, for such a small program! Lievaart had to leave out the
- Xboard printing routine, so you'll have to take a real game board to
- Xplay it. ... Also due to space-limitations (the rules for 1987 had a
- Xlimit of 1024 byes), Lievaart took out the passing-handler, which
- Xmakes its ending-game rather poor. But further it knows all the
- Xrules, uses alpha-beta pruning, and it plays f.i. on mobility(!).
- XMost important: it can play a pretty good game of Reversi!
- X
- XThe Author was kind enough to supply the fully functional version of the
- Xprogram. The file lievaart2.c contains what the program would have
- Xbeen without the size restriction. This version has the full end game
- Xlogic and displays the board after each move!
- //E*O*F ./1987/lievaart.hint//
-
- echo x - ./1987/lievaart2.c
- sed -e 's/^X//' > "./1987/lievaart2.c" << '//E*O*F ./1987/lievaart2.c//'
- X#define D define
- X#D Y return
- X#D R for
- X#D e while
- X#D I printf
- X#D l int
- X#D W if
- X#D C y=v+111;H(x,v)*y++= *x
- X#D H(a,b)R(a=b+11;a<b+89;a++)
- X#D s(a)t=scanf("%d",&a)
- X#D U Z I
- X#D Z I("123\
- X45678\n");H(x,V){putchar(".XO"[*x]);W((x-V)%10==8){x+=2;I("%d\n",(x-V)/10-1);}}
- Xl V[1600],u,r[]={-1,-11,-10,-9,1,11,10,9},h[]={11,18,81,88},ih[]={22,27,72,77},
- Xbz,lv=60,*x,*y,m,t;S(d,v,f,_,a,b)l*v;{l c=0,*n=v+100,j=d<u-1?a:-9000,w,z,i,g,q=
- X3-f;W(d>u){R(w=i=0;i<4;i++)w+=(m=v[h[i]])==f?300:m==q?-300:(t=v[ih[i]])==f?-50:
- Xt==q?50:0;Y w;}H(z,0){W(E(v,z,f,100)){c++;w= -S(d+1,n,q,0,-b,-j);W(w>j){g=bz=z;
- Xj=w;W(w>=b||w>=8003)Y w;}}}W(!c){g=0;W(_){H(x,v)c+= *x==f?1:*x==3-f?-1:0;Y c>0?
- X8000+c:c-8000;}C;j= -S(d+1,n,q,1,-b,-j);}bz=g;Y d>=u-1?j+(c<<3):j;}main(){R(;t<
- X1600;t+=100)R(m=0;m<100;m++)V[t+m]=m<11||m>88||(m+1)%10<2?3:0;I("Level:");V[44]
- X=V[55]=1;V[45]=V[54]=2;s(u);e(lv>0){Z do{I("You:");s(m);}e(!E(V,m,2,0)&&m!=99);
- XW(m!=99)lv--;W(lv<15&&u<10)u+=2;U("Wait\n");I("Value:%d\n",S(0,V,1,0,-9000,9000
- X));I("move: %d\n",(lv-=E(V,bz,1,0),bz));}}E(v,z,f,o)l*v;{l*j,q=3-f,g=0,i,w,*k=v
- X+z;W(*k==0)R(i=7;i>=0;i--){j=k+(w=r[i]);e(*j==q)j+=w;W(*j==f&&j-w!=k){W(!g){g=1
- X;C;}e(j!=k)*((j-=w)+o)=f;}}Y g;}
- //E*O*F ./1987/lievaart2.c//
-
- echo x - ./1987/rules
- sed -e 's/^X//' > "./1987/rules" << '//E*O*F ./1987/rules//'
- XWARNING: The rules and mailing address for the contest change from year
- X to year. Be sure that you consult the current set of rules
- X before submitting entries.
- X------------------------------------------------------------------------------
- X
- XSubject: 4th International Obfuscated C Code Contest Rules
- XNewsgroups: comp.lang.c,comp.unix.wizards
- XKeywords: rules,1987,obfuscate,contest
- X
- XGOALS OF THE CONTEST:
- X
- X * To write the most Obscure/Obfuscated C program under the rules below.
- X * To show what should NOT be done in C programs.
- X * To provide a safe forum for poor C code. :-)
- X
- XRULES:
- X 1) The source must be 1024 characters long or less. NO EXCEPTIONS!
- X
- X 2) To help us process your entries, we ask that you submit entries
- X in the following format: (please include the --- lines)
- X
- X---start of header items---
- Xname:
- Xorg:
- Xemail address:
- Xpostal address:
- Xenvironment:
- Xremarks:
- X---start of entry---
- XX <place obfuscated source of 1024 characters or less here>
- XX <add a leading X to each line to avoid problems with mailers>
- XX <leading X's do not count toward the source character count>
- XX <the first X of each source line will be removed prior to compilation>
- XX <newlines count as 1 character>
- XX <assume a standard 8 character tab stop>
- X---end of entry---
- X
- X 3) Regarding the header items:
- X
- X * All header items except 'remark' are optional. If you do not
- X wish to answer an item, indicate so by the string: ***NONE***
- X Any text outside of the above format will be kept confidential.
- X
- X * You can remain anonymous. If the name item is: ***ANONYMOUS***
- X all items except the 'remarks' item will not be relased.
- X
- X * Indicate the name of your Company or School in the 'org' item.
- X
- X * The 'email address' item asks for a network path from a major
- X site (such as amdahl) to your mailbox.
- X
- X * If you give a 'postal address', please include your Country.
- X
- X * Give the machine and operating system (i.e., Un*x version) on
- X which your program ran.
- X
- X * The 'remarks' item is not optional. Please indicate:
- X - how to execute or compile if something special is required
- X - type of input or argument needed, if applicable
- X - what this program does
- X - any other remarks you wish to make
- X
- X * If you need more than one line on a header item, place
- X tab or space characters at the beginning of each additional line.
- X
- X 4) The entry should be written in a common C. (K&R + common extensions)
- X
- X 5) The program must be of original work. All programs must be
- X in the public domain. All copyrighted programs will be rejected.
- X
- X 6) Entries must be received before 30-May-87 0:00 GMT.
- X Email your entries to:
- X
- X ...!amdahl!obfuscate
- X
- X Amdahl talks to hplabs, decwrl, pyramid, seismo and cbosgd.
- X We will attempt to Email a confirmation of receipt of contest
- X entries, however since Email is not reliable you may not receive it.
- X People are encouraged to submit entries via Email, however
- X one may mail entries the following postal address:
- X
- X Landon Curt Noll
- X Amdahl Corp.
- X 1250 E. Arques Ave. M/S 316
- X P.O. Box 3470
- X Sunnyvale, CA
- X 94088-3470
- X U.S.A.
- X
- X Write the words: "International Obfuscated C Code Contest" near the
- X bottom left corner of the envelope.
- X
- X 8) Contest entries sent in by post should indicate where TAB characters
- X are to be placed, otherwise space characters will be assumed. Each
- X line will be assumed to contain a newline character. The leading
- X 'X' will serve to indicate where each source line starts.
- X
- X 9) Each person may submit up to 5 entries. Multiple entries must
- X be sent in separate Email letters or postal envelopes.
- X
- X 10) People are encouraged to examine winners of the previous
- X contests. A copy of these entries was posted to mod.sources
- X on or about 12-Mar-87. Contact the mod.sources moderator
- X if you missed that article. Keep in mind that rules change from
- X year to year, so some winning entries may not be valid
- X entries this year. Also what was unique and novel one
- X year can get 'old' the next year.
- X
- X
- XANNOUNCEMENT OF WINNERS:
- X
- X * First announcement will be at the Summer 87 Usenix BOF.
- X
- X * An announcement will be posted to mod.announce near
- X mid June 1987 stating to which newsgroup the winners
- X have been posted.
- X
- X * An article containing the winning entries will be published
- X in a future issue of the "Micro/Systems Journal".
- X
- X * Winners receive international fame and flames! :-)
- X
- X
- XJUDGING:
- X Awards will be given to the best entry in a number of categories.
- X The actual category list will vary depending on the types of entries
- X we receive. At the moment, we are considering using the following:
- X
- X * The best small one line program
- X * The most obscure algorithm
- X * The worst abuse of the C preprocessor (note warnings below)
- X * The strangest source layout
- X * The most useful obfuscated program
- X * <anything else so strange that it deserves an award>
- X
- X Extra points will be given for programs which:
- X
- X * pass lint without complaint
- X * do something quasi-interesting
- X * are portable
- X * are unique in their obfuscation style
- X * are concise
- X
- X Points will be taken away for programs that:
- X
- X * are very hardware or Un*x version specific
- X * dump core or have compiler warnings
- X (we won't take points away if you warn us in the remark item)
- X * fail to compile
- X * obfuscate only by overuse of #defines
- X (you should do this ONLY if your use is unusual)
- X * are similar to previous winners
- X * are similar to previous losers :-)
- X
- X The Judging will be done by Landon Noll and Larry Bassel.
- X Comments & questions (not entries) about the contest can be Emailed to:
- X
- X ...!amdahl!judges
- X
- Xchongo <Landon Curt Noll> /\cc/\
- XLarry Bassel
- //E*O*F ./1987/rules//
-
- echo x - ./1987/wall.c
- sed -e 's/^X//' > "./1987/wall.c" << '//E*O*F ./1987/wall.c//'
- X#define iv 4
- X#define v ;(void
- X#define XI(xi)int xi[iv*'V'];
- X#define L(c,l,i)c(){d(l);m(i);}
- X#include <stdio.h>
- Xint*cc,c,i,ix='\t',exit(),X='\n'*'\d';XI(VI)XI(xi)extern(*vi[])(),(*
- Xsignal())();char*V,cm,D['x'],M='\n',I,*gets();L(MV,V,(c+='d',ix))m(x){v)
- Xsignal(X/'I',vi[x]);}d(x)char*x;{v)write(i,x,i);}L(MC,V,M+I)xv(){c>=i?m(
- Xc/M/M+M):(d(&M),m(cm));}L(mi,V+cm,M)L(md,V,M)MM(){c=c*M%X;V-=cm;m(ix);}
- XLXX(){gets(D)||(vi[iv])();c=atoi(D);while(c>=X){c-=X;d("m");}V="ivxlcdm"
- X+iv;m(ix);}LV(){c-=c;while((i=cc[*D=getchar()])>-I)i?(c?(c<i&&l(-c-c,
- X"%d"),l(i,"+%d")):l(i,"(%d")):(c&&l(M,")"),l(*D,"%c")),c=i;c&&l(X,")"),l
- X(-i,"%c");m(iv-!(i&I));}L(ml,V,'\f')li(){m(cm+!isatty(i=I));}ii(){m(c=cm
- X= ++I)v)pipe(VI);cc=xi+cm++;for(V="jWYmDEnX";*V;V++)xi[*V^' ']=c,xi[*V++]
- X=c,c*=M,xi[*V^' ']=xi[*V]=c>>I;cc[-I]-=ix v)close(*VI);cc[M]-=M;}main(){
- X(*vi)();for(;v)write(VI[I],V,M));}l(xl,lx)char*lx;{v)printf(lx,xl)v)
- Xfflush(stdout);}L(xx,V+I,(c-=X/cm,ix))int(*vi[])()={ii,li,LXX,LV,exit,l,
- Xd,l,d,xv,MM,md,MC,ml,MV,xx,xx,xx,xx,MV,mi};
- //E*O*F ./1987/wall.c//
-
- echo x - ./1987/wall.hint
- sed -e 's/^X//' > "./1987/wall.hint" << '//E*O*F ./1987/wall.hint//'
- XMost Useful Obfuscation: <sdcrdcf!lwall> Larry Wall
- X
- X Larry Wall
- X Unisys - System Development Group Santa Monica
- X 9132 Kester Ave
- X Panorama City, CA 91402 USA
- X
- XTry: lwall | bc | lwall
- Xinput: x*x
- Xinput: c^2
- X
- XAlso try: lwall | bc and lwall | cat
- X
- XWhat we found amazing was how the flow of control was transferred
- Xbetween subroutines. Careful inspection will show that the array of
- Xpointers to functions named `vi' refers to functions which seem to not
- Xbe directly called. Even so, these pointers to functions are being
- Xused as an argument to signal. Can you determine why this is being
- Xdone and how it is being exploited?
- X
- XSome compilers complained about this file, so we changed: '=++I' to '= ++I'.
- //E*O*F ./1987/wall.hint//
-
- echo x - ./1987/westley.c
- sed -e 's/^X//' > "./1987/westley.c" << '//E*O*F ./1987/westley.c//'
- X char rahc
- X [ ]
- X =
- X "\n/"
- X ,
- X redivider
- X [ ]
- X =
- X "Able was I ere I saw elbA"
- X ,
- X *
- X deliver,reviled
- X =
- X 1+1
- X ,
- X niam ; main
- X ( )
- X {/*\}
- X \*/
- X int tni
- X =
- X 0x0
- X ,
- X rahctup,putchar
- X ( )
- X ,LACEDx0 = 0xDECAL,
- X rof ; for
- X (;(int) (tni);)
- X (int) (tni)
- X = reviled ; deliver =
- X redivider
- X ;
- Xfor ((int)(tni)++,++reviled;reviled* *deliver;deliver++,++(int)(tni)) rof
- X =
- X (int) -1- (tni)
- X ;reviled--;--deliver;
- X (tni) = (int)
- X - 0xDECAL + LACEDx0 -
- X rof ; for
- X (reviled--,(int)--(tni);(int) (tni);(int)--(tni),--deliver)
- X rahctup = putchar
- X (reviled* *deliver)
- X ;
- X rahctup * putchar
- X ((char) * (rahc))
- X ;
- X /*\
- X {\*/}
- //E*O*F ./1987/westley.c//
-
- echo x - ./1987/westley.hint
- sed -e 's/^X//' > "./1987/westley.hint" << '//E*O*F ./1987/westley.hint//'
- XBest Layout: <starfire!merlyn> Brian Westley
- X
- X Brian Westley (aka Merlyn Leroy on usenet)
- X Starfire Consulting
- X 1121 Hamline Ave. N. #17
- X St. Paul, MN
- X 55108
- X USA
- X
- XPutchar must exist in the C library and not just as a macro.
- XIf it fails to compile, add the line: #include <stdio.h> at the
- Xtop of the program.
- X
- XLine by line symmetry performed better than any C beautifier. Think
- Xof if it as a C ink blot. :-)
- //E*O*F ./1987/westley.hint//
-
- echo Possible errors detected by \'wc\' [hopefully none]:
- temp=/tmp/shar$$
- trap "rm -f $temp; exit" 0 1 2 3 15
- cat > $temp <<\!!!
- 40 112 726 Makefile
- 15 136 816 README
- 1 1 3 biggar.c
- 32 191 1141 biggar.hint
- 18 33 1021 heckbert.c
- 14 76 430 heckbert.hint
- 19 130 953 hines.c
- 18 82 565 hines.hint
- 1 3 70 korn.c
- 44 242 1401 korn.hint
- 20 44 1022 lievaart.c
- 27 224 1303 lievaart.hint
- 25 61 1175 lievaart2.c
- 161 917 5745 rules
- 18 30 1021 wall.c
- 21 120 708 wall.hint
- 48 93 908 westley.c
- 15 73 412 westley.hint
- 537 2568 19420 total
- !!!
- wc ./1987/Makefile ./1987/README ./1987/biggar.c ./1987/biggar.hint ./1987/heckbert.c ./1987/heckbert.hint ./1987/hines.c ./1987/hines.hint ./1987/korn.c ./1987/korn.hint ./1987/lievaart.c ./1987/lievaart.hint ./1987/lievaart2.c ./1987/rules ./1987/wall.c ./1987/wall.hint ./1987/westley.c ./1987/westley.hint | sed 's=[^ ]*/==' | diff -b $temp -
- exit 0
-
-