Can I compile (protect) a python script? [closed]
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
1
down vote
favorite
I have a python script. It starts with #!/usr/bin/env python
Is there a way I can compile it, and protect it's contents?
I've used shc for bash scripts, and before anyone chimes in with a moan, I know it's not a secure way to protect the contents of the script.
I was hoping there was a secure way to compile a python script and completely stop anyone from seeing the original code.
If not, then maybe something like shc would do, to stop the ill informed from snooping.
Hope that makes sense.
Preston
python compiling
closed as off-topic by Byte Commander, user68186, mikewhatever, karel, muru Jan 28 at 1:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." â Byte Commander, user68186, mikewhatever, karel, muru
add a comment |Â
up vote
1
down vote
favorite
I have a python script. It starts with #!/usr/bin/env python
Is there a way I can compile it, and protect it's contents?
I've used shc for bash scripts, and before anyone chimes in with a moan, I know it's not a secure way to protect the contents of the script.
I was hoping there was a secure way to compile a python script and completely stop anyone from seeing the original code.
If not, then maybe something like shc would do, to stop the ill informed from snooping.
Hope that makes sense.
Preston
python compiling
closed as off-topic by Byte Commander, user68186, mikewhatever, karel, muru Jan 28 at 1:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." â Byte Commander, user68186, mikewhatever, karel, muru
2
This doesn't seem to be about Ubuntu, but a general programming question. As such, it is off-topic here and should instead rather be asked on e.g. Stack Overflow. However, I think there is already a post that fully covers your question: stackoverflow.com/q/261638/4464570
â Byte Commander
Jan 27 at 21:33
:( Sorry, will do that
â Preston Cole
Jan 27 at 21:37
Keep in mind almost anything compiled and be decompiled. Also when compiled with debug / trace options it is even easier to decipher when decompiled.
â WinEunuuchs2Unix
Jan 28 at 0:08
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a python script. It starts with #!/usr/bin/env python
Is there a way I can compile it, and protect it's contents?
I've used shc for bash scripts, and before anyone chimes in with a moan, I know it's not a secure way to protect the contents of the script.
I was hoping there was a secure way to compile a python script and completely stop anyone from seeing the original code.
If not, then maybe something like shc would do, to stop the ill informed from snooping.
Hope that makes sense.
Preston
python compiling
I have a python script. It starts with #!/usr/bin/env python
Is there a way I can compile it, and protect it's contents?
I've used shc for bash scripts, and before anyone chimes in with a moan, I know it's not a secure way to protect the contents of the script.
I was hoping there was a secure way to compile a python script and completely stop anyone from seeing the original code.
If not, then maybe something like shc would do, to stop the ill informed from snooping.
Hope that makes sense.
Preston
python compiling
python compiling
asked Jan 27 at 21:29
![](https://lh6.googleusercontent.com/-yY5RnDRegvo/AAAAAAAAAAI/AAAAAAAAHGY/ujRPcvi1eDs/photo.jpg?sz=32)
![](https://lh6.googleusercontent.com/-yY5RnDRegvo/AAAAAAAAAAI/AAAAAAAAHGY/ujRPcvi1eDs/photo.jpg?sz=32)
Preston Cole
352
352
closed as off-topic by Byte Commander, user68186, mikewhatever, karel, muru Jan 28 at 1:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." â Byte Commander, user68186, mikewhatever, karel, muru
closed as off-topic by Byte Commander, user68186, mikewhatever, karel, muru Jan 28 at 1:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." â Byte Commander, user68186, mikewhatever, karel, muru
2
This doesn't seem to be about Ubuntu, but a general programming question. As such, it is off-topic here and should instead rather be asked on e.g. Stack Overflow. However, I think there is already a post that fully covers your question: stackoverflow.com/q/261638/4464570
â Byte Commander
Jan 27 at 21:33
:( Sorry, will do that
â Preston Cole
Jan 27 at 21:37
Keep in mind almost anything compiled and be decompiled. Also when compiled with debug / trace options it is even easier to decipher when decompiled.
â WinEunuuchs2Unix
Jan 28 at 0:08
add a comment |Â
2
This doesn't seem to be about Ubuntu, but a general programming question. As such, it is off-topic here and should instead rather be asked on e.g. Stack Overflow. However, I think there is already a post that fully covers your question: stackoverflow.com/q/261638/4464570
â Byte Commander
Jan 27 at 21:33
:( Sorry, will do that
â Preston Cole
Jan 27 at 21:37
Keep in mind almost anything compiled and be decompiled. Also when compiled with debug / trace options it is even easier to decipher when decompiled.
â WinEunuuchs2Unix
Jan 28 at 0:08
2
2
This doesn't seem to be about Ubuntu, but a general programming question. As such, it is off-topic here and should instead rather be asked on e.g. Stack Overflow. However, I think there is already a post that fully covers your question: stackoverflow.com/q/261638/4464570
â Byte Commander
Jan 27 at 21:33
This doesn't seem to be about Ubuntu, but a general programming question. As such, it is off-topic here and should instead rather be asked on e.g. Stack Overflow. However, I think there is already a post that fully covers your question: stackoverflow.com/q/261638/4464570
â Byte Commander
Jan 27 at 21:33
:( Sorry, will do that
â Preston Cole
Jan 27 at 21:37
:( Sorry, will do that
â Preston Cole
Jan 27 at 21:37
Keep in mind almost anything compiled and be decompiled. Also when compiled with debug / trace options it is even easier to decipher when decompiled.
â WinEunuuchs2Unix
Jan 28 at 0:08
Keep in mind almost anything compiled and be decompiled. Also when compiled with debug / trace options it is even easier to decipher when decompiled.
â WinEunuuchs2Unix
Jan 28 at 0:08
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
I haven't try it myself, but I know there's a thing called cx_Freeze. From its description:
cx_Freeze is a set of scripts and modules for freezing Python scripts into executables
I'm not sure how easy or hard it is to unpack executable and actually see the script source in it, so security of this approach is debatable.
Will give it a look, thanks :)
â Preston Cole
Jan 27 at 21:37
add a comment |Â
up vote
0
down vote
I have used one Python compiler during initramfs to speed up boot time for EnhanceIO SSD to HDD block device cacher. It worked well back in 2016 but I don't know how well it compiles today in current Python language.
The compiler used is called Pyinstaller and it:
is a program that freezes (packages) Python programs into stand-alone
executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX.
Its main advantages over similar tools are that PyInstaller works with
Python 2.7 and 3.3âÂÂ3.6, it builds smaller executables thanks to
transparent compression, it is fully multi-platform, and use the OS
support to load the dynamic libraries, thus ensuring full
compatibility.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I haven't try it myself, but I know there's a thing called cx_Freeze. From its description:
cx_Freeze is a set of scripts and modules for freezing Python scripts into executables
I'm not sure how easy or hard it is to unpack executable and actually see the script source in it, so security of this approach is debatable.
Will give it a look, thanks :)
â Preston Cole
Jan 27 at 21:37
add a comment |Â
up vote
0
down vote
I haven't try it myself, but I know there's a thing called cx_Freeze. From its description:
cx_Freeze is a set of scripts and modules for freezing Python scripts into executables
I'm not sure how easy or hard it is to unpack executable and actually see the script source in it, so security of this approach is debatable.
Will give it a look, thanks :)
â Preston Cole
Jan 27 at 21:37
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I haven't try it myself, but I know there's a thing called cx_Freeze. From its description:
cx_Freeze is a set of scripts and modules for freezing Python scripts into executables
I'm not sure how easy or hard it is to unpack executable and actually see the script source in it, so security of this approach is debatable.
I haven't try it myself, but I know there's a thing called cx_Freeze. From its description:
cx_Freeze is a set of scripts and modules for freezing Python scripts into executables
I'm not sure how easy or hard it is to unpack executable and actually see the script source in it, so security of this approach is debatable.
answered Jan 27 at 21:35
gmile
1115
1115
Will give it a look, thanks :)
â Preston Cole
Jan 27 at 21:37
add a comment |Â
Will give it a look, thanks :)
â Preston Cole
Jan 27 at 21:37
Will give it a look, thanks :)
â Preston Cole
Jan 27 at 21:37
Will give it a look, thanks :)
â Preston Cole
Jan 27 at 21:37
add a comment |Â
up vote
0
down vote
I have used one Python compiler during initramfs to speed up boot time for EnhanceIO SSD to HDD block device cacher. It worked well back in 2016 but I don't know how well it compiles today in current Python language.
The compiler used is called Pyinstaller and it:
is a program that freezes (packages) Python programs into stand-alone
executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX.
Its main advantages over similar tools are that PyInstaller works with
Python 2.7 and 3.3âÂÂ3.6, it builds smaller executables thanks to
transparent compression, it is fully multi-platform, and use the OS
support to load the dynamic libraries, thus ensuring full
compatibility.
add a comment |Â
up vote
0
down vote
I have used one Python compiler during initramfs to speed up boot time for EnhanceIO SSD to HDD block device cacher. It worked well back in 2016 but I don't know how well it compiles today in current Python language.
The compiler used is called Pyinstaller and it:
is a program that freezes (packages) Python programs into stand-alone
executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX.
Its main advantages over similar tools are that PyInstaller works with
Python 2.7 and 3.3âÂÂ3.6, it builds smaller executables thanks to
transparent compression, it is fully multi-platform, and use the OS
support to load the dynamic libraries, thus ensuring full
compatibility.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I have used one Python compiler during initramfs to speed up boot time for EnhanceIO SSD to HDD block device cacher. It worked well back in 2016 but I don't know how well it compiles today in current Python language.
The compiler used is called Pyinstaller and it:
is a program that freezes (packages) Python programs into stand-alone
executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX.
Its main advantages over similar tools are that PyInstaller works with
Python 2.7 and 3.3âÂÂ3.6, it builds smaller executables thanks to
transparent compression, it is fully multi-platform, and use the OS
support to load the dynamic libraries, thus ensuring full
compatibility.
I have used one Python compiler during initramfs to speed up boot time for EnhanceIO SSD to HDD block device cacher. It worked well back in 2016 but I don't know how well it compiles today in current Python language.
The compiler used is called Pyinstaller and it:
is a program that freezes (packages) Python programs into stand-alone
executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX.
Its main advantages over similar tools are that PyInstaller works with
Python 2.7 and 3.3âÂÂ3.6, it builds smaller executables thanks to
transparent compression, it is fully multi-platform, and use the OS
support to load the dynamic libraries, thus ensuring full
compatibility.
answered Jan 27 at 23:57
![](https://i.stack.imgur.com/2SXNl.jpg?s=32&g=1)
![](https://i.stack.imgur.com/2SXNl.jpg?s=32&g=1)
WinEunuuchs2Unix
36.8k760138
36.8k760138
add a comment |Â
add a comment |Â
2
This doesn't seem to be about Ubuntu, but a general programming question. As such, it is off-topic here and should instead rather be asked on e.g. Stack Overflow. However, I think there is already a post that fully covers your question: stackoverflow.com/q/261638/4464570
â Byte Commander
Jan 27 at 21:33
:( Sorry, will do that
â Preston Cole
Jan 27 at 21:37
Keep in mind almost anything compiled and be decompiled. Also when compiled with debug / trace options it is even easier to decipher when decompiled.
â WinEunuuchs2Unix
Jan 28 at 0:08