Forum Thread: Python vs C++

Python vs C++

So guys,what is best for creating hacks?Python or C++?
Do you have some resources from where i can learn one of those?

4 Responses


Python is best for creating scripts. These are usually tools like many that we use here on Null Byte.

C++ and C are often used for developing exploits. This is more advanced and not usually for the novice.

There are several tutorial here on Null Byte on both.


Each has it's advantages and drawbacks. There are 2 major differences as I see it between Python and C++. One is syntax. These 2 languages could not look more different. Where C++ requires block delimiters, Python relies on indentation.

The other difference is probably the most important. Python is an interpreted language, meaning Python code will execute on any platform capable of running the interpreter. C++ must be compiled for specific platforms. In other words, you'll have one build for Windows, another build for Linux, and so on. This of course is a big disadvantage to C++ if you need to run on multiple platforms. But the advantage to compiling code into an executable is that it runs very fast and needs no interpreting. So if you're looking to compromise a Windows machine that doesn't have Python installed (probably most typical Windows workstations, unless you're hacking a development company), then your Python script is worthless unless you use something like py2exe to compile it down to an executable.

Rule of thumb:

if code will be run on your machine (attacker) better code it in python (easeir to write and customize)

if code will be run on victim's pc, better code it in c/c++. It's unlikely he has pyton installed, also he would be able to read the source. Also, your executable can be packed and protected against VM, debugger, etc..

You can always turn your python script to .exe but they will be way bigger and not so efficient as native code.

A good resource for both, like OTW said, is the how-to section.

Python is great for automating things in hacking (same as Ruby) the C family of languages are good to know because most programs and servers are written in them.

Share Your Thoughts

  • Hot
  • Active