LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-30-2014, 08:15 PM   #1
Srinivas Gadi
LQ Newbie
 
Registered: Dec 2012
Posts: 22

Rep: Reputation: Disabled
How to create binary file in Ubuntu


Hi All,

I would like to create a binary file in ubuntu which means no one can able to see my source code but they can able to execute it.
I tried googling and found few articles but didn't get it, can some please let me know the step by step process to create binary(.bin) files

Much Appreciated , awaiting for your response.

Thanx
Srinivas Gadi
 
Old 01-31-2014, 12:18 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Do you mean you want to compile your own source code of a particular program? What language is the source code written in? Depending on your answer you will have to install some packages (if they're not already installed) that will allow you to compile your source code.
jdk
 
Old 01-31-2014, 03:37 PM   #3
Srinivas Gadi
LQ Newbie
 
Registered: Dec 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thank you so much for your response.

I think Yes,
As per my requirement,Code should not be visible to any one but that can able to executable.

My code in shell script.
I haven't installed any packages.

Thanks
Srinivas

Last edited by Srinivas Gadi; 01-31-2014 at 03:38 PM.
 
Old 01-31-2014, 04:31 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,677

Rep: Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260
You'd need an encryption device to obfuscate the code. I doubt you could keep it from some folks otherwise.

One of the concepts of linux is an open development of ideas.
 
Old 01-31-2014, 04:41 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,986

Rep: Reputation: 2447Reputation: 2447Reputation: 2447Reputation: 2447Reputation: 2447Reputation: 2447Reputation: 2447Reputation: 2447Reputation: 2447Reputation: 2447Reputation: 2447
Quote:

My code in shell script.
you do not

a shell script is a plain text file

convert it to c or c++
and compile it

but a "de-compiler" will be able to figure it out
 
Old 01-31-2014, 04:57 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,598

Rep: Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532
@OP
You can use shc to compile a script into a binary file.
See this howto for more details.

Regards
 
Old 01-31-2014, 05:29 PM   #7
Srinivas Gadi
LQ Newbie
 
Registered: Dec 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thumbs up

Thank you very much for all your responses.

@bathory:
Perfect solution to my requirement and thank you for pointed me to a nice article.

Please let me know what is the process to de-code the compiled file? in-case if l lost the source code.

Thank you.
 
Old 02-01-2014, 04:21 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,598

Rep: Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532
Quote:
Please let me know what is the process to de-code the compiled file? in-case if l lost the source code.
I'm afraid you can't decompile the script.
But you can keep a backup copy of the original script, along with the c code generated file (the one with the .c extension, i.e. script.x.c).

Regards
 
Old 02-01-2014, 04:47 AM   #9
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,503

Rep: Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434
this was your request:
Quote:
I would like to create a binary file in ubuntu which means no one can able to see my source code but they can able to execute it.
The solution is the tool shc (as it was told). The result can be hardly decompiled, you will not even know if it was originally a shell script (no one means even you can not reverse engineer the binary).
Therefore you need to save a copy of that script, in case you need to modify it.
 
Old 02-02-2014, 04:26 PM   #10
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,051

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
I suspect it is merely just wrapping your bash into system() calls. The strings command can probably dump alot of the text.
 
Old 02-03-2014, 01:27 AM   #11
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,503

Rep: Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434
see man page of shc:
Quote:
shc itself is not a compiler such as cc, it rather encodes
and encrypts a shell script and generates C source code with
the added expiration capability. It then uses the system
compiler to compile a stripped binary which behaves exactly
like the original script. Upon execution, the compiled
binary will decrypt and execute the code with the shell -c
option.
 
Old 02-03-2014, 04:31 PM   #12
Srinivas Gadi
LQ Newbie
 
Registered: Dec 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thank you for all your inputs.

@All:
If you look at the article shc bottom of the page.
"You should not be encrypting your shell script in the first place. But, if you decided to encrypt your shell script using shc, please remember that a smart person can still generate the original shell script from the encrypted binary that was created by shc."

As per this,how is it possible to generate the shell script from encrypted binary file?.

Thx
Srinivas
 
  


Reply

Tags
binary, file, ubuntu 11.10


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Im having a problem updating a binary file on the ubuntu 10.4 lts update manager linux/unix87 Linux - Newbie 2 11-27-2010 09:32 PM
How to create binary file? miros84 Linux - Software 7 11-18-2010 03:03 AM
Help: Opening GenICs binary file, writing to binary file for GADGET-2 (in C) parallax147 Programming 0 10-05-2010 12:06 PM
Bash- :cannot execute binary file (Ubuntu VM on ESXI server) maas187 Linux - Virtualization and Cloud 17 04-03-2010 10:25 AM
Create ubuntu .deb from binary .tar.gz (Blender 2.41) trainpic Ubuntu 2 05-26-2006 02:12 PM


All times are GMT -5. The time now is 12:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration