Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Compiled Code Question  (Read 8229 times)

0 Members and 1 Guest are viewing this topic.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Compiled Code Question
« on: April 30, 2019, 02:55:36 PM »
Friend of mine hit me up asking if there was a way to compile code and have it unable to be decompiled?

Last I knew there was no way to block someone from decompiling especially in grabbing it from memory addresses where it can all be exposed to its inner workings.

Figured I'd check here to see if I am wrong and there is a way. Then I will get back to him on this.

Geek-9pm


    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Compiled Code Question
« Reply #1 on: April 30, 2019, 03:41:13 PM »
Yes, it can be done.
However, when people work together they try to make it easy, not hard to de compile and debug. I recall some 'tricks' that are used to make code more dense and it also makes it harder to debug. One is to use instructions that are not documented in the standard literature.This is done at the machine code level, or by an assembly make for that kind for trickery.  ;D
Another is to enter a procedure at a point that should be wrong. Some modes do not allow that, but older CPU designs did allow that kind of foolishness.

An other is to use some instructions that will change the flags in the accumulator. This will confuse anybody wanting to understand the logic.  :-\
More extreme is encrypted code that unlocks itself just before it is used  and then goes back to the way it was. I I knew how that is done I could not tell you because they would kill me when they found out who I am. :-X

Another is to have a special custom CPU that is made for super secret aplications.
It looks like a normal CPU but...
Wait... Somebody is pounding on the door - be back in a jiff.
s

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: Compiled Code Question
« Reply #2 on: April 30, 2019, 06:34:33 PM »
No. You can obfuscate it or encrypt it to make it more difficult, but it isn't possible to make it be completely unable to be decompiled. The program has to be run by the machine and the machine needs machine code instructions, and machine code instructions can always be mapped to assembly language identifiers. Even in the case of encrypted code blocks at some point it must be decrypted and in memory so that it can be executed.

Personally, I think at a wider scale, obfuscation, preventing decompiling, etc. is putting resources in the wrong direction. It tends to cause problems for legitimate customers and that time could arguably be put towards real-world features in the software.
I was trying to dereference Null Pointers before it was cool.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Compiled Code Question
« Reply #3 on: April 30, 2019, 06:59:29 PM »
Cool... TY both for input on this and if Geek never returns we will know that he said too much.  :P

Quote
Even in the case of encrypted code blocks at some point it must be decrypted and in memory so that it can be executed.

Yeah that is what my thought was on trying to hide the code was that the computer has to have the information structured pretty much the same as an unprotected program, and poking around in memory to see what is there is too easy for someone with skills/tools to be able to see its structure.

Will share this with him when I see him tomorrow.