4 ms·
A silly decompiler that doesn't even recognise for loop with a break (https://github.com/Laurelai/decompile-dump/blob/master/output/30DF51C9F0D9B010350DC09ABE1E
by viraptor 16y ago
A silly decompiler that doesn't even recognise for loop with a break (https://github.com/Laurelai/decompile-dump/blob/master/output/30DF51C9F0D9B010350DC09ABE1E4E97/30DF51C9F0D9B010350DC09ABE1E4E97.c https://github.com/Laurelai/decompile-dump/blob/master/outpu...)
That said... I wonder how useful would github be as a collaborative decompilation space - grab a file, annotate / simplify as much as possible, send pull request, repeat...
- soulclap 16y ago'collaborative decompilation space' (github-based or not) sounds like a sick idea, actually.
- nitrogen 16y agoI wonder if Google's translation tools could be adapted to the task: "Suggest a better decompilation," perhaps? Does anybody have a good reference for how decompilers work? When converting assembly to C by hand I always went through multiple passes (not necessarily in this order): first a literal pass that looked a lot like this dump with gotos and variables named after registers, then I'd identify if/else and switch blocks, then I'd convert any reverse gotos into a while loop, convert while loops into for loops, identify data structures, duplicate lines that had been optimized to a single reference with jmps, etc.
- NateLawson 16y agoPretty much that, yes. Also, you have specific idioms for popular compilers (vc, gcc, icc, borland) and value propagation. You could even include an SMT solver to identify constraints and propagate the range to child basic blocks.
- NateLawson 16y agoBincrowd http://www.zynamics.com/bincrowd.html http://www.zynamics.com/bincrowd.html The plugin is open source and the community server is free.
- mukyu 16y agoI wanted to post about this, but I could not remember the name and googling things like '(collaborative OR crowdsource) static binary analysis' was futile. Thanks, it was driving me insane.
- rst 16y agoAlthough in this case, the object code may have been deliberately obscured. On reflection, I can't help wondering how much of the seemingly pointless diddling of local variables is the result of turning a naive decompiler on a bytestream where the actual instructions are somehow encrypted or masked.
- viraptor 16y agoI really don't think so. The decompilation result is genuinely silly. For example look at: if (*(int*)(local2 + global0) == 0x4550) { local5 = *(unsigned short*)(local2 + global0 + 20); Either local2 or global0 are pointers to a structure. Neither is detected. Most sensible decompilers would change the names and just make it `local5 = global0[local2].blah` instead. Advanced decompilers also can avoid gotos in almost any case. It also uses function calls without parameters or output, assuming some stack layout probably. It's a really really bad output, not a result of obscured compilation.
- DCoder 16y agoI've seen HexRays do the same thing - most of the time you need to actually tell it that a variable is a pointer before it tries to do that. Stating the function type explicitly also helps it display the right arguments given to it. This output could be significantly improved if the assembly version were available as well.
- updog 16y agoThis came from one of the better known commercial decompilers. Which ones do you consider 'advanced'?
- viraptor 16y agoPointed out before: http://news.ycombinator.com/item?id=2214052 http://news.ycombinator.com/item?id=2214052 - this is from boomerang - not a known commercial decompiler really.
- NateLawson 16y ago
- deleted 16y ago[deleted]