The first programs were written in binary/hexadecimal, and only later did we invent coding languages to convert between human readable code and binary machine code.

So why can’t we just do the same thing in reverse? I hear a lot about devices from audio streaming to footware rendered useless by abandonware. Couldn’t a very smart person (or AI) just take the existing program and turn it into code?

  • foggy@lemmy.world
    link
    fedilink
    arrow-up
    74
    arrow-down
    3
    ·
    edit-2
    4 months ago

    It is not. idk who told you it was.

    Disassembling an executable is trivial to do. Everything is open source if you can read assembly. Obfuscation be damned.

    • Thorry84@feddit.nl
      link
      fedilink
      arrow-up
      56
      ·
      4 months ago

      Well decompiling is only one step in the reverse engineering process. I would recommend taking a look at the Legend of Zelda: Ocarina of Time decompile projects. They reversed engineered the whole thing, which took years and was a team effort.

      In the end they got perfectly readable source code, fully documented. And the most amazing thing is, when compiled with the right compiler and right flags, it recreates the original rom perfectly.

      I would also recommend a YouTuber called Kaze. He’s been working on Mario 64 for years, re-writing large parts of the engine to get some pretty cool stuff going.

    • LavenderDay3544@lemmy.world
      link
      fedilink
      arrow-up
      17
      arrow-down
      1
      ·
      4 months ago

      The hard part isn’t reading assembly. The hard part is figuring out why it’s doing what it’s doing with no comments or function names or anything useful to help.

      This is like saying if you can read English you can understand an advanced math or physics paper written in English without having any knowledge or context of those subjects.

    • Lemminary@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      4 months ago

      I’ve used a decompiler to peek at the source code of an app written in Visual Basic I wanted to recreate as a browser addon. It was mostly successful but some variable and function names were messed up.

      • peopleproblems@lemmy.world
        link
        fedilink
        arrow-up
        28
        ·
        4 months ago

        Variable names, class names, package structure, method names, etc. won’t normally be maintained in the disassembled code. They are meaningless to the CPU, and just a series of memory addresses. In cases where you have method names being mentioned, it’s likely a syscall, and it’s calling a method from an existing library. I’m not familiar with VB, but at least in .Net and .Net Framework, this would be something like the System.Collections.Generic providing the implementation for List<string> and when .Sort() is called, it makes the syscall to that compiled .dll.

          • peopleproblems@lemmy.world
            link
            fedilink
            arrow-up
            24
            ·
            4 months ago

            Instead of just getting the down votes, I’ll explain why that wouldnt work.

            1. The AI itself cannot decompile it without the same tools I would use. The AI would then end up with the same starting spot I have.
            2. Current LLMs do not know how to interpret code logic, and would likely make mistakes in Syscalls, register addresses, and instructions.
            3. Assembly languages themselves have nothing further than instruction sets. I’m sure there are ways to organize it in the super rare case of actually writing assembly, but not to the effect of object oriented or functional programming.

            Lastly, other comments have pointed out decompiled code is extremely expensive to analyze. The output from whatever we decompile would easily exceed the input limits for all existing LLMs.

            • Naich@lemmings.world
              link
              fedilink
              arrow-up
              2
              arrow-down
              2
              ·
              4 months ago

              Thanks. I was thinking that you could have an AI “looking over the shoulder” of a compiler, seeing what comes out for the code going in to it. Basically training it to spot sequences in compiled code in order to guess the instructions that compiled into that code.