How to create an EXecutable file (Linux)

Hi
Can any one please tel me how to create an Executable for the ruby
script?

I have a ruby script and It has some sensable password in the script

so i need a executable file ( by executable i did not mean 755 ) i meant
executable like C

How can i do that ??
Thanks

I don’t think this is possible yet. (ruby is a interpreted language)

Maybe you should try to use jRuby, I heard there is a possibility to
make binary file from ruby script. But I can be wrong…

Another option would be to read your sensitive information from a dot
file that is located elsewhere and have your script read that in from
there. That way, you can share your script without having your password
in it.

Joel P. wrote in post #1073076:

Encrypt the password?

Hi thank
what you mant by this ?

Encrypt the password?
Remove it from their version of the script if you don’t want someone
else to access it?
Don’t give the script to someone if they lack authorisation to see the
password?

If an exe is your only hope then I think that can only be done on
Windows at present.

Fosiul A. wrote in post #1073077:

Joel P. wrote in post #1073076:

Encrypt the password?

Hi thank
what you mant by this ?

Look up the gem “crypt19”. It’s a nifty encryption tool that you can use
by inputting a unique key. It’ll turn your password into a string that
is meaningless until you run the code to decrypt it.
Of course, with an rb file, anyone with the string and the passkey could
decrypt it, but if that’s a worry you shouldn’t be packaging your
password into the script in the first place.

Ben W. wrote in post #1073068:

Another option would be to read your sensitive information from a dot
file that is located elsewhere and have your script read that in from
there. That way, you can share your script without having your password
in it.

thats a way … thanks for this advise

It sounds like your question is really “how do I obfuscate a password in
a script?”

There are a number of tactics. The simplest is probably to include the
password from another file which is stored securely.

We are using JRuby , compile the src file and start the file via a small
C-routine.

jrubyc can compile your src file.

*test.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char * argv[])
{
char cmdLine[4096];
sprintf(cmdLine, “jruby --ng /home/test/jruby/test.class %s”, argv[1]);
system(cmdLine);
//puts(cmdLine);
}
*
*
*
gcc test.c -o jtest
*
*
start jtest.
*
*
Reverse engineering is always possible.
*
*
*
*

  • Luc.*

Even if you did compile it, like c, the password would still be
accessible… Like c. Don’t store passwords in your code.

It’s not really “reverse engineering” to run strings on an ELF file,
or a .class, or whatever.

On 23 August 2012 18:41, Luc E. [email protected] wrote:

{
Reverse engineering is always possible.


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


Matthew K., B.Sc (CompSci) (Hons)
http://matthew.kerwin.net.au/
ABN: 59-013-727-651

“You’ll never find a programming language that frees
you from the burden of clarifying your ideas.” - xkcd

If someone wants it badly enough (say, to run it in a debugger) there’s
not a lot you can do.

We used to do a few things back in the bad old days.

  1. Break up the password and put it in different fields/variables/array
    positions and assemble it at runtime. ( x = a + f + w + otherclass.y
    etc.)
  2. XOR it with something simple and unwrap when needed.

Combine the two if you care. You can create as many shells of this kind
of silliness as you want, but frankly, it’s faster to break than it is
to hide, so if you only want to hide it from people scanning through a
hex editor or running strings, I wouldn’t do much beyond step 1.

What is the password protecting? Is it an anti-piracy measure or an
authentication token?

-a.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs