2

Hope someone can help! I'm compiling an application with Xcode 10 + Swift 5, I've set all the options I've found online for mangle, stripping, reflection metadata, debug symbols, postprocessing etc.

Yet when I drop my compiled (release build) application onto Hopper, I can see ALL the names as I wrote them, no mangling occurring.

Can anyone help? How do I mangle these?

  • 1
    Mangling is primarily a C++ term; it would improve the question if you explained what you expect to happen and what you hope to achieve. – Williham Totland Aug 01 '21 at 23:42
  • Try a `strip` from the command line on the executable. If that changes what Hopper finds, then you know you missed a build flag somewhere. I'd look for a `-s` in the LDFLAGS - if such a thing exists. It's been a long time since I used xcode. Good luck! – aMike Aug 01 '21 at 23:46
  • @aMike thank you! I can still see it all in hopper after the strip though... it's showing things like: ``` DATA XREF=__objc_class__TtC12AppName12ClassName_class ``` as well as all the class property names etc – TheHoliestRoger Aug 01 '21 at 23:58
  • @WillihamTotland "Mangling" is very much present in Swift. It's how method overloading is implemented, for example. – Alexander Aug 02 '21 at 00:28
  • 1
    @TheHoliestRoger There are probably flags/tools for obfuscating the identifiers, but it'll be quite limited when interacting with Objective C, where all the class names and method selectors are intentionally kept until runtime, because they're actually how methods are dispatched. – Alexander Aug 02 '21 at 00:31

1 Answers1

0

I think you are mixing a few concepts. What are you trying to achieve? “Hide” your code so it will be hard to reverse engineer it? In that case you should look into what is called obfuscation. There several tools and methods for that. https://github.com/rockbruno/swiftshield

https://medium.com/swift2go/increase-the-security-of-your-ios-app-by-obfuscating-sensitive-strings-swift-c915896711e6

https://syrion.me/blog/ios-strings-obfuscation-in-swift/

CloudBalancing
  • 1,461
  • 2
  • 11
  • 22
  • thanks for the help, but as the title says I'm looking for MacOS solutions not iOS – TheHoliestRoger Aug 02 '21 at 22:18
  • The second post should work for macos ad well. Are you trying to obfuscate swift or objc? As mentioned in one of the comments on objc it is not possible as far as I know – CloudBalancing Aug 03 '21 at 13:26
  • 1
    thank you but I tried that too! Couldn't get it to play along. For future people finding this thread, I've now given up and written my own python script to obfuscate and deobfuscate before/after the product build process. Tedious but does the job! – TheHoliestRoger Aug 03 '21 at 19:44