[ale] Py[h]hon syntax (sic)

Fletch fletch at phydeaux.org
Sat Jan 29 11:00:42 EST 2005


>>>>> "Christopher" == Christopher Fowler <cfowler at outpostsentinel.com> writes:

Oop, I missed this the other day . . .

[...]

    Christopher> I read in the O'reilly book "Learning Python" that
    Christopher> the code can be compiled into a .pyc file.  How do I
    Christopher> compile into .pyc so that I can distribute the code
    Christopher> without the source being seen?  This is one of my
    Christopher> biggest problems with Perl.

Python bytecode's not going to prevent anyone from mucking with things
any more than compiling Java to bytecode does (or C to machine code
for that matter).  If someone's determined enough they'll be able to
recover pretty near the original source.


Having said that, if you want to raise the bar to discourage casual
mucking for Perl see perldoc B::Byetcode (although it's still pretty
experimental), PAR (which will wrap everything up into an executable
with an embedded zip archive), or one of the obfuscation filters (the
original Acme::Bleach, the somewhat repetitive Acme::Buffy, or the
swiss army chainsaw of source obfuscation Acme::EyeDrops) from CPAN.
Acme::EyeDrops comes with a script that'll easily let you turn:

#!/usr/bin/perl
print "Hello world\n";


Into this (yes, this is valid perl; not that that's going to surprise the
python people much . . . :)

#!/usr/bin/perl
                                      ''=~('('.'?'
           .'{'.(                   '`'|'%').("\["^
        '-').('`'|                '!').('`'|',').'"'
 .'#'."\!".  "\/".(              '['^'.').('['^'(').(
'['^')').'/'.(('`')|            '"').('`'|')').(('`')|
'.').'/'.('['^"\+").(          '`'|'%').('['^')').('`'
  |',').('!'^('+')).(        '!'^'+').('['^'+').(('[')^
       ')').('`'|')')      .('`'|'.').('['^'/').('{'^'['
      ).'\\'.('"').(     '`'^'(').('`'|'%').('`'|(',')).(
     '`'|',').("\`"|   '/').('{'^'[').('['^',').('`'|'/').
    ('['^')').('`'|   ',').('`'|'$').'\\'.'\\'.('`'|'.').''.
    '\\'.'"'."\;".(  '!'^'+').('!'^'+').('`'|'%').('['^'#').(
    '`'|')').('['^  '/').('{'^'[').('^'^('`'|'.')).';'.("\!"^
    '+').('!'^'+')  .'"'.'}'.')');$:='.'^'~';$~='@'|'(';$^=')'
    ^'[';$/='`'|'.';$,='('^'}';$\='`'|'!';$:=')'^'}';$~=('*')|
    '`';$^='+'^'_';$/='&'|'@';$,='['&'~';$\=','^'|';$:='.'^'~';
     $~='@'|'(';$^=')'^'[';$/='`'|'.';$,='('^'}';$\='`'|'!';$:=
     ')'^'}';$~='*'|'`';$^='+'^'_';$/='&'|'@';$,='['&'~';$\=','^
      '|';$:='.'^'~';$~='@'|'(';$^=')'^'[';$/='`'|'.';$,='('^'}';
       $\='`'|'!';$:=')'^'}';$~='*'|'`';$^='+'^'_';$/='&'|'@';$,=
        '['&'~';$\=','^'|';$:='.'^'~';$~='@'|'(';$^=')'^"\["; $/=
         '`'|'.';$,='('^'}';$\='`'|'!';$:=')'^'}';$~='*'|'`'  ;$^
          ='+'^'_';$/='&'|'@';$,='['&'~';$\=','^'|' ;$:='.'^  '~'
            ;$~='@'|'(';$^=')'^'[';$/='`'|"\.";$,=  '('^'}'   ;$\
             ='`'| '!';$:=')'^'}';$~='*'|"\`";$^=   '+'^'_'   ;$/
                   ='&'|'@';$,='['&'~';$\=(',')^    '|';$:=   '.'
                   ^'~';$~=    '@'|'(';$^ ="\)"^     '[';$/   =(
                   ('`'))|     "\.";$,=   ('(')^     '}';$\  =(
                   ('`'))|     "\!";$:=   "\)"^       "\}";  (
                   ($~))=      '*'|'`';   ($^)         ='+'
                   ^"\_";     $/=('&')|   '@';         ($,)
                    ='['&     "\~";$\=    ','^         '|';
                    ($:)=     '.'^'~'     ;$~=         '@'|
                    '(';     $^=')'       ^'['         ;$/=
                    '`'|     '.'          ;$,=         '('^
                    '}';      $\=         '`'          |((
                    '!'        ));       $:=           ')'
                    ^((         '}'     ));            $~=
                    '*'          |((   '`'              ))
                    ;(             ($^))=               ((
                    ((              '+'))               ))
                    ^+             "\_";$/=             ((
                   '&'            ))|+ "\@";            $,
                  =((           '['))&  '~';           $\=
                 ','^         "\|";$:=   '.'          ^'~'
               ;($~)=                                ('@')|
             "\(";$^=                               ')'^'['


__END__

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org|  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=
                      |                                               U



More information about the Ale mailing list