How to encrypt a shell (bash) script? [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-1
down vote

favorite
1












I have a shell script I want to encrypt in order to hide my code.



Please do not suggest SHC, because it is breaking (editor's note: explanation needed).







share|improve this question













closed as unclear what you're asking by Rui F Ribeiro, Romeo Ninov, Vlastimil, Jeff Schaller, Michael Homer May 8 at 20:16


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Is there a reason simply using GPG is insufficient? You can encrypt any file, not just scripts, using the method outlined here: gnupg.org/gph/en/manual/x110.html
    – John Moon
    May 8 at 16:57










  • can it break script ?
    – MeMaTi
    May 8 at 16:59






  • 3




    I presume that you do not expect to be able to execute an encrypted script?
    – Andy Dalton
    May 8 at 17:07






  • 1




    Define 'breaking'.
    – DopeGhoti
    May 8 at 17:08






  • 7




    Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.
    – Rob
    May 8 at 17:27















up vote
-1
down vote

favorite
1












I have a shell script I want to encrypt in order to hide my code.



Please do not suggest SHC, because it is breaking (editor's note: explanation needed).







share|improve this question













closed as unclear what you're asking by Rui F Ribeiro, Romeo Ninov, Vlastimil, Jeff Schaller, Michael Homer May 8 at 20:16


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Is there a reason simply using GPG is insufficient? You can encrypt any file, not just scripts, using the method outlined here: gnupg.org/gph/en/manual/x110.html
    – John Moon
    May 8 at 16:57










  • can it break script ?
    – MeMaTi
    May 8 at 16:59






  • 3




    I presume that you do not expect to be able to execute an encrypted script?
    – Andy Dalton
    May 8 at 17:07






  • 1




    Define 'breaking'.
    – DopeGhoti
    May 8 at 17:08






  • 7




    Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.
    – Rob
    May 8 at 17:27













up vote
-1
down vote

favorite
1









up vote
-1
down vote

favorite
1






1





I have a shell script I want to encrypt in order to hide my code.



Please do not suggest SHC, because it is breaking (editor's note: explanation needed).







share|improve this question













I have a shell script I want to encrypt in order to hide my code.



Please do not suggest SHC, because it is breaking (editor's note: explanation needed).









share|improve this question












share|improve this question




share|improve this question








edited May 8 at 18:11









Vlastimil

6,3011146116




6,3011146116









asked May 8 at 16:49









MeMaTi

22




22




closed as unclear what you're asking by Rui F Ribeiro, Romeo Ninov, Vlastimil, Jeff Schaller, Michael Homer May 8 at 20:16


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Rui F Ribeiro, Romeo Ninov, Vlastimil, Jeff Schaller, Michael Homer May 8 at 20:16


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • Is there a reason simply using GPG is insufficient? You can encrypt any file, not just scripts, using the method outlined here: gnupg.org/gph/en/manual/x110.html
    – John Moon
    May 8 at 16:57










  • can it break script ?
    – MeMaTi
    May 8 at 16:59






  • 3




    I presume that you do not expect to be able to execute an encrypted script?
    – Andy Dalton
    May 8 at 17:07






  • 1




    Define 'breaking'.
    – DopeGhoti
    May 8 at 17:08






  • 7




    Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.
    – Rob
    May 8 at 17:27

















  • Is there a reason simply using GPG is insufficient? You can encrypt any file, not just scripts, using the method outlined here: gnupg.org/gph/en/manual/x110.html
    – John Moon
    May 8 at 16:57










  • can it break script ?
    – MeMaTi
    May 8 at 16:59






  • 3




    I presume that you do not expect to be able to execute an encrypted script?
    – Andy Dalton
    May 8 at 17:07






  • 1




    Define 'breaking'.
    – DopeGhoti
    May 8 at 17:08






  • 7




    Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.
    – Rob
    May 8 at 17:27
















Is there a reason simply using GPG is insufficient? You can encrypt any file, not just scripts, using the method outlined here: gnupg.org/gph/en/manual/x110.html
– John Moon
May 8 at 16:57




Is there a reason simply using GPG is insufficient? You can encrypt any file, not just scripts, using the method outlined here: gnupg.org/gph/en/manual/x110.html
– John Moon
May 8 at 16:57












can it break script ?
– MeMaTi
May 8 at 16:59




can it break script ?
– MeMaTi
May 8 at 16:59




3




3




I presume that you do not expect to be able to execute an encrypted script?
– Andy Dalton
May 8 at 17:07




I presume that you do not expect to be able to execute an encrypted script?
– Andy Dalton
May 8 at 17:07




1




1




Define 'breaking'.
– DopeGhoti
May 8 at 17:08




Define 'breaking'.
– DopeGhoti
May 8 at 17:08




7




7




Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.
– Rob
May 8 at 17:27





Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.
– Rob
May 8 at 17:27











1 Answer
1






active

oldest

votes

















up vote
1
down vote














I want to hide my code.




Well, ... this smells, no offence. Why do you want to hide your code is a mystery to me.



Anyway, to answer your question:




How to encrypt a shell (bash) script?




You probably wish to achieve the impossible task as was poked by Rob in his comment, I will borrow it as it stands, because from my standpoint it is sufficient:




Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.




I would only add, there is one method I know of, which you for some reason call breaking, which without knowledge of your code is impossible to establish as to why, so I will not even bring it up.






share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote














    I want to hide my code.




    Well, ... this smells, no offence. Why do you want to hide your code is a mystery to me.



    Anyway, to answer your question:




    How to encrypt a shell (bash) script?




    You probably wish to achieve the impossible task as was poked by Rob in his comment, I will borrow it as it stands, because from my standpoint it is sufficient:




    Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.




    I would only add, there is one method I know of, which you for some reason call breaking, which without knowledge of your code is impossible to establish as to why, so I will not even bring it up.






    share|improve this answer



























      up vote
      1
      down vote














      I want to hide my code.




      Well, ... this smells, no offence. Why do you want to hide your code is a mystery to me.



      Anyway, to answer your question:




      How to encrypt a shell (bash) script?




      You probably wish to achieve the impossible task as was poked by Rob in his comment, I will borrow it as it stands, because from my standpoint it is sufficient:




      Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.




      I would only add, there is one method I know of, which you for some reason call breaking, which without knowledge of your code is impossible to establish as to why, so I will not even bring it up.






      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote










        I want to hide my code.




        Well, ... this smells, no offence. Why do you want to hide your code is a mystery to me.



        Anyway, to answer your question:




        How to encrypt a shell (bash) script?




        You probably wish to achieve the impossible task as was poked by Rob in his comment, I will borrow it as it stands, because from my standpoint it is sufficient:




        Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.




        I would only add, there is one method I know of, which you for some reason call breaking, which without knowledge of your code is impossible to establish as to why, so I will not even bring it up.






        share|improve this answer
















        I want to hide my code.




        Well, ... this smells, no offence. Why do you want to hide your code is a mystery to me.



        Anyway, to answer your question:




        How to encrypt a shell (bash) script?




        You probably wish to achieve the impossible task as was poked by Rob in his comment, I will borrow it as it stands, because from my standpoint it is sufficient:




        Sorry @MeMaTi what you are asking is not possible. A Bash script is a plain text list of commands, that need to be clear so they can be interpreted. Even if for some reason you can encrypt it in at rest file, I could easily see what your code was by doing bash -x <script.sh>. That will output every command the script is about to execute before executing it, this is very useful for debugging scripts.




        I would only add, there is one method I know of, which you for some reason call breaking, which without knowledge of your code is impossible to establish as to why, so I will not even bring it up.







        share|improve this answer















        share|improve this answer



        share|improve this answer








        edited May 9 at 5:13


























        answered May 8 at 18:02









        Vlastimil

        6,3011146116




        6,3011146116












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay