JustMe
JustMe

Reputation: 2383

When and how should I obfuscate my Delphi code?

What should I know about code obfuscation in Delphi?

Should I or shouldn't I do it?

How it is done and is there any good tools (commercial/free) to automate it?

Upvotes: 6

Views: 6014

Answers (5)

Cooler
Cooler

Reputation: 31

You can use free JCF (Jedi Code Formatter) to obfuscate your source code. However, pascal syntax does not allow strong obfuscation and JCF even doesn't do it's best (well, it's a code formatting tool, not obfuscator!)

Upvotes: 0

Warren  P
Warren P

Reputation: 69032

You could do other things to reduce an attacker's ability to disable your software activation system, for example, but in a native-compiled system like Delphi, you can't recreate source code from the binaries. Another answer (the accepted one at the moment) says exactly this, and someone else pointed out a helpful tool to obfuscate the RTTI information that people might use to gain some insight into the internals of your software.

You could investigate the following hardening techniques to block modification of your system, if that's what you really want:

  1. Self-modifying code, with gating logic that divides critical functions of your code such as software activation, into various levels of inter-operable checksums, and code damage and repair.

  2. Debug detection. You can detect debuggers being used on your software and attempt to block the software from working in this case.

  3. Encrypt the PE binary data on disk, and decrypt it either at load time, or just in time before it runs, so that critical assembler code can not be so easily reverse engineered back to assembly language.

As others have stated, hackers working on your software do not need to restore the original sources to modify it. They will attempt, if they try it at all, to modify your binaries directly, and will use a detailed and expansive knowledge of assembler language to circumvent things you may wish them not to.

Upvotes: 6

Mick
Mick

Reputation: 13485

Pythia is a program that can obfuscate binaries (not the source) created with Delphi or C++ Builder. Source code for Pythia is here.

Before:enter image description here

After: enter image description here

Upvotes: 7

David Heffernan
David Heffernan

Reputation: 613392

There's no point obfuscating since the compiler already does that for you.

There is no way to re-create the source code from the binary.

And components can be distributed in a useful way without having to distribute the source code.

So there usually is no (technical) reason for distributing the source code.

Upvotes: 6

BugFinder
BugFinder

Reputation: 17868

Why would you need to?

As a whole Delphi does not decompile back, unlike .net, so, while decompilation is always a bit of a risk, Ive never found a decompiler that actually did it to a useful way, lots of areas got left as assembler and so on.

If people want to rework your work, they can, no matter what, obfuscation or not, heck, some coders write almost naturally obfuscated code (having worked with a few)

My vote therefore, is shouldnt bother. Unless someone can show me a decompiler for delphi that really works, and produces full sets of compilable, and all delphi where it was originally, I wouldnt worry one drop.

Upvotes: 11

Related Questions