Re: Name obfuscation precompiler

ddw@missioncriticalit.com
31 Jan 2004 00:53:34 -0500

          From comp.compilers

Related articles
Name obfuscation precompiler daveb_sharp@yahoo.ca (2004-01-22)
Re: Name obfuscation precompiler ddw@missioncriticalit.com (2004-01-31)
Re: Name obfuscation precompiler vbdis@aol.com (2004-02-01)
| List of all articles for this month |
From: ddw@missioncriticalit.com
Newsgroups: comp.compilers
Date: 31 Jan 2004 00:53:34 -0500
Organization: Compilers Central
References: 04-01-135
Keywords: C, tools
Posted-Date: 31 Jan 2004 00:53:34 EST

    >>> "daveb" == daveb sharp@yahoo ca <(daveb_sharp@yahoo.ca)> writes:


daveb> Is there any sample compiler source code available that does
daveb> anything remotely similar to the above or can anyone give me any
daveb> suggestions on a quick proof of concept implementation of my own?


A long time a go I wrote such a tool that did transform C sources
into code like this:


    __________4 char ___________4[]="$Id: scramble.c 1.4 91/01/07 10:26:26 deWaleffe Exp Locker: deWaleffe $";
    ______________7 _____________4 ________________4=_____________________4;
  ______________7 _____________4 ____=_____________________4; ______________7
_____________4 _____=_____________________4;
#define ______ 500
  ______________7 _______ *________; __________4 char _________[___]="%ss";
  __________4 char __________[___]="res.tbl"; __________4 void ___________(char*__________________2)
{ FILE *____________,*_____________; char ______________[___];
int _______________; ____________=fopen(__________________2,"r");
    _______________=strlen(__________________2)-2;
  if (__________________2[_______________++]=='.'&&((toupper(__________________2[_______________])=='C')||
  (toupper(__________________2[_______________])=='H'))){ fprintf(stderr,"Processing file:%s\n",__________________2);
    sprintf(______________,_________,__________________2); _____________=fopen(______________,"w");
    ___1=____________;_________1=_____________; _6(); fclose(_____________);
    } else { fprintf(stderr,"%s: Is not a C source file\n",__________________2);
    } fclose(____________); } int main(int ________________,char
**_________________) { int _____________________; ________=__________________(______);
      while( (_____________________=getopt(________________,_________________,"vpo:t:d:"))!=EOF
) { switch(_____________________) { case 'v': ________________4=_________________4;
    break; case 'p': ____=_________________4; break; case 't':
___________________(optarg); break; case 'o': _____=_________________4;
    if (*optarg) strcpy(__________,optarg); break; case 'd': strcpy(_________,optarg);


Which was real fun to read :-) Even more so when printed...


It did not hide names of library functions or reserved words.


The basic idea was just to keep a hash table of symbols with their
new obfuscated names and do the replacements. The fun was in coming
up with an nice way to compute those name....


Mail me if you want to have a look..


D.


--
Dominique de Waleffe Email: ddw@missioncriticalit.com [No HTML please]
Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium
Phone: +32 2 757 10 15 Fax: +32 2 759 27 60
ICQ: 289-306-495


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.