6 ms·
I've long had this idea to build a decompiler (a program that maps binaries back to source code) using machine learning. The problem in decompilation is that yo
by ma2rten 9y ago
I've long had this idea to build a decompiler (a program that maps binaries back to source code) using machine learning. The problem in decompilation is that you loose information when you compile source code. Machine learning could help even recover things like most likely variable names. There is also tons of training data that can be easily generated.
- arnioxux 9y ago> recover things like most likely variable names This is already being researched! See http://jsnice.org/ http://jsnice.org/ for recovering variable names from minified javascript. I remember testing it by coding a binary search with single letter variable names. It managed to rename them to the more canonical "lo"/"mid"/"hi" names just by recognizing that the code pattern is typically used for a binary search.
- fapjacks 9y agoI was just about to post a link! Very interesting project, and the folks behind jsnice are super cool, too.
- jayajay 9y agoIt would be interesting to automatically generate the training data and feed it to the ML module in real time. You could hard-code an interactive agent that periodically peeked and coerced the input (between itself and the ML function). This way the ML module is coercible. It would even be more cool if the ML function itself learned the interactive agent function as part of itself.
- noonespecial 9y agoI've had the same idea, but instead it could "decompile" spaghetti code with horrible variable names into something readable. It seems like a reasonable (almost believable even) first stage to software finally coming to eat the jobs of its creators.
- Swizec 9y agoOur jobs will just move an abstraction level higher. We used to have to worry about registers and stuff, then we automated that. We used to worry about memory, then we automated that. We used to worry about CPU stuff, then we automated that for most applocations. Eventually we're going to become technical PMs. As long as there will be fuzzy unclear problem descriptions, there will be jobs for people who can codify and standardize processes.
- haikuginger 9y ago"First they came for the assembly programmers..."
- Filligree 9y ago"And then they ate the universe, and there was no-one left to care." Plenty of paperclips, though.
- jhayward 9y ago> Our jobs will just move an abstraction level higher. This seems a little optimistic in terms of the average software developer's ability to think at higher and higher levels of abstraction. It's not an easy skill, and not that many people are very strong in it. Just look at how programmers today react to mathematical paradigms and explanations (category theory, anyone) in any practical setting.
- wbl 9y agoYou say that, but I've written software unrolled loops in assembler on ARM because that's what we needed.
- feelix 9y agoI'd really appreciate something that takes my hacked-together code and cleans it up and makes it presentable. That's usually the second phase of the job anyway, which could be automated.
- moyix 9y agoCast it as a reinforcement learning problem: you produce a candidate decompilation, try to compile it, and score it based on the similarity to the initial binary.
- visarga 9y agoIn a completely different approach, a neural net was trained on input-output pairs and stack traces of a program. The neural net learned the algorithm. The advantage is that all algorithms could be "neuralized".
- nradov 9y agoHow is that an advantage?
- 0xdeadbeefbabe 9y agoThe neuralized algorithms become really hard to debug? I think of it as a magicians curtain.
- jameshart 9y agoNeural nets can't magically create information that's not there; all it can do is combine the data in the binary with its learned 'experience', and make what amounts to educated guesses about what the decompiled code might be. That has value, obviously, but it's not 'recovering' anything, really, it's 'assuming'.
- scarmig 9y agoOr possibly improving upon. A variable being badly named isn't rare.
- devdoomari 9y agoyep that with a auto-spell checker would make a darn good tool! something like MS word spell checker that goes suggestion-by-suggestion and clicking yes/no/manual for var names :)
- UncleMeat 9y agoThere's been dozens of such projects at this point. http://apk-deguard.com/ http://apk-deguard.com/ is one example.