Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Thomas GF · Apr 04, 2013 at 09:11 PM · androidiosaotobfuscation

iOS obfuscation: mono-xcompile produces broken .dll.s

I've been experimenting with obfuscation for Assembly-CSharp.dll on Android and iOS. For Android it was quite simple.

  • extract the dll from the apk

  • obfuscate it

  • put it back in the apk

  • re-sign it

For iOS it proved to be much more difficult. After Unity generates the XCode project, there is a corresponding .dll.s file for every managed .dll. After lots of googling I found that these .dll.s files are generated from the .dll files by a tool named mono-xcompiler. This tool is invoked by Unity during the build process.

So my strategy was:

  • let Unity build an XCode project

  • remove the old Assembly-CSharp.dll.s from Libraries/

  • obfuscate Data/Managed/Assembly-CSharp.dll

  • generate a new Assembly-CSharp.dll.s from the obfuscated Assembly-CSharp.dll using mono-xcompiler which comes with Unity

  • let XCode build the app

However, building the app fails while XCode tries to compile Assembly-CSharp.dll.s into Assembly-CSharp.dll.o. I don't have access to the build environment atm, so I can't give you the exact CompileC command, but the error was something like

/path/to/Assembly-CSharp.dll.s:[numbers]:[number]: error: invalid symbol redefinition plt__class_init_____: ^

/path/to/Assembly-CSharp.dll.s:[numbers]:[number]: error: invalid symbol redefinition plt_class_init: ^

/path/to/Assembly-CSharp.dll.s:[numbers]:[number]: error: invalid symbol redefinition plt_class_init: ^

I suspect one of the following:

  • I used Eazfuscator.NET to obfuscate the Assembly-CSharp.dll on Windows, however the file was surrounded only by iOS-versions of dependency DLLs so it should be fine. Still, it might be a problem.

  • I might have used mono-xcompiler in a wrong way:

    export MONO_PATH=[xcode-project]/Data/Managed
    export GAC_PATH=[xcode-project]/Data/Managed
    export GC_DONT_GC="yes please"
    mono-xcompiler --aot=full,static,nodebug,asmonly,outfile="../Libraries/Assembly-CSharp.dll.s" "Managed/Assembly-CSharp.dll"

  • mono-xcompiler or .dll.s-files might be unable to handle an obfuscated .dll. This would totally suck.

Any ideas? Any information about mono-xcompiler or .dll.s that might be helpful?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Thomas GF · Apr 05, 2013 at 01:22 PM

And I answer myself: plt__class_init_____ (the board filters out the underscores, sorry for that) is actually the static class initializer of a .NET class. And there are exactly as many errors as there are static class initializers in my dll :-) So I removed name obfuscation for those classes and voila: everything works as intended, I have an obfuscated dll in my iOS app.

I am still planning to figure out how I can have class names of classes obfuscated, that use static initializers, but that shouldn't be much of a problem. In the worst case I'll have to replace the static initializers or encapsulate them into another class or something.

Still: obfuscation for Android and iOS works, q.e.d.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TriplePAF · Jun 16, 2014 at 07:44 PM 0
Share

Can you assist me in running these lines. I don't know how to start.

Where do i have to put these. It doesn't look like regular ter$$anonymous$$al commands:

 export $$anonymous$$ONO_PATH=[xcode-project]/Data/$$anonymous$$anaged 
 export GAC_PATH=[xcode-project]/Data/$$anonymous$$anaged 
 export GCDONTGC="yes please"

Thanks,

Peter. :-)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

AOT Error for plugin that support both iOS and Android 0 Answers

C++ windows DLL and Android? 1 Answer

I'm looking for help with enemy AI scripting and animations. 1 Answer

iOS and Android Publishing 2 Answers

GameObjects Array Problem 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges