Page 1 of 1

can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 4:28 pm
by birddseedd
can a python file be made to run in a way that is not humanly readable? a py file can be ran from command line. but it can also be opened in ide. this is all i know. but I would need to make it so customers can not just read the source code.

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 4:33 pm
by DougieLawson
Not possible. Even the *.pyc files can be decoded back to source code.

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 4:38 pm
by birddseedd
DougieLawson wrote:
Thu Jan 24, 2019 4:33 pm
Not possible. Even the *.pyc files can be decoded back to source code.
well that kinda blows. what about c? does that compile into an executable file?

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 4:41 pm
by DougieLawson
C/C++ is a compiled language. Those things aren't 100% secure. We spent lots of time and money reverse engineering compiled languages for YR2K so it's a common skill.

What is so special about your code?

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 4:44 pm
by birddseedd
its a product i want to sell. but if they can easily get the code they can duplicate it and drag me into a huge legal battle

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 4:57 pm
by jamesh
birddseedd wrote:
Thu Jan 24, 2019 4:44 pm
its a product i want to sell. but if they can easily get the code they can duplicate it and drag me into a huge legal battle
Intrigued by the legal battle comment. If it's your code, why would you get dragged in to a legal battle?

That said, most people cannot decompile C code, and there are ways of writing it that make it more difficult to understand (actually, that's most C code anyway)

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 4:58 pm
by W. H. Heydt
birddseedd wrote:
Thu Jan 24, 2019 4:44 pm
its a product i want to sell. but if they can easily get the code they can duplicate it and drag me into a huge legal battle
You can only be dragged into a big legal battle if your code does something illegal, or you have violated someone else's copyright, patent, or license terms in writing your code.

On the other hand, if you copyright *your* code and sell it with a suitable license, you can drag *them* into a huge legal battle if they do something with your code that violates the license you put it under.

All of that said, I hope you realize that everything you write is dependent on the work of other people...unless you started with a pile of sand and wrote all of your own tools from first principles. (And even then, both hardware and software will be influenced by your own prior knowledge.)

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 5:01 pm
by mattmiller
Easy solution - rewrite it in Python 3 with a few decorators and async calls and that'l make it unreadable!

Sorry - old time Python2er having a bad day with Python3 today :)

In all seriousness, there have been many requests like this over the years and without going to tremendous lengths like creating encrypted partitions, its not worth trying to hide python code.

Compliled C/C++ etc are intrinsically much harder to reverse engineer and most people don't go to trouble of trying to reverse engineer them

The hackers will always be able to do this (attack always beats defence eventually)

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 5:03 pm
by birddseedd
jamesh wrote:
Thu Jan 24, 2019 4:57 pm
birddseedd wrote:
Thu Jan 24, 2019 4:44 pm
its a product i want to sell. but if they can easily get the code they can duplicate it and drag me into a huge legal battle
Intrigued by the legal battle comment. If it's your code, why would you get dragged in to a legal battle?

That said, most people cannot decompile C code, and there are ways of writing it that make it more difficult to understand (actually, that's most C code anyway)
it would take a civil court to get them to stop selling my code/product and get repreations(sp) from them.

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 5:08 pm
by birddseedd
mattmiller wrote:
Thu Jan 24, 2019 5:01 pm
Easy solution - rewrite it in Python 3 with a few decorators and async calls and that'l make it unreadable!

Sorry - old time Python2er having a bad day with Python3 today :)

In all seriousness, there have been many requests like this over the years and without going to tremendous lengths like creating encrypted partitions, its not worth trying to hide python code.

Compliled C/C++ etc are intrinsically much harder to reverse engineer and most people don't go to trouble of trying to reverse engineer them

The hackers will always be able to do this (attack always beats defence eventually)
looking for a c++ide now.

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 5:18 pm
by mfa298
jamesh wrote:
Thu Jan 24, 2019 4:57 pm
That said, most people cannot decompile C code, and there are ways of writing it that make it more difficult to understand (actually, that's most C code anyway)
Better yet use Perl, that can be really unreadable! (look for some of the Obfuscated perl contests)
birddseedd wrote:
Thu Jan 24, 2019 4:44 pm
its a product i want to sell. but if they can easily get the code they can duplicate it and drag me into a huge legal battle
First off maybe determine the risk of someone actually doing that vs the cost of trying to defeat what might be a non threat. Or look at other ways of making money from your code (e.e. get them to pay for support rather than paying for the code).

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 5:26 pm
by birddseedd
mfa298 wrote:
Thu Jan 24, 2019 5:18 pm
jamesh wrote:
Thu Jan 24, 2019 4:57 pm
That said, most people cannot decompile C code, and there are ways of writing it that make it more difficult to understand (actually, that's most C code anyway)
Better yet use Perl, that can be really unreadable! (look for some of the Obfuscated perl contests)
birddseedd wrote:
Thu Jan 24, 2019 4:44 pm
its a product i want to sell. but if they can easily get the code they can duplicate it and drag me into a huge legal battle
First off maybe determine the risk of someone actually doing that vs the cost of trying to defeat what might be a non threat. Or look at other ways of making money from your code (e.e. get them to pay for support rather than paying for the code).
perl would be easier for a noob?

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 6:07 pm
by Ernst
birddseedd wrote:
Thu Jan 24, 2019 5:26 pm
mfa298 wrote:
Thu Jan 24, 2019 5:18 pm
jamesh wrote:
Thu Jan 24, 2019 4:57 pm
That said, most people cannot decompile C code, and there are ways of writing it that make it more difficult to understand (actually, that's most C code anyway)
Better yet use Perl, that can be really unreadable! (look for some of the Obfuscated perl contests)
birddseedd wrote:
Thu Jan 24, 2019 4:44 pm
its a product i want to sell. but if they can easily get the code they can duplicate it and drag me into a huge legal battle
First off maybe determine the risk of someone actually doing that vs the cost of trying to defeat what might be a non threat. Or look at other ways of making money from your code (e.e. get them to pay for support rather than paying for the code).
perl would be easier for a noob?
No.

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 6:21 pm
by birddseedd
Ernst wrote:
Thu Jan 24, 2019 6:07 pm
birddseedd wrote:
Thu Jan 24, 2019 5:26 pm
mfa298 wrote:
Thu Jan 24, 2019 5:18 pm


Better yet use Perl, that can be really unreadable! (look for some of the Obfuscated perl contests)



First off maybe determine the risk of someone actually doing that vs the cost of trying to defeat what might be a non threat. Or look at other ways of making money from your code (e.e. get them to pay for support rather than paying for the code).
perl would be easier for a noob?
No.
lol. doesn't get any more straightforward than that.
i looked at wiringpi for a c++library. seems it only allows 1 pwm pin. am I correct? that seems like a pretty big limitation. I need at least 2 motors

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Thu Jan 24, 2019 7:59 pm
by hortimech
birddseedd wrote:
Thu Jan 24, 2019 6:21 pm
i looked at wiringpi for a c++library. seems it only allows 1 pwm pin. am I correct? that seems like a pretty big limitation. I need at least 2 motors
There's another problem, if you use code from another project and that program has a GPL license, you will also have to provide the source code for your project.

Re: can a python file be made to run in a way that is not humanly readable?

Posted: Fri Jan 25, 2019 9:14 am
by SteveSpencer
Pigpiod does multiple PWM, doesn't it?
And you use it as is, through a server interface, so as I understand it, you aren't obliged to supply the source (IANAL applies) for your client, just as using TCP/IP doesn't oblige you to provide the source for the network layer.
Of course, if you're using other libraries directly in your code, that may well change things.