Building App file from obfuscated exe

robinscrobinsc DEMember ✭✭

Dear all,
I would like to build a program in 3 steps,
1. create the .exe file,
2. obfuscate and secure the .exe file. This I would take from the bin-folder.
3. create a .app file from the obfuscated .exe file.
I don't know how to execute the 3rd point. Is it maybe possible to do this from the shell with a mono command?
Thanks in advance
robin

Tagged:

Best Answers

  • robinscrobinsc DEMember ✭✭
    Accepted Answer

    Thanks, I found another method, simply by producing a library instead of an executable file, obfuscating the library and importing it to a new project, which produces the app-bundle.
    Maybe it's a bit complicated, but it works without manipulating the .app bundle and without requiring an apple developer account.
    I hope this helps further desperate programmers.
    Best wishes
    robin

Answers

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    The best way to inject custom work on the exe would be by using this:

    https://github.com/xamarin/mac-samples/tree/master/UseMSBuildToCopyFilesToBundleExample

    which allows commands post bundle creation and pre-signing.

    You could do it that other way, before mmp, but it might be more difficult.

    You could also look at using AOT Hybrid (https://developer.xamarin.com/guides/mac/under-the-hood/aot/#Hybrid_AOT) and strip out the IL instead, depending on your use case.

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    If you hook into this msbuild event:

        <CreateAppBundleDependsOn>$(CreateAppBundleDependsOn);OurCommand</CreateAppBundleDependsOn>
    

    Then you won't need to force a resign, since it will be done after bundle creation but before signing.

  • robinscrobinsc DEMember ✭✭

    Thanks both of you, now I got the idea, that by combining the methods it should be possible to inject the exe file without creating an apple developer account. I think in this case I should do something like this:

    @ChrisHamons said:
    $(CreateAppBundleDependsOn);OurCommand

    But what would be the OurCommand?
    I have the original bundle
    MyProgram.app including the original MyProgram.exe
    and the obfuscated
    MyProgram.exe.
    I understand that I have to replace the MyProgram.exe in the .app bundle.

    But where do I have to write this part? Into the csproj-file? And what would be the command?
    Thanks a lot
    robin

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    You will have to dig into the sample:

    https://github.com/xamarin/mac-samples/tree/master/UseMSBuildToCopyFilesToBundleExample

    in particular CustomBuildActions.targets to understand the snippet.

    In general customizing the build will require some amount of understanding of the command line invocation you want to use.

    I would do the following:

    • Build without any build customizations
    • From the command line, figure out the invocation needed to obfuscate the binary as you desire
    • Then translate that command line as the example shows.
  • robinscrobinsc DEMember ✭✭
    Accepted Answer

    Thanks, I found another method, simply by producing a library instead of an executable file, obfuscating the library and importing it to a new project, which produces the app-bundle.
    Maybe it's a bit complicated, but it works without manipulating the .app bundle and without requiring an apple developer account.
    I hope this helps further desperate programmers.
    Best wishes
    robin

Sign In or Register to comment.