Open source obfuscation program to protect your Kivy or Python projects

974 views
Skip to first unread message

Richard DeVost

unread,
Jun 9, 2016, 4:13:56 PM6/9/16
to Kivy users support
Hi Fellow Kivy Developers,

I released a Kivy program (called Desdi) for iOS devices in the Apple store and will soon have it in the Android store. To protect the code I looked for a Python obfuscator that could obfuscate modules, methods, variables, and parameters in a project with many thousands of lines of code distributed across many packages and modules. I found none. So I rolled my own and made sure it would obfuscate Kivy language files (.kv) too.

If you have commercial Kivy apps in the Android or iOS stores, protect your investment--obfuscate your code. Both stores encourage developers to do so. And that's for compiled code--the advice applies doubly for we who like Python interpreted code :)

The obfuscator is called pymixup. It's available for free on http://github.com/rdevost/pymixup/. It can obfuscate pure Python projects and Kivy projects. I hope later to add Django/Jinja template support.

I worked to make the obfuscation process as easy possible, initially populated the reserved keywords for a number of common packages, and chose sane defaults. Hopefully you will find it useful. Please let me where it can improve.

Richard

werton

unread,
Jun 10, 2016, 2:29:03 AM6/10/16
to Kivy users support
Hi. In my opinion the obfuscation does not give almost any protection, and obfuscator with open source is generally something very strange. Much easier and safer to use the compile via Cython, in addition, it will give you an additional performance gain.

пятница, 10 июня 2016 г., 5:13:56 UTC+9 пользователь Richard DeVost написал:

st...@btp.nl

unread,
Jun 10, 2016, 3:52:39 AM6/10/16
to Kivy users support

If I want to "steal" your code i don't care if its' obfuscated or not, I just use it as it is.
And changing some  variable names aren't any problem to me. By adding a few print statements I can figure out very quickly what the code does.
Like werton said, use Cython.
We have big commercial projects were we use Cython to compile large and critical pieces of code to "hide" it.

PS, I don't find it very hard to read your obfuscated piece of code you give as an example in the README.rst :-)

Regards,
Stas  

Richard DeVost

unread,
Jun 10, 2016, 12:07:48 PM6/10/16
to Kivy users support
Compiled code is almost the ne plus ultra of obtuseness. The extra performance werton mentions never hurts. I'm impressed--and encouraged to try it--that Stas has cythonized large segments of (I'm guessing Kivy) projects.

Do either of you have or know of coding standards you can share that facilitate cythonizing Kivy projects? 

Thanks,
Richard

Kent Borg

unread,
Jun 10, 2016, 1:25:18 PM6/10/16
to kivy-...@googlegroups.com
On 06/10/2016 12:07 PM, Richard DeVost wrote:
> Do either of you have or know of coding standards you can share that
> facilitate cythonizing Kivy projects?

A more basic question: How do I incorporate cython into Kivy at all? I
am assuming it is too easy, that's why I can't find it documented.

I have played with cython outside of Kivy (great way to interface to C
libraries), but not inside Kivy.


Thanks,

-kb

Richard DeVost

unread,
Jun 10, 2016, 3:32:21 PM6/10/16
to Kivy users support
Hi Kent,

The clever developers on the Kivy team do a lot to incorporate the kv language into Python code--and they do it all using Python and Cython. So, maybe it is super easy to cythonize a Kivy program. I'll find out this weekend. It's time to add this Cython that all of you commend to my programming toolbox.

Richard

Sebastian Nielsen

unread,
Nov 19, 2017, 9:53:09 AM11/19/17
to Kivy users support


Hi Richard DeVost,

Does Pymixup work for python 3.5 code?

Richard DeVost

unread,
Nov 23, 2017, 6:46:22 PM11/23/17
to Kivy users support
Hi Sebastian,

Pymixup works with Python3.x code.
Pymixup itself, however, must be run under Python2.x, since it uses Fabric (only available for Python 2) internally. 

Hope that helps,
Richard
Reply all
Reply to author
Forward
0 new messages