Reverse Engineering Stack Exchange is a question and answer site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to know if there are ways to compile C, C++ and Python code in order to not be able to reverse engineering it over Linux or not?

I have heard there are some ways over Windows to do it, but I am working on Linux.

I want to compile my code securely, as released or final version.


At least I want to make it hard for usual users to disassemble,

I am using GCC for C and C++, also I would be thankful if you introduce me best compiler for Python.

share|improve this question
Bruce Schneier's column today linked to an article about research in this field: The paper will probably not tell you how to solve this, but it will give you a good idea of just how much research there is into your problem. – Kevin Feb 25 '14 at 1:06
up vote 7 down vote accepted

You cannot prevent reverse engineering. You can make it more or less harder but you cannot prevent it. No.


Ok, as the author updated it with a more clearer question... this is what one can do:

  1. Strip symbols from the binaries. At the very least.
  2. Obfuscate the code. This may help:
  3. Pack or protect the binary. I know no good available protector for Linux, sorry.

As for the Python code... If you're lucky enough, you can use Shedskin to compile to native code and then apply the same techniques discussed before. If not, you may give a try to Cython instead of Python. Also, there is a question here about obfuscating Python code.

PS: Anyway, in my opinion, code protection is overrated. You cannot prevent a decided person or group from reverse engineering a piece of software and, sometimes, it's a lose of time and money.

share|improve this answer
Ok ..that's exactly what I want..How is it possible with compiler? Thanks – MLSC Feb 24 '14 at 10:18
I updated my question...Thank you – MLSC Feb 24 '14 at 10:21

As for C compiler (gcc), first make sure you do not make a mistake of compiling it with -g option (adds symbols for debugging, basically whole source code).

-g Produce debugging information in the operating system's native format

Secondly, try with -s option:

-s Remove all symbol table and relocation information from the executable.

Without function names is would be harder to reverse engineer it. Take a look at man strip. I haven't tried it, but something like

strip --strip-debug objfile


strip --strip-unneeded objfile

on your object files could be useful.

Turn on as much optimisation as you can -O3. It is really hard to read an optimized assembly, making it another impediment. There is really no good way of preventing disassembly and reverse-engineering, but it makes it harder.

As for Python, it is absolutely OK to ship only .pyc bytecode files. It is compiled version of source code for Python Virtual Machine. How do I create a .pyc file?. Try this one, maybe it is what you need. User can run bytecode file using python just as easily as a source code file.

Lastly, try to google for code obfuscation. It makes no sense to obfuscate C++ code, but maybe someone knows if code obfuscation is a good strategy for Python.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.