Sign in
Log inSign up
Benefits of using Python in InfoSec

Benefits of using Python in InfoSec

Todd's photo
Todd
·Dec 11, 2017

I've recently adopted Python a lot more in my daily activities and thought I would share why, in case you have thought about the language but hadn't tried it, or were wondering what all of the rage is about.

Please note that this is an editorial and I have absolutely no intention on providing hard facts for anything I say here, as this is not a formal document. Instead, this is just a personal story and I do believe it belongs here as this type of writing seems to be encouraged on Hashnode and does sometimes have community impact.

Versatility

At this point, Python seems to be able to accomplish almost anything a programmer would want on a machine to some degree. Keep in mind, I am not saying that Python does everything the best and that you should use it for your project, but we cannot deny that GUI programming, scientific programming, data analysis programming, embedded programming, server-side web programming, and many homework assignments can all be done with Python. Python seems to be the new C in that it is a "general purpose language" of the current generation which is not tied to a particular platform either physically or genetically. For example, although C# is able to run on other machines now, it still has the background of being Microsoft's baby.

The "international language" for programmers

Python seems to be becoming somewhat of an "international language" for programmers. What this means is that I may be a C programmer, you're a javascript programmer, but we both know Python so we can express ideas to each other in Python. I work in information security as a researcher primarily with binary files yet all of my colleagues from other firms as well as my friends who do web development all know Python. It is not true for any other language that we work with.

Many tools/scripting plugins have Python APIs

angr.io, Binary Ninja, IDA Pro, gdb-peda, Microsoft Z3 Theorem Prover, pefile, pwntools, Immunity Debugger are all tools I've used which have a Python API if not a full-blown python shell embedded in them. For this reason alone, it has been more than worth the investment of learning python -- it often controls other programs which may even be programmed in other languages.

It brings different people together

One of the things I always found neat about going to Python meetups is that I met biologists, physicists, data scientists, web developers, and teachers. I can't say that for any other language meetup. You go to a JS meetup and 8-9/10 times you're only dealing with web developers.

It's a great utility language

Even if you are not developing a full-blown application in Python, it can be a useful tool as a utility language to get quick tasks done or aid in programming C, C++, or whatever other language you are using. Some examples of this would be using Python for build scripts, testing, or using some other tool/library which will aid in your development but which is a python tool - you know, scriptyy stuff!​

OOP constructs are an option but aren't forced

I avoid OO constructs unless I need them; I often do not for small scripts and programs that I write. In Python, I don't feel forced to use OOP but I feel that it is available there as a tool if I need to. A contrast to this would be C# where I am forced to put everything into a namespace, class, etc...

It's implemented in C

I use CPython and I know and am comfortable with C so if I don't like something or get confused, I can always check out the CPython repo!