Everyone is talking about Python in Cyber Security, and for good reason. Python use in Cyber Security has exploded over the past 5 years. Python really is a “gateway language” that opens you up to what is possible when you know how to automate processes in cyber security.
Is Python good for cyber security? Python is a great language to learn for cyber security professionals. Python is widely used in both offensive and defensive security to perform tasks such as brute-forcing, offensive tool development, vulnerability assessment, digital forensics, and reverse engineering.
Are you considering learning python for cyber security? When I first learned python, I felt like I had the world at my fingertips. I basically did, python is an extremely powerful language that has many applications in the field of cyber security.
Here Are 7 Reasons To Learn Python For Cyber Security
1. Python Is Versatile
Just to name a few areas where python is used, data mining, data science, AI, web development, embedded systems, automation, and the list goes on. I bet you are thinking, “yeah those all sound useful but I thought this was about python in cyber security?”
Cyber security is an extremely broad field and as cyber security professionals we need to be jacks of all trades. Every one of the fields I mentioned above can be applied to cyber security.
Most programming tasks that we will encounter as cyber security can be accomplished with python. There are some other languages that will help better accomplish specific tasks, but none match the versatility of python.
2. Python Is Easy to Read, Write
Time is the most necessary commodity in cyber security. It doesn’t matter whether you’re on the red or the blue team, time will always be a major factor.
Easy to Write
For example, if you are performing an incident response and need to write a script to parse logs and identify hosts that are affected. You don’t have the time to deal with a more complicated, compiled language like C++. Python only requires that you have the python interpreter and scripts can created in a matter of minutes due to the powerful libraries that are at your fingertips.
Easy to Read
You may ask “why does it matter that python is easy to learn?” It is very important that a language is easy to read, especially in cyber security. Everybody on your team may not know how to program but they will still have valuable input on the tasks that need to be scripted.
Even non-programmers can read python with little difficulty. When writing scripts, it is important to efficiently approach the problem. Non-programmers or managers can read and understand python without necessarily knowing how to write python scripts themselves. This readability allows them to provide input and improve your code!
3. Python is Easy to Learn
WP Engine surveyed 909 developers across the US on which programming language was the easiest to learn. It is not surprising that python found it’s way to the top of the list behind HTML (which is arguably not considered a programming language).
Python is extremely readable and easy to learn. There are many sources online that will get you started with python in a matter of minutes. On our YouTube channel, we give more detail about learning python and provide cyber security relevant tutorials.
Python will allow you to accomplish complex tasks in a matter of lines due to the number of powerful libraries that are out there and its simple syntax.
Python as a First Language
Python is a great first language to learn. There a number of free resources out there that will teach you python with no prior programming experience.
Learning the basic concepts of programming through python is great because python’s easy syntax allows you to focus on the actual fundamentals of programming. This will better set you up to learn other languages!
There are a number of cyber security specific python resources out there! This is another reason we love the language so much! We can point beginners in the direction of these books and courses and within a week they can be making an actual impact in the cyber security industry.
Black Hat Python
Black Hat Python is one of our top picks for cyber security professionals looking to learn python. This book covers the darker side of python and teaches you how to write network sniffers, manipulate packets, avoid sandboxing, create trojans and much more.
My favorite line in this book is from the forward.
“The difference between script kiddies and professionals is the difference between merely using other people’s tools and writing your own.” – Charlie Miller
Black Hat Python was also featured in ZDNet’s Cyber Security Reads For Every Hacker’s Bookshelf.
Grey Hat Python
If you’re a Blue Teamer, then Grey Hat Python is a great place to start upping your skills. Blue teamers don’t get left out on any of the fun, this book covers automating reverse engineering, designing your own debugger, fuzzing windows drivers, sniffing secure traffic, and much more!
This book really helped me up my python skills!
Violent Python is a better book for you if you are brand new to python. This book covers a mixture of topics from the two books I previously mentioned.
Learn Better with Video Courses? Here is our favorite
Pluralsight has a dedicated python learning path. If you are brand new to python, don’t worry. This course covers the absolute basics too.
4. Python Has A Strong Cyber Security Community
Second, only to Python’s extreme ease of use, the community support and existing toolsets available are unmatched. As hinted above, the libraries that are available in the Python ecosystem are incredibly useful and allow you to implement complex functions and operations in a matter of lines.
In addition to the libraries that are available, the number of security tools that are built with python and are open source.
Having the ability to modify and fix existing tools on the fly is very important. There are many times where you can skip hours of time by beginning with an existing script and modifying it to meet your needs.
In addition to the existing scripts and tools out there, the community support for python is unmatched. Most of the problems I have ever encountered have been at least addressed in a similar stack overflow post. This really increases your ability to develop more complex scripts to tackle harder problems.
Top 5 Most Useful Python Libraries For Cyber Security:
- libnmap (Python Nmap)
- Requests / Beautiful Soup
Stack Overflow is a programming question and answer platform critical for all developers when they are stuck, or wanting to share wisdom with the community.
5. Interactive Python Is Useful on The Fly
When you install the python interpreter on a system it allows you to run .py files, but it also allows you to run an interactive shell.
Many people don’t utilize this functionality but for cyber security it can be very powerful. The interactive shell can be called quickly and will allow you to perform quick one-off functions. The interactive shell is more formally known as a Read-Eval-Print Loop (REPL) environment.
In cyber security there are some very powerful ways to use the python REPL environment. Some of the most common uses are file operations. Python allows you to quickly read in files and perform data sanitization, processing, parsing, and many more operations.
One example would be quickly reading in a log file and pull out the targeted fields and then writing that to a new file. This can be accomplished in a matter of lines and is much more efficient than doing so manually.
6. Python is a Resume Booster
Let’s face it, python is a major resume booster. When recruiters see a candidate that knows python and is able to demonstrate this knowledge through projects or certifications it is a massive plus.
In the past 5 years, python usage in cyber security has exploded and you are likely to find it mentioned on most cyber security job postings.
7. Python is Rapidly Growing and Ensures Job Security
Python is growing incredibly fast and it makes a lot of sense to learn a growing major programming language if you are just starting your career.
Whenever you are choosing to learn a new language or technology you are taking a small risk that it will become obsolete or pigeonhole you. Choosing python is a very safe bet, it continues to grow year after year and will remain to be vital to the cyber security industry.
When you learn python, you are becoming a vital member of your team. Skilled programmers on cyber security teams are few and far between. This increases your ability for career growth and also increases your job security.
Having an in-depth understanding of python and how it can be applied to solve cyber security problems will open up many doors for you. Python alone will not land you a job in cyber security. You can be the most skilled python developed but if you don’t know anything about cyber security, what you can do for a team is very limited.
What are the best languages to learn for cyber security?
We covered this in an article titled 6 Best Programming Languages to Learn for Cyber Security. In this article, we break down the 6 best languages for cyber security and how they are used by both blue teams and red teams.
How long does it take to learn python?
Python really doesn’t take long to learn. With the courses and books previously mentioned, you can expect to write your first simple program on the first day and to become comfortable with the language within a month!