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

Automatic Perl Obfuscation

by madCow (Initiate)
on Oct 23, 2000 at 17:58 UTC ( #37904=obfuscated: print w/replies, xml ) Need Help??

Can anyone point me at a Perl Obfuscator?
--
paraniod code monkey!

Replies are listed 'Best First'.
(bbq) RE: Automatic Perl Obfuscation
by BBQ (Deacon) on Oct 23, 2000 at 19:26 UTC
    I would imagine that someone has already written one "just for the kicks" of it, but IMHO it is much more fun to write obfuscations that to read them. As a matter of fact, de-obfuscating someone's code is usually much easier that writting yours from scratch. Why would you want the fun part automized??

    #!/home/bbq/bin/perl
    # Trust no1!
      You know, obfuscated code that obfuscates code using a couple of the "standard" obfuscations could be rather fun.

      Especially if done with style, such as not using any of the obfucations that it uses in itself to obfuscate it's code, or perhaps reading itself to help obfuscate.

      Way beyond me, but interesting.

      =Blue
      ...you might be eaten by a grue...

(Ovid) RE: Automatic Perl Obfuscation
by Ovid (Cardinal) on Oct 24, 2000 at 19:57 UTC
    I assume you're not wanting this to enter any obfuscation contests. I would be astonished if an automatic obfuscator could win -- oh, wait, they call that C, right? :)

    If you just want this for playing around, BBQ has the right idea. It's much more fun (and instructive) to do this yourself. However, if you're one of those "security by obscurity" types (I certainly hope not!), you could try a simple method that I've seen routinely applied to JavaScript: convert all variables and sub names to random strings.

    To be fair, it might be an impossible job to automate for any but the most simple scripts, but I would probably start by grabbing all variables in a package and grouping them by typeglobs. Then apply a new, random name to all members of the typeglob. Then you'd have to look at lexical and dynamic variables. You'd have to use strict (can you imagine some poor fool using variables for variable names and trying to get this scheme to work?).

    Hmm... you'd also have to do that for sub names. And you've have to ensure that you're not changing anything that's imported into the script. Oy, I don't know how workable that would be. It might be one of those simple projects that falls into place, but I suspect not. I don't have the time to tackle this right now (I'm on my 16th working day in a row), but if someone else wants to ...

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://37904]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2023-02-04 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (31 votes). Check out past polls.

    Notices?