Complete retard here.
How come you can't just decrypt/reverse engineer the source code of a program when the code is "in there somewhere"?
You actually can ?
>>61575371
Non retard here: In a best case scenario the code is present as binary that you can turn into assembly code with a disassembler. For actual readable source code, you need to run that assembly code through a decompiler. Most decompilers are incomplete and not quite perfect, the result they spit out doesn't include comments and variable names that make sense. You could disassemble and decompile microsoft word, and you might get something that can be recompiled to produce a working product, but it will almost certainly be a fucking mess that's impossible to read.
all binaries can be reverse engineered
3*3=9
8+1=9
5+4=9
10-1=9
>>61575419
Pretty much what this guy said, except that for managed languages like .NET and Java retrieving the source code is much easier.
tldr native languages are a pain and managed ones are a walk in the park if they dont have any sort of protection.
>>61575419
To elaborate, in a worst case scenario, the code is present in a packed and obfuscated form that will just look like absolute shit when disassembled and likely not produce much of a result when decompiled.
>>61575456
This is actually a really good explanation of why disassembly and decompiling is hard.
>>61575371
>and there is nothing you can do
turning the power off
>>61575419
>>61575458
>>61575468
>>61575456
Ok, so did I get it right if I say that compiling code is kinda like compressing an image?
You start with the source PNG image and compress it into JPEG, and even though we know exactly how the JPEG algorithm works, there's no way to flawlessly extract the source PNG from a JPEG.
>>61575700
Yeah, seems about right
>>61575371
The code isn't "in there somewhere"
When you use your keyboard to type these words, do you really believe animals are "in there somewhere". Plastic as you know are mostly made from oil. Oil is made from dead animals millions of years ago. You cant just get the code from a compiled program. Best we can do is re-create on a basic level with some dis-assembler program. Like >>61575456 points out, it spits out workable alternatives. But its not the source code.
>>61575700
No, it's more like exporting a photoshop PSD into a JPEG.
>>61575458
>and managed ones
No, you mean bytecode-compiled ones. And its bytecode must have enough information.
>>61575371
The source code is the Coca Cola formula.
The compiled result is the finished coke product.
The disassembly is a raw, flat list of chemical compounds detected in the product.
The decompilation is a formula, crudely generated based on the list of compounds, which will result in Coke.
You could think of it as being the formula, but it isn't anywhere near as good as having the "real" original formula. The original is probably well structured, with a high level overview of each step, and lots of notes. Your reconstruction contains many random steps which happen to work but which don't make much sense on their own, and you don't have the notes required to get a good overall picture.
Finally, a manual reverse engineering (which might begin with a decompilation as a starting point) is an attempt to recreate something close to the original formula. It cannot be automated and is created slowly with lots of human thought, research, and guesswork. It's much better than the auto-generated one but it's probably still significantly different from the original.
>>61575371
Oh, you can reverse engineer any binary program, given infinite time, infinite patience, infinite stamina, etc.
A machine could arguably to it faster than you, but it would be extremely hard without it being able to understand the context between various machine code snippets. (ASM for human-readable)
I suppose you could arguably train a neural network supercomputer to understand context at least as far as a program goes, map certain definitions to certain contexts as-known-to-humans and have this machine basically work as a disassembler-reassembler-to-C or whatever language you choose. (C would be ideal and the easiest)
That's the only really possible way to get human-readable and context-defined reverse-engineered binaries.
How it usually goes:
Binary -> ASM | -> Edit
-> Undefined C
How said machine would do it:
Binary -> Human-understandable C
wew