Rogelio Sevilla wrote:
> Good day everyone, this is my first time in here so please excuse me if
> this is a noob question.
Welcome!
No problem with noob questions.
>
> I have just created a jar file using rawr, it works pretty good by the
> way. The only issue I have is that my ruby files, with the raw code,
> are included in the jar file, so my code is pretty much exposed to
> anyone who gets the jar file. I was wondering if there's a way to, at
> least, obfuscate the source code?
Yes, but no. :(
JRuby has an option to compile Ruby files into Java classes. This
option has been part of rawr since the start, and it used to work fine.
It's not true obfuscation, but the resulting binaries produce some
interesting code should you reverse the process.
You can take a .class file and run it through a decompilier such as
cavaj to get a version of the source code.
What you get if you do that with Ruby code that has been compiled by
JRuby is really convoluted. It's probably good enough for most
purposes. It will not stop someone really determined to figure out the
source code but should deter casual inspection.
Here's the problem: Somewhere along the line either Java or JRuby
changed such that, now when Ruby code is compiled and packed into a jar
by rawr, the path to the Ruby classes are not correctly resolved.
It's broken, and that is why the default in `build_configuration.rb` to
compile ruby source is set to false.
For some reason I thought I had fixed this, but I just ran some tests
cases I've been working on and they were not compiling the ruby files.
When I changed the configuration the programs failed so the issue is
still there.
I haven't given up on this but it's on the back-burner at the moment.
Perhaps someone on this list can suggest where I could look to sort this
out.
One thing I have not tried is pre-compiling some Ruby code and then
including it in a project as if it where just another Java class.
It would mean an extra step but it might be a good enough work around
for you to hide code.
James Britt
--
jamesbritt.com - Live curious
justthebestparts.com - Feed your head
neurogami.com - Hack your world