-2

need to create a executable binary file out of a bash file. is it possible from rationale? thanks.

KAs
  • 205
  • Is there any way to hide (sensitive information from) the command line parameters of a program, is that the question? – ilkkachu Dec 06 '17 at 15:58
  • Well, other than patching the kernel, I think the answer is "no, you can't do that". But anyway, the way this question is phrased has a bit of an XY problem smell: you've already chosen a solution and only that solution is mentioned in the question title. To your credit, you did also mention your actual goal, too. – ilkkachu Dec 06 '17 at 16:32

1 Answers1

-1

shc is what you need. Also check the following question:

How to convert a shell script into a binary executable

Edit

This related question explains why it is hard and how to use some tricks to hide the argument from ps. Most of them require the source code of the program, and some of them are making use of the bugs in ps and may not be portable.

Note that in the implementation of shc, if you check the source file generated by it, you will see there is a macro hide_z defined, which is later used as the number of space to be padded before the actual script. However this trick does not work well in my new linux box (I tried it before and it worked, sorry again for not doubling checking before posting an answer) which is running on CentOS 7.4.

Weijun Zhou
  • 3,368
  • Sure, you just need some additional work. I will edit the answer. – Weijun Zhou Dec 06 '17 at 15:37
  • I am really sorry that I may have mistaken something. I may not be able to solve your original question but anyway I will post some related information above so that it may help others who come across this page. – Weijun Zhou Dec 06 '17 at 18:59