Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When analyzing a binary compiled from Swift, is it possible to figure out the Swift method name for a function that has no symbol?

I'm new to disassembling and reverse engineering binaries, so forgive me if this question is nonsensical or impossible.

In the past when I've tried reverse engineering macOS binaries, analyzing the ones written in Objective-C yielded a lot of useful information, because generally all of the Objective-C classes and their method names were easily retrievable, making it a lot easier to figure out what any particular method did.

I'm trying to analyze a binary written in Swift (technically a combination of Swift and Objective-C), and most of the functions now have no symbol. There are some Objective-C methods that I can retrieve as usual, and a few functions that have a Swift-style mangled name, but nearly all of the rest have no symbol. I know a lot of those have to be Swift methods.

Is there anyway to figure out what this binary's Swift classes are and their associated methods like I can with Objective-C?

Using a tool like Hopper Disassembler reveals the mangled names of some Swift classes (usually a symbol like _TtC4Something25SomethingElse) and I can get a list of its instance variable names and their offsets, but no method names.

Note: the binary in question is an x64 macOS binary, not an iOS binary.

like image 625
Bri Bri Avatar asked Sep 13 '16 01:09

Bri Bri


1 Answers

Usually reverse engineeing is the process of extracting meaningful constructs and descriptions from assembly. What you've done so far is usually only the first part of a "normal" reverse engineeing task. This may sometimes be a tedious process, which involves mapping structures and understanding the meaning of functions directly from thier assembly code.

There are pleanty of reverse engineeing tutorials and other sources, and a good understanding of the relevant assembly language is required. I really recommand this book (it's legally available online, original version is chm released by author) and this cannot easily be covered in a single SO question.

You might also want to get more specific help in the reverse engineeing SE beta.

I hope I pointed you in the right direction.

like image 183
NirIzr Avatar answered Oct 02 '22 02:10

NirIzr