1

I have the compiled code with all .pdb, vshost and everything that is generated. I am already using DotPeek without too much hassle. Would like to know If I can retrieve the original code with all the pdb and vshost files generated from compilation with the original names.

I know pdb maps your compiled exe to the original source code you have in visual studio to make debugging available.

So basically pdb should be a "map" to what you wrote in visual studio and the optimized binary you have, that results in a CIL/C# code in DotPeek decompiled source.

There is a way with those files to retrieve the code in a non-optimized way (or to say differently, like it was in visual studio original source?)

#

EDIT

#

Well, it seems it's not possible. Peace :)

  • It is possible untill the executable is not obfuscated. – Biswapriyo Apr 19 '18 at 7:53
  • @Biswapriyo It's not. I have compiled it, but I am missing some of the original classes and I have 95% of the original source. I Already have decompiled it with DotPeek, but I would like to have a more readable code instead of the IL/C# generated because it will speed up my reconstruction work a lot. It it's possible, then how to? – Liquid Core Apr 19 '18 at 7:56
  • what is this 5% missing? Maybe the code was removed from the exe as it was not used? Can you provide the binaries? – Paweł Łukasik Apr 19 '18 at 8:18
  • @PawełŁukasik Cannot provide the binary as it's my client project. The code missing is due to GIT misbehavior so it's just a data loss. The full code, with 100% of the classes is compiled tough and I would like to retrieve the code from there. – Liquid Core Apr 19 '18 at 9:19
  • 2
    you can't retrieve the original code as you wrote it, you can get sth that behaves the same but might look different. A lot of code that is written is just a syntactic sugar and look completely different when compiled – Paweł Łukasik Apr 19 '18 at 10:15
1

While PDBs will certainly help in decompilation (e.g. with you may be able to recover names of functions, classes, and maybe even local variables), they don't contain the original source code and other things unnecessary for debugging (such as comments).

  • How I can do that? I Don't need comments and other things. – Liquid Core Apr 19 '18 at 9:19
0

If the program is not obfuscated you can recover something very similar to the source code (even if you don't have a PDB file), I've done it once using reflector (you can use also dnSpy, which is an open source software), but after that you have to fix a lot of things (like the names of anonymous method)

  • Dotpeek or similar gives you the clear optimized code. There's no doubt about it. My idea was how to retrieve the original code as close as possible to the real original source. i.e: Dotpeek retrieve all the loops and conditions optimized and scrambled in a better way, but I want them back in a readable way. – Liquid Core Apr 24 '18 at 14:20
  • In my experience, I noticed that dnSpy gives the most readable decompiled code, and if the code flow is obfuscated (you still notice that the code of every method is similar to a finite state machine) use de4dot or some specific deobfuscator (de4dot can also detect the protection), decompile it again and check – COB RCE Apr 24 '18 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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