Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re^2: is it irreversible

by Anonymous Monk
on Mar 14, 2003 at 13:47 UTC ( #243030=note: print w/ replies, xml ) Need Help??


in reply to Re^2: is it irreversible
in thread Here is a commercial obfuscator

Won't work - it's terribly time-consuming and difficult since only perl can parse Perl. How do you plan to continue development (say there appeared a need in some new feature) after you've obfuscated you sources? :)


Comment on Re: Re^2: is it irreversible
Re: Re: Re^2: is it irreversible
by diotalevi (Canon) on Mar 14, 2003 at 13:53 UTC

    You don't think I'd obfuscate the sources I planned to distribute Edit [ work with ] do you? That'd be nuts. Anyhow, this would happen two ways - most of the time it doesn't matter that only the perl lexer/parser can completely parse perl. If the source is written correctly the first time then its trivial to do the first two of the major obfuscations - symbol renaming and text string encoding. I think that if I were serious about having "obfuscated code" I'd hack up B::Deparse (exempting BEGIN blocks which would have to be done by hand or another method) so that it did all the work for me anyhow which alleviates all the problems you've described.


    Seeking Green geeks in Minnesota

      Usually after release of 1.0 version some versions come after. So you'll have to repeat this obfuscation process for each version. Parsing perl is needed because you have to destinguish sub names and same words inside string constants or regexps (e.g. "sub communicate {}" and "print q!unable to communicate!;"). Yes, the only viable solution is writing something similar to or hacking B::Deparse.

        Actually I was thinking of something like ^sub\s+(\w+) but yes, we both have valid points here. Anyway, the free obfuscator posted yesterday appears to nearly as functional as this 1K/2K thing you linked to.


        Seeking Green geeks in Minnesota

Re: is it irreversible
by jonadab (Parson) on Mar 31, 2003 at 04:47 UTC
    it's terribly time-consuming and difficult since only perl can parse Perl

    cperl-mode comes darn close. I've seen it fooled a couple of times, but it's very rare. Almost all of the Obfuscated Perl Competition winners are correctly syntax-highlighted by cperl-mode, and excepting some disagreement between it and me about the correct indentation of lines that start with the catenation operator (I want subsequent ones to line up, and it indents each one further than the previous), automatically indented as well.

    cperl-mode, for those who don't know, is written in lisp, of course, and comes with Emacs.


    for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc' .'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$ p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}

      cperl-mode is easily confused. Or at least it has been many times when I've preferred it wasn't. Its certainly no panacea though it should handle all the output from all of the recently mentioned obfuscators just fine.

        cperl-mode is easily confused.

        Yes, I've seen it confused a couple of times, as I said, by obfuscations of one sort or another. But it's not confused by anything that would normally be done in code intended for real use. If an automatic obfuscator wanted to confuse it, I think it would have to do so deliberately, or else be really clever in general -- much more clever than substituting variable names and removing spaces.


        for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc' .'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$ p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://243030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (14)
As of 2014-10-23 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls