how to run an ENCRYPTED file?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to run an ENCRYPTED file?
# 1  
Old 03-14-2009
Bug how to run an ENCRYPTED file?

Hello sir,
we are able to do :
Quote:
[...]# ls
list of all files in the current directory
But when I goto /bin or /usr/bin to see the code of "ls". I found it to be encrypted. So can u please tell me how to encrypt a code in such a way that the user can run it but cannot see the source code.

example:
if I have a shell script named "sample.sh" as :
Quote:
echo "hello how are you"
What is the command to encrypt it so that I can still execute it using 'bash' but cannot see the source code.
I tried using 'gpg' but it didnt work.Can u please tell me howSmilie
# 2  
Old 03-14-2009
First off, 'ls' is not an "encrypted script", it's not a script at all -- it's programmed in C, which becomes machine language, which you potentially could understand if you were very determined. It's not encrypted, just obscure.

Second, 'chmod -r' will prevent the user from reading a file. Much better security than trying to obfuscate it, since that's all it would amount to -- after all, a file the user really can't decrypt is a file the machine really can't decrypt. But for the halibut, here's how I once embedded encryption in scripts. Without the password, they can't examine the source code or run it.

Last edited by Corona688; 03-14-2009 at 02:14 PM..
# 3  
Old 03-15-2009
Bug one more DOUBT

hello sir.
I did use the link u gave me.
there also we are still able to see the source code.
I want to know how to obfuscate a code so that the user can use it but cannot see the logic that I used....it must come in all "#&*!" symbols like the code that comes when we open "ls" from /bin or /usr/bin

I cant use "chmod -r" as the user can be root.He would change the permission and see the code.I dont want the root also to see that code.
How can I achieve it sir ?
# 4  
Old 03-15-2009
Like I said, a file the user really can't decrypt is a file the machine really can't decrypt. To get something even root can't decrypt you'll need something out of root's hands, like the kernel or a hardware cryptoprocessor, to do the dirty work. Sadly this goes beyond my knowledge, but the TPM's in modern computers might be related to this.
# 5  
Old 03-15-2009
Quote:
Originally Posted by nsharath
I want to know how to obfuscate a code so that the user can use it but cannot see the logic that I used....it must come in all "#&*!" symbols like the code that comes when we open "ls" from /bin or /usr/bin
Well, you could write something in C instead of shell. But that's not encrypted, just obfuscated, a determined user could still piece things together. And a system tracing program would be able to tell what system calls it made no matter what language it was written in.
# 6  
Old 03-16-2009
why do you care if the root user can see your script??

I feel you have a bigger security problem if you NEED to hide script from the root user.

Last edited by robsonde; 03-16-2009 at 08:15 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

Find the original file size of encrypted file

Hi, I am trying to find out the original file size of an encrypted file in SunOS. The file was decrypted with gpg command. I want to know the size of the orginal file without decrypting it. I am using the below command, but it is not working for big files(more than 1 GB). gpg --passphrase... (4 Replies)
Discussion started by: vsachan
4 Replies

3. UNIX for Advanced & Expert Users

How To Find GPG Keys In Encrypted File With Out Decrypting it?

Hello All, Is there a way to determine how many public keys are embedded or used to encrypt in a GPG file with out decrypting the actual encrypted file. I know i can see the keys & email id's used when we decrypt it, but curious to find a command if any to know with out decrypting the actual file... (2 Replies)
Discussion started by: Ariean
2 Replies

4. UNIX for Dummies Questions & Answers

Saving an unencrypted copy of a file encrypted with vi

Well I did something stupid. I opened a file using vi, and accidentally saved it using <esc>:Xx. So I know the key is x, but what I can't figure out is how to save the file without encryption. (4 Replies)
Discussion started by: jgt
4 Replies

5. UNIX for Dummies Questions & Answers

Using the encrypted password of the shadow file

i have an application that uses the encrypted password that's in the /etc/shadow file. i copied the line for the particular username i was interested it in from shadow file and i pasted it into the password file of the application. the application is nagios. this application allowed that... (5 Replies)
Discussion started by: SkySmart
5 Replies

6. Solaris

How edit a file encrypted with openssl ?

i have file encrypted with openssl and i can decrypt and view its content by below code openssl enc -d -blowfish -pass file:secret_key -in input_file now i need to edit the input_file . i have to remove three lines from this file . how can this be done ? (3 Replies)
Discussion started by: chidori
3 Replies

7. Shell Programming and Scripting

run vi/vim encrypted shell script without decryption on multiple servers

Hello Everyone, How do we run vi/vim encrypted shell script without decryption on multiple servers. It is a simple bash script and vim -nx <filename> has been used to encrypt with desired password. Now I have few errors, the syntax is absolutely fine as I have run that script multiple times on... (0 Replies)
Discussion started by: lovesaikrishna
0 Replies

8. Shell Programming and Scripting

FTP file from MF to AIX, fully encrypted

Hi All, I have connected to MainFrame system from Unix AIX Server then using ftp i get the file "NJUSP_XYXYXY_NONONO" to Unix. Now when i tried opening this file using cat/more i am getting the content fully in encrypted format. please help me to read the content of this file from my Unix... (5 Replies)
Discussion started by: Arunprasad
5 Replies

9. UNIX for Advanced & Expert Users

netrc file encrypted password

Hi, I do not want the plaintext password to appear in the netrc file. So I want to encrypt the password. Is there a way to encrypt the password and still make ftp to use the netrc ? Thanks in advance. -Gow:confused: (2 Replies)
Discussion started by: ggowrish
2 Replies

10. Shell Programming and Scripting

How to decrypt a file which is encrypted in UNIX, In Windows NT

Hi, I want to encrypt a file in UNIX(HP-UX) and Transfer to a FTP server. Our FTP server is Windows NT. SO, how can i decrypt the file which is encrypted in UNIX, in Windows NT. Please, help me this is urgent. Siva Gorantla:confused: (3 Replies)
Discussion started by: gorantla
3 Replies
Login or Register to Ask a Question