Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Decompile Perl2EXE back to original source

by dkarner (Initiate)
on Mar 29, 2004 at 21:03 UTC ( [id://340753] : perlquestion . print w/replies, xml ) Need Help??

dkarner has asked for the wisdom of the Perl Monks concerning the following question:

I had a perl script which was compiled with Perl2exe but have since lost the source file.

I read through "A Real Challenge" thread about decompiling PerlApp compiled scripts and was hoping that a similar process might be possible with Perl2Exe compiles.

Has anyone does this or would like to help me try to figure it out?

Replies are listed 'Best First'.
Re: Decompile Perl2EXE back to original source
by cchampion (Curate) on Mar 29, 2004 at 22:25 UTC
Re: Decompile Perl2EXE back to original source
by diotalevi (Canon) on Mar 29, 2004 at 21:41 UTC
    Share your data somewhere so we can look at it. Also see if it is possible to get your app to load modules like B::Deparse and/or B::Deobfuscate.
Re: Decompile Perl2EXE back to original source
by flyingmoose (Priest) on Mar 29, 2004 at 21:43 UTC
    I just googled on this topic out of curiosity, and I didn't find anything. Perl2Exe, being rather proprietary, isn't going to be documented in terms of how it works...of course, it IS possible (can you read decompiled assembler?) but it's not going to be fun, and I don't think you are guaranteed to get the original source back exactly as you want it. You'd have better luck if it was made by PAR, but even then, I'm not sure it would result in readable code.

    What diotalevi says above is correct...but that's assuming you can get Perl source out of it. If that source is somehow encoded in something non-trivial (i.e. not ROT13 or BASE64 or something like that), you may have a hard time getting something to feed to the DeParser. Start by trying to extract the strings from the executable (look at a hexeditor to see if they are there, or try 'strings') -- hopefully you will see something that looks like Perl code, but probably not.

      I didn't assume the person could access the source anywhere. If the original poster can do the equivalent of -MO=Deparse or -MO=Deobfuscate then perl can read itself out of memory from the opcodes.
        Ok, I did not realize it was storing opcodes and not perl. Interesting.

        Anyway, this is still assuming the opcodes are there as could (well it could do anything) store them encoded in some format as a weak attempt at obfuscation. I don't think you can run -MO=Deparse directly on a PAR executable either (or can you?).

Re: Decompile Perl2EXE back to original source
by zentara (Archbishop) on Mar 30, 2004 at 14:23 UTC
    I asked a similar question awile ago. I had found a "generic script compiler" and thought it would hide the Perl. Nope. You might find this of interest:->Can you prevent MO=Deparse

    I'm not really a human, but I play one on earth. flash japh