views:

118

answers:

4

What happens when you package a script as an executable? Is this a good way to distribute commercial applications? I remember I read something a long time ago that when you package scripts as executables, at runtime the exe decompresses the scripts to a temporary directory where they get ran.

If it's like that, than I don't think this can be viewed as a good solution, because a skilled user could find out where that directory is located and find the source code. I'm interested in Python & Ruby.

+3  A: 

With Python (e.g. pyinstaller -- be sure to get the SVN version, the "released" one is WAY out of date -- or py2exe) you can package bytecode. Sure, it can be "reverse compiled", just like Java bytecode or .NET assemblies (or for that matter, machine code), but I think it's a decent level of "obscurity" despite the existence of disassemblers. I guess you could also use something like pyobfuscate on the sources before you compile them, to make the names as unreadable as you can, but I have no personal experience doing that.

Alex Martelli
+2  A: 

py2exe is great, I've used it before and it works just fine for encapsulating a program so it can run on other computers, even those lacking python. Like Alex said, it can be disassembled, but then so can C++ binaries. It's just a question of how much work the person is has to put into it. If someone has physical access to a the computer where data is stored, they have access to the data (And there's no difference between code and data). Compress it, encrypt it, compile it, those will only slow the determined.

Realistically, if you want to make the source code to your program as inaccessible as possible, you probably shouldn't look at Python or Ruby. C++ and some of the others are far more difficult to decompile, thereby providing more obscurity. You can practice the fine art of obfuscation, but even that won't stop someone trying to steal it (It's not like you have to understand the code to put it up on the Pirate Bay).

Jonathanb
+3  A: 

Creating an application and creating a commercial software business are two distinct things.

At my job we have a commercial application developed in Ruby on Rails that is installed at client sites; no obfuscation or encryption applied.

There is just so much more going on at a business level: support, customization, training that it's almost ludicrous to think that they'd do something with the source code. Most sites are lucky if they can spare the cycles to manage the application, much less start wallowing in someone else's codebase.

Now that being said, we aren't publicly distributing the code or anything, just that we've made the choice to invest in making the application better and doing better by our customers than to burn the time trying to restrict access to our application.

Mike Buckbee
+1  A: 

This has been discussed before here for the Python case and some answers are valid for Ruby too. I highly recommend you to read a previous question in this site titled: How do I protect python code?. Pay attention to the first three answers.

Manuel Ceron