Obfuscating and protecting Python code
A 118-minute course on protecting your Python code from copying and reverse engineering: obfuscation, dynamic execution and post-delivery control. Taught in Spanish.
With Daniel Alfocea
- of video
- 118 min
- lessons
- 19
- level
- advanced

In Spanish. This program is taught in Spanish: its videos, exercises and exam are in Spanish. This page is a translation to help you decide.
Who it is for
You distribute software written in Python and want to keep control over your code after delivering it: licenses, intellectual property and reverse engineering. You need an advanced level of Python.
About the program
If you deliver your code as is, it can be copied, modified and used without your permission
118 minutes of video on protecting your Python code from copying and reverse engineering.
Language: the course is taught in Spanish. The videos and the text lesson are in Spanish. This page is the English description only.
You deliver a script, a tool or a product written in Python. The client installs it, and from then on the code is as readable to them as it is to you.
With no control at all, nothing stops someone from copying all of it, skipping the license you agreed on, or changing a condition you put there on purpose.
Most people who distribute Python code don’t deal with this problem until it’s too late.
Who is telling you this
I’m Daniel Alfocea. I’ve spent twenty years in development and security, and I’ve written a few audit tools (GoLismero, Plecost, Dockerscan).
Here I show you how to protect your Python code the way I would, with the terminal open and typing in front of you.
What you get
First, why you’d want a control mechanism inside your own code: license management, post-delivery control, or a switch that disables a copy when needed.
Then, the ways to run Python code dynamically: from a text string, from compiled bytecode and from functions built at runtime. Each has its place depending on what you need to hide.
A whole module on how Python source code is reviewed, with the static analysis tools actually used (pylint-security, Bandit, Pysa, Prospector, Semgrep) and what they look at.
With that you understand what makes a piece of code readable or not to those tools, and you apply several layers: hiding a call behind another function, serialized bytecode, manual string obfuscation, and Base64 and ROT13 combined.
And at the end, you build your own mechanism, from start to finish: a connection to a server that keeps control over a delivered instance, protected with the course’s techniques.
I want to keep control of my code
What it costs
€105, one payment, and the course is yours. If I update it, you get the new version without paying again.
You won’t come out with a commercial licensing system, that’s a different product. You come out with the execution and protection techniques behind it, and a mechanism of your own built from start to finish.
If you want to learn Python from scratch, this course is too much for you.
Cheers,
Dani
P.S. If you’re unsure, watch the two open lessons first. In under 10 minutes you’ll know if it’s for you.
Syllabus
118 minutes of video in 19 lessons and 4 modules. The ones marked “Sample” can be watched without logging in.
01Conceptos básicos 2 lessons · about 6 min
- Qué es un huevo de pascua 2:18
- Por qué querríamos un huevo de pascua
02Ejecutando un huevo de pascua 7 lessons · about 41 min
- Métodos nativos de Python
- Usando “eval”
- Usando “exec”
- Usando “compile”
- Usando “types” 7:09
- Usando “codeops”
- Usando “subprocess”
03Haciendo el código indetectable 9 lessons · about 72 min
- Métodos, herramientas y tipos de detección. Análisis estático y dinámico
- Ocultando el método “exec”
- Nuestro primer huevo de pascua
- Alias de funciones y monkey patching
- Usando Python byte codes
- Usando cadenas ofuscadas (parte 1)
- Usando cadenas ofuscadas (parte 2)
- Usando base 64
- Usando ROT 13
04Herramientas de análisis 1 lesson
- Herramientas de análisis de código estático para Python
Sample lessons
Watch them before you pay.
-
Qué es un huevo de pascua2:18
-
Usando “types”7:09
Who teaches it

Daniel Alfocea
Twenty years in development and security, and author of tools such as GoLismero, Plecost and Dockerscan.
Questions
What level of Python do I need?
Advanced. You need to be comfortable with functions, imports and string handling, because the course is about execution and protection techniques, not learning to program.
If you’re still writing your first script, this course will be too much for you.
What is this useful for day to day?
For three cases that come up when you deliver Python software to a client or distribute it outside your control: someone copies it without paying for the license, someone modifies it without your permission, or you need a control mechanism after delivery, such as a switch that disables a pirated copy.
The course teaches you to build that mechanism and hide it inside your own code.
Is this legal?
The content is for protecting your own code, managing licenses for software you develop yourself, or understanding how someone else’s source code gets reviewed.
What you do with these techniques beyond that is your responsibility, not the course’s.
Linux, macOS or Windows?
Are 118 minutes worth €105?
If you deliver or sell Python software and want to keep some control over it after delivery, it’s a method you apply once and use in every new project.
And if you’re not sure, start with the two open lessons. They cost nothing.
Will I come out able to protect any code?
No. This does not replace a commercial licensing system or a professional obfuscation service.
You come out with the techniques behind those systems, so you can build your own protection to fit what you deliver.
Who it is forYou distribute software written in Python and want to keep control over your code after delivering it: licenses, intellectual property and reverse engineering. You need an advanced level of Python.