LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-24-2010, 11:04 AM   #1
izghitu
Member
 
Registered: Oct 2005
Location: localhost.localdomain
Distribution: CentOS
Posts: 109

Rep: Reputation: 16
encrypted executable scripts


Hi,

I have some bash and python scripts.

Is there any way to encrypt them but still be able to execute them encrypted?

Please help

Thanks
 
Old 08-24-2010, 01:34 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
What are you hoping to gain with this?
 
Old 08-24-2010, 01:38 PM   #3
izghitu
Member
 
Registered: Oct 2005
Location: localhost.localdomain
Distribution: CentOS
Posts: 109

Original Poster
Rep: Reputation: 16
I'm hoping to be able to give someone my scripts so he can execute them but can't see the contents of the scripts
 
Old 08-24-2010, 02:28 PM   #4
Les Windoze
LQ Newbie
 
Registered: Aug 2010
Location: Florida
Distribution: RHEL5, RHEL6, Solaris 10
Posts: 18

Rep: Reputation: 1
Don't know about bash (doubt it) and Python but you can with Perl.
Is there a security issue with the `someone' seeing your code?
 
Old 08-24-2010, 02:59 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
My WAG is OP has some authentication credentials embedded in his scripts. That or he's hoping to hide proprietary code..?

Quote:
Originally Posted by izghitu
Is there any way to encrypt them but still be able to execute them encrypted?
Nope, and if you think about it the question doesn't make sense. Cipher text is pseudo-random garbage without the right key. You could decrypt the cipher text (e.g. in memory) and then execute the plaintext instructions.

Please describe in detail about your exact problem so that we can take a more informed stab at some solutions.

Last edited by anomie; 08-24-2010 at 03:01 PM.
 
Old 08-24-2010, 03:50 PM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
There is a well known tool, that "compiles" a shell script
into an ELF executable : shc.
http://asdfasdf.debian.net/~tar/free.../shc-3.8.7.tgz

http://blogs.koolwal.net/2009/01/20/...-based-system/

Is usually available with 'apt-get install shc' or # yum install shc
( RPM : The Rpmforge repo.)
..

Last edited by knudfl; 08-24-2010 at 03:51 PM.
 
Old 10-27-2010, 06:15 AM   #7
spayre
LQ Newbie
 
Registered: Jun 2005
Posts: 2

Rep: Reputation: 0
i have tried compiling my script using the command below

shc -r -v -f <scriptname.sh>

when i ran the ./scriptname.sh.x, it works!

but when i copied the scriptname.sh.x to another linux machine, give it the permission (chmod 777), it throws an error...

-bash : scriptname.sh.x: cannot execute binary file

any ideas?
 
Old 11-04-2010, 01:17 PM   #8
vomplete
LQ Newbie
 
Registered: Nov 2010
Posts: 5

Rep: Reputation: 0
Not sure, but I think that SHC must be installed on both machine (on "compiling machine" and others machines that execute these binary files)

bye

Quote:
Originally Posted by spayre View Post
i have tried compiling my script using the command below

shc -r -v -f <scriptname.sh>

when i ran the ./scriptname.sh.x, it works!

but when i copied the scriptname.sh.x to another linux machine, give it the permission (chmod 777), it throws an error...

-bash : scriptname.sh.x: cannot execute binary file

any ideas?

Last edited by vomplete; 11-04-2010 at 01:31 PM.
 
  


Reply



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
Scripts : password generates agains a user in encrypted mode shipon_97 Linux - General 3 08-30-2007 01:15 AM
Storing password used in shell scripts in encrypted file Swakoo Linux - Security 2 12-06-2006 10:39 PM
Build scripts say my C compiler cannot make executable output noware Linux - Software 2 06-07-2006 02:15 PM
VPN: Debian Scripts -> Mandriva 2006 Scripts Undefined Mandriva 0 11-30-2005 12:10 PM
Running a Java executable class from another executable class LUB997 Programming 22 07-24-2005 04:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:21 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
Open Source Consulting | Domain Registration