Compiling ruby code

S

Simon Nielsen

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
 
B

Bill Barnhill

------=_Part_525_28066655.1143636977525
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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 retriev=
e
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 wil=
l
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 - http://www.erikveen.dds.nl/allinoneruby/index.html

=3DBill.Barnhill

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

------=_Part_525_28066655.1143636977525--
 
D

dseverin

Simon said:
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 (
http://www.atdot.net/yarv/ )

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 :)))
 
G

Guillaume Marcais

Le 29 mars 06, =E0 07:59, Damphyr a =E9crit :
Well, in this case it's not exactly hard, it's more like childlike=20
easy:
rubyscript2exe untars the whole ruby environment, together with your=20=
script, in the temp directory. Getting the source means browsing the=20=
temp folder :)

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

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

____________________________________________________________________
http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 =
=E7=EB=E5=EA=F4=F1=EF=ED=E9=EA=EF=FD =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5.=
 
G

Guillaume Marcais

Le 29 mars 06, =E0 11:04, graham a =E9crit :
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=20
file and have ruby decypt the file "on-the-fly" as it reads it at=20
run-time? The encryption key could be client specific and hence the=20
code secure. I guess it would need Ruby VM to have a new command line=20=
mode (i.e. "start-up on the fly decryption - and here is my=20
certificate"), and the source to be encypted / packed by something=20
like rubyscript2exe

Would this make a worthwhile quiz??

There are already been discussion about this on some schemed proposed.=20=

But it usually didn't take very long for some clever people to write a=20=

script to decrypt to program and spit it out. It probably isn't=20
possible to make something hard to figure out without modifying the=20
interpreter itself, as if you stay in pure Ruby, the code is decrypted=20=

at some point and thanks to Ruby's dynamic properties, you can always=20
add some code at that very point.

Now if you modify the Ruby interpreter and do not release the source of=20=

it, it can be as obfuscated as you can make the decryption piece in the=20=

binary of your new interpreter. As soon as someone figure out your=20
encryption scheme, he/she can compile a ruby interpreter of their own=20
to spit out the code just before it is executed...

Guillaume.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top