Learning Python for Offensive Security
A refreshed edition of Snake Charming for Beginners
Welcome!

This is the website for the second edition of Learning Python for Offensive Security, previously called Snake Charming for Beginners. The original course was written in 2019 for 0xCC, an information security training conference for women.
This book guides you through Python by building small security tools: a subdomain bruteforcer, a proof-of-concept walkthrough for Heartbleed, and a set of system-level exercises that’ll take you closer to how Unix-like operating systems expose useful information.
The writing keeps the original workshop spirit: practical, a little playful, and focused on getting you from blank file to working tool. You don’t need to already be a Python developer, but you’ll get the most from the course if you’re willing to type code, run it, break it, read the errors, and occasionally wander through the dense jungles of Pythonia with a clackity keyboard and a trusty guide.
The old course was called Snake Charming for Beginners for a reason. Snake charming is an age-old practice of hypnotising snakes by playing and waving a murli; in this course, the modern version involves an editor, a terminal, and enough Python to charm useful little tools into existence.
Only run scanning, enumeration, exploit, or system-inspection code against systems you own, administer, or have explicit permission to test. The examples in this book use local fixtures, documentation examples, or intentionally safe targets, so the book can render without touching real third-party systems.
What This Book Skips
Software development is a big problem space with plenty of practices, tools, and paradigms. To keep the course focused on building Python tools, a few topics stay deliberately light.
git and how to use it. There are heaps of excellent tutorials and walk-throughs online. My favourite resources are:
- Git Ready: beginner to advanced walk-throughs on
gittopics. - Learn Git Branching: interactive walk-throughs sorted by task.
- Codecademy - Learn Git: beginner-friendly lessons on common
gitcommands.
Environment management. This edition keeps setup tool-agnostic. It gives you enough to install Python, create an isolated environment, and run the examples, then points to official documentation for deeper platform-specific details. I want to spend as much time as possible actually building things, not making you fight a package manager for sport.
Credits and licence
This website is and will always be free. It’s licensed under the Creative Commons Attribution-ShareAlike 4.0 International licence, with credits for public-domain or licensed source material collected in the Credits chapter.
If you appreciate reading the book for free and would like to give back, you can buy me a Ko-Fi or donate to one of the following organisations: