11 ms·
Show HN: Assembly to C code Decompiler
- umanwizard 10y agoAnyone know how this compares to the industry-standard Hex-Rays Decompiler? (Sold as an add-on to IDA Pro)
- CraigJPerry 10y agoCan you actually buy it though? I have it in the back of my mind that they restrict sales of ida pro and the decompiler as an anti piracy measure.
- khedoros 10y agoThey certainly don't have a process where you can just "add to cart" on their website and hand them a couple thousand dollars. I'm not sure what extra checks they do through their sales team; maybe they're just trying to make sure that large businesses aren't buying up single-dev "Named" licenses and installing it across their organization, or maybe they're trying to verify that buyers are known security researchers, or something.
- cynix 10y agoUmm, I bought my license by doing exactly that — add to cart and fork over a few thousand dollars. I don't remember them doing any verification other than requiring a business email address.
- ultramancool 10y agoThere's some level of restriction, but copies still leak fairly often. Usually you're a few versions behind running pirated copies, rarely more than that. Many people are however used to working with its output, not due to having purchased copies, but due to having pirated copies.
- umanwizard 10y agoMy employer has a copy. I'm confident they acquired it legally.
- slrz 10y agoWhat do they think the people who want this are going to do if they can't buy it legally? I can't imagine it didn't cross their mind that those folks are likely to just...pirate it. Awesome "anti-piracy" measure.
- ryanlol 10y agoPirated IDA+hex-rays is the industry standard.
- deleted 10y ago[deleted]
- zxv 10y agoClosed source, windows only, diss-assmebles 6502 only, and expires next month. No thanks.
- zandorg 10y agoI don't like to reply to my own posts, but here goes. It's closed source just at the moment. HexRays is closed too. It can run on Linux or MacOSX as CLisp runs on those platforms. I just haven't started work on porting to new platforms. It decompiles 6502 as a proof of concept. It can decompile other CPUs, but not fully. The expiration is temporary. I intend to eliminate this. Thanks for your comments, it's great to get feedback. Just another thing: Check out the 'Samples' page to see what it can do with different CPUs.
- mike986 10y agocan yours be used to reverse engineering SNES games? Feed it the rom and have it split out c code?
- zandorg 10y agoAbsolutely, although some 6502 code is more friendly than others. SNES code can be very optimised compared to C64 code. If you make sure the binary starts at address 0, and put in the right entry point (which will be somewhere in the SNES ROM), then it should decompile it fine. Your first step will be to use the left-hand portion of the window to disassemble the NES ROM, and then once assembly files have been created, you decompile them on the right of the window. (this is all in the documentation of course).
- khedoros 10y agoHow close is the SNES 65C816(-ish) code to NES 6502(-ish) code supported in the demo version of the program? I understand that they're from the same family, but I'd expect some incompatible extensions in the more-advanced chip, at least.
- openasocket 10y agoHow do decompilers work in general? I'm imagining the normal compiler pipeline in reverse: convert the machine code into some intermediate representation, add some 'de-optimization' passes to make the control flow more clear, then a back end which converts that into a C AST, which is then printed out into valid C code.
- cosinetau 10y agoMy uni runs a systems class that does the SIC/XE architecture linker/loader in forward and reverse depending on the time of year. FWIK from classmates who made the decompiler, your post is the jist of it.
- bluetomcat 10y agoAnd if the symbols have been stripped, good luck with generating meaningful identifiers.
- zzzcpan 10y agoI don't think this can get you to a meaningful code, but more of assembly-looking C. It would require some sort of machine learning to guess code fragments with proper variable names, properly nested loops, etc.
- bluetomcat 10y agoAnd with any non-trivial amount of optimization, it would lead to horridly looking HLL code. Compilation is a very "lossy" process when optimizations are turned on.
- openasocket 10y agovariable names are almost certainly a lost cause, but IDA pro is pretty good at recovering control flow, which could be turned into C constructs (didn't Dijkstra prove something about expressing any control flow using structured programming constructs?). You'd probably need a bunch of heuristics to tell the difference between a while loop and a for loop. More ambitious would be trying to un-inline functions, which would require liberal use of the de-optimizer and recognizing common sub-structures.
- emcq 10y agoJust this week I was exploring C decompilers and stumbled upon the open source Snowman[0], which worked well for my purposes and can run in a self contained mode with a dependency on Qt5. [0] https://github.com/yegord/snowman https://github.com/yegord/snowman
- ultramancool 10y agoInteresting, Snowman is also integrated into x64dbg.
- Frondo 10y agoI'd be curious to see what C it produced if you fed it hand-written assembly.
- tptacek 10y agoDecompilers don't promise to recreate the original C code; they just promise to transform assembly instructions into some kind of C program.
- khedoros 10y agoThe game that I mentioned elsewhere in this thread seems to be a mix of C and assembly (as one would expect from an early-90s game), so I'd be curious about the same thing.
- kw71 10y agoMany instructions of machine code can be written as one C statement. There are some cases of things the cpu can do that are not standardized in C, like "arithmetic shift vs. logical shift." Maybe these instructions would be inlined.
- khedoros 10y ago> Many instructions of machine code can be written as one C statement. I'm quite aware =) Nested loops, some pointer calculations (dealing with real mode pointers), conditionals with more than one condition, and multi-step math statements seem particularly verbose, compared to their higher-level equivalents. If a piece of code gets kind of complicated, I usually hand-decompile it, and it's usually much shorter, even in fairly-naive C code.
- colejohnson66 10y agoDecompilers don't "deoptimize" programs. Compilation is a very lossy process (reused variables, moving variables to other registers, etc.). The best you'll get is some C code that, when compiled, would do the same thing as the original assembly (but probably slower). Interesting idea, nonetheless.
- joseph1234 10y agoguess what guys davido hkn gang rap and win competition form is now out on sales for purchase please call joseph on 08166840624 and also call for booking and reservation of seat dont miss out
- joseph1234 10y agoguess what guys davido hkn gang rap and win competition form is now out on sales for purchase please call joseph on 08166840624 and also call for booking and reservation of seat dont miss out