Compiling ruby code

i know very little about ruby, have only looked shortly at rails

Is it possible to compile my own code so that it cannot be viewed by
others ?

much like the zend compiler does for php

···

--
Posted via http://www.ruby-forum.com/.

Yes and no.

There is Rubyscript2exe:
http://www.erikveen.dds.nl/rubyscript2exe/index.html

That said suspect it would not be too hard to hack into the exe and retrieve
the script, as I believe it stores the script text and then interprets it
using an embedded interpreter. I think any language that's interpreted will
be hackable, question is how hard you can make it for them. I also suspect
we can make it a lot harder in Ruby 2.0, with a Ruby VM.

You might also want to check out:
All In One Ruby - AllInOneRuby - A "Just-in-Time and Temporary Installation of Ruby"

=Bill.Barnhill

···

On 3/29/06, Simon Nielsen <sn@needhost.dk> wrote:

i know very little about ruby, have only looked shortly at rails

Is it possible to compile my own code so that it cannot be viewed by
others ?

much like the zend compiler does for php

--
Posted via http://www.ruby-forum.com/\.

Simon Nielsen wrote:

i know very little about ruby, have only looked shortly at rails

Is it possible to compile my own code so that it cannot be viewed by
others ?

much like the zend compiler does for php

There's currently no ruby compiler.

If you want better performance take look at YARV project (
YARV: Yet Another Ruby VM )

If you want to protect your code from reuse, here are some well-known
rules ( http://www.faqs.org/docs/artu/ch01s06.html )

Just INVERT them all and apply INVERTED rules to your code and mind -
and there will be no need to compile or obfuscate your code ever :)))

···

--
Posted via http://www.ruby-forum.com/\.

Bill Barnhill wrote:

Yes and no.

There is Rubyscript2exe:
http://www.erikveen.dds.nl/rubyscript2exe/index.html

That said suspect it would not be too hard to hack into the exe and retrieve
the script, as I believe it stores the script text and then interprets it
using an embedded interpreter. I think any language that's interpreted will

Well, in this case it's not exactly hard, it's more like childlike easy:
rubyscript2exe untars the whole ruby environment, together with your script, in the temp directory. Getting the source means browsing the temp folder :slight_smile:
Cheers,
V.-

···

--
http://www.braveworld.net/riva

____________________________________________________________________
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.
http://www.freemail.gr - free email service for the Greek-speaking.

Thanks for the link dseverin! Definitely add to my to-do list.

James H.

Bill Barnhill wrote:

Yes and no.
There is Rubyscript2exe:
http://www.erikveen.dds.nl/rubyscript2exe/index.html
That said suspect it would not be too hard to hack into the exe and retrieve
the script, as I believe it stores the script text and then interprets it
using an embedded interpreter. I think any language that's interpreted will

Well, in this case it's not exactly hard, it's more like childlike easy:
rubyscript2exe untars the whole ruby environment, together with your script, in the temp directory. Getting the source means browsing the temp folder :slight_smile:

It's even easier than that. The executable created has an option --eee-justextract, which will extract the whole thing in the current directory...

Guillaume.

···

Le 29 mars 06, à 07:59, Damphyr a écrit :

Cheers,
V.-
--
http://www.braveworld.net/riva

____________________________________________________________________
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.
http://www.freemail.gr - free email service for the Greek-speaking.

Good to know, thanks :slight_smile:

I know there are Java bytecode obfuscators, anyone working on something
similar for YARV?

···

On 3/29/06, Guillaume Marcais <guslist@free.fr> wrote:

Le 29 mars 06, ΰ 07:59, Damphyr a ιcrit :

> Bill Barnhill wrote:
>> Yes and no.
>> There is Rubyscript2exe:
>> http://www.erikveen.dds.nl/rubyscript2exe/index.html
>> That said suspect it would not be too hard to hack into the exe and
>> retrieve
>> the script, as I believe it stores the script text and then
>> interprets it
>> using an embedded interpreter. I think any language that's
>> interpreted will
> Well, in this case it's not exactly hard, it's more like childlike
> easy:
> rubyscript2exe untars the whole ruby environment, together with your
> script, in the temp directory. Getting the source means browsing the
> temp folder :slight_smile:

It's even easier than that. The executable created has an option
--eee-justextract, which will extract the whole thing in the current
directory...

Guillaume.

> Cheers,
> V.-
> --
> http://www.braveworld.net/riva
>
> ____________________________________________________________________
> http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.
> http://www.freemail.gr - free email service for the Greek-speaking.
>
>

I know there are Java bytecode obfuscators, anyone working on something
similar for YARV?

People seem to want a compiler for 2 reasons
a) improved performance
b) securing their source

a) could be addressed by YARV, as previously commented
b).. is it possible to do something simple like encrypt the source file and have ruby decypt the file "on-the-fly" as it reads it at run-time? The encryption key could be client specific and hence the code secure. I guess it would need Ruby VM to have a new command line mode (i.e. "start-up on the fly decryption - and here is my certificate"), and the source to be encypted / packed by something like rubyscript2exe

Would this make a worthwhile quiz??
Graham

There are already been discussion about this on some schemed proposed. But it usually didn't take very long for some clever people to write a script to decrypt to program and spit it out. It probably isn't possible to make something hard to figure out without modifying the interpreter itself, as if you stay in pure Ruby, the code is decrypted at some point and thanks to Ruby's dynamic properties, you can always add some code at that very point.

Now if you modify the Ruby interpreter and do not release the source of it, it can be as obfuscated as you can make the decryption piece in the binary of your new interpreter. As soon as someone figure out your encryption scheme, he/she can compile a ruby interpreter of their own to spit out the code just before it is executed...

Guillaume.

···

Le 29 mars 06, à 11:04, graham a écrit :

I know there are Java bytecode obfuscators, anyone working on something
similar for YARV?

People seem to want a compiler for 2 reasons
a) improved performance
b) securing their source

a) could be addressed by YARV, as previously commented
b).. is it possible to do something simple like encrypt the source file and have ruby decypt the file "on-the-fly" as it reads it at run-time? The encryption key could be client specific and hence the code secure. I guess it would need Ruby VM to have a new command line mode (i.e. "start-up on the fly decryption - and here is my certificate"), and the source to be encypted / packed by something like rubyscript2exe

Would this make a worthwhile quiz??

Now if you modify the Ruby interpreter and do not release the source of it, it can be as obfuscated as you can make the decryption piece in the binary of your new interpreter. As soon as someone figure out your encryption scheme, he/she can compile a ruby interpreter of their own to spit out the code just before it is executed...

Well PGP is available as source - and it seems to provide pretty encryption via the use of certificates. Sure you could alter the interpreter to save the source before execution - but that would only help if you were an authorised user with a valid certificate to run the encrypted codebase - and if you had this - why would you want to pirate the source anyway as you had already "bought" it?

Graham