Code Monkey home page Code Monkey logo

machobfuscator's People

Contributors

kam800 avatar kjamroz-bt avatar kkosowski-bt avatar lkuczborski avatar pbogdan-bt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

machobfuscator's Issues

Re-signing run crash

Dear,
Thank you for the tools provided. When I crash after using it, like this:

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000020
VM Region Info: 0x20 is not in any region. Bytes before following region: 4328620000
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 0000000102018000-0000000102198000 [ 1536K] r-x/r-x SM=COW ...pp/appName

How can I solve this problem?

MachObfuscator crashes

Hi!

I builded MachObufscator and SimpleMacApp, then copy them in folder
Running terminal and wrote ./MachObfuscator -v SimpleMacApp.app/
But nothing happened (obfuscation I mean)

Will obfuscate file:///Users/pavel/Documents/MachObfuscator/SimpleMacApp.app
Looking for dependencies...
0 obfuscable images
0 obfuscable NIBs
Collecting symbols...
0 obfuscable selectors
0 obfuscable classes
0 unobfuscable selectors
0 unobfuscable classes
Mangling symbols...
0 mangled selectors
0 mangled classes
Saving all the files in place...
BYE
MacBook-Pro-Pavel:MachObfuscator pavel$

What I made wrong?

Obfuscate type name for ObjC properties

Obfuscate type name for ObjC properties. Type name is referenced in property attributes and it is stored in __cstring section.
Types should be obfuscated in classes, protocol, categories.

Add option to obfuscate given framework

Add option to obfuscate given framework. When using --skip-all-frameworks it would be convenient to select (maybe only a few) frameworks that should be obfuscated.

Some methods will be deleted

Dear
When I use MachObfuscator -v MyApp.app, I found that some method names are missing in __objc_methname, like this:

before:
image
image

after:
image
image

initData:: and login:: is miss, I can't find what caused it.
I hope you can help me solve, Thanks

Handle UTF8 classnames and selectors in RealWordsMangler

In RealWords mangler we need to generate identifier of the same length in bytes as original identifier. Original identifier could contain multibyte UTF8 characters but mangled names contain only ascii characters.

Currently MachObfuscator crashes on precondition in Data.replaceStrings due to different lengths in bytes before and after mangling.

Add debug log level

Add debug log level so more information useful for diagnosing with obfuscation problems may be provided to the user if requested.

Fatal Error: Reverse Mangler Clash

When using caesar mode, MachObfuscator crashes:

Fatal error: ReverseMangler clashed on symbol '�A': file /Users/lukas/Downloads/MachObfuscator-master/MachObfuscator/SymbolMangling/CaesarMangler/CaesarMangler.swift, line 30

./BuildPhases/obfuscation: line 30: 9155 Illegal instruction: 4 MachObfuscator -v -m caesar //Users/lukas/Library/Developer/Xcode/DerivedData/Wakanda-fuikddtnfvllirgvhznhqqfaeofh/Build/Products/Debug-iphoneos/{REMOVED}.app

Using XCode 10.2.1 and the newest sources of MachObfuscator from master branch. realWords mode works fine.

Obfuscate methtype section using mangled class names

Obfuscate methtype section using mangled class names

Entirely erasing methtype section causes problems for example with code utilizing NSMethodSignature. Format of methtype strings is not well documented (https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100 - but this does not explain strings that I saw in binaries), according to the docs it is implementation-specific (https://developer.apple.com/documentation/foundation/nsmethodsignature)

app crashes after using MachObfuscator processing

When I use MachObfuscator by type MachObfuscator -v XXX.app, the process is done well, but the XXX.app will crash each time when I tap the iPhone. It seems the app could not locate some method and crashes.

Obfuscate IPA

I followed following steps:

XCode > Product > Archive > Distribute App > Enterprise > Next > Again Next > Once Again Next > and generated IPA file. . . now am trying to use instructions https://github.com/kam800/MachObfuscator#integration-with-fastlane- . . . but getting an error


PrivateNetwork:untitled folder excel$ cd /Users/excel/Downloads/MachObfuscator 

PrivateNetwork:MachObfuscator excel$ ./obfuscate.sh /Users/excel/Music/santhosh_m_kunthe/wastes/testes/Dummyy.ipa NO_RESIGN MACH_OBFUSCATOR
rm: /Users/excel/Music/santhosh_m_kunthe/wastes/testes/Dummyy.ipa_obf.ipa: No such file or directory
Unzipping...
Obfuscating...
ls: ./MachObfuscator.exe: No such file or directory

PrivateNetwork:MachObfuscator excel$ 

WARN: Unable to resolve dylib path /System/Library/Frameworks/XXX

Looking for dependencies...
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreMotion.framework/CoreMotion
WARN: Unable to resolve dylib path /usr/lib/libSystem.B.dylib
WARN: Unable to resolve dylib path /System/Library/Frameworks/MediaToolbox.framework/MediaToolbox
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreText.framework/CoreText
WARN: Unable to resolve dylib path /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
WARN: Unable to resolve dylib path /System/Library/Frameworks/AVFoundation.framework/AVFoundation
WARN: Unable to resolve dylib path /System/Library/Frameworks/CFNetwork.framework/CFNetwork
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreLocation.framework/CoreLocation
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreMedia.framework/CoreMedia
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreVideo.framework/CoreVideo
WARN: Unable to resolve dylib path /System/Library/Frameworks/Foundation.framework/Foundation
WARN: Unable to resolve dylib path /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer
WARN: Unable to resolve dylib path /System/Library/Frameworks/OpenAL.framework/OpenAL
WARN: Unable to resolve dylib path /System/Library/Frameworks/OpenGLES.framework/OpenGLES
WARN: Unable to resolve dylib path /System/Library/Frameworks/QuartzCore.framework/QuartzCore
WARN: Unable to resolve dylib path /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
WARN: Unable to resolve dylib path /System/Library/Frameworks/UIKit.framework/UIKit
WARN: Unable to resolve dylib path /usr/lib/libiconv.2.dylib
WARN: Unable to resolve dylib path /System/Library/Frameworks/Metal.framework/Metal
WARN: Unable to resolve dylib path /System/Library/Frameworks/GameController.framework/GameController
WARN: Unable to resolve dylib path /System/Library/Frameworks/Security.framework/Security
WARN: Unable to resolve dylib path /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
WARN: Unable to resolve dylib path /usr/lib/libicucore.A.dylib
WARN: Unable to resolve dylib path /System/Library/Frameworks/AdSupport.framework/AdSupport
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreImage.framework/CoreImage
WARN: Unable to resolve dylib path /System/Library/Frameworks/WebKit.framework/WebKit
WARN: Unable to resolve dylib path /System/Library/Frameworks/AssetsLibrary.framework/AssetsLibrary
WARN: Unable to resolve dylib path /System/Library/Frameworks/StoreKit.framework/StoreKit
WARN: Unable to resolve dylib path /usr/lib/libz.1.dylib
WARN: Unable to resolve dylib path /System/Library/Frameworks/Photos.framework/Photos
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
WARN: Unable to resolve dylib path /usr/lib/libsqlite3.dylib
WARN: Unable to resolve dylib path /usr/lib/libobjc.A.dylib
WARN: Unable to resolve dylib path /usr/lib/libc++.1.dylib
WARN: Unable to resolve dylib path /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation

Speedup compilation

Compilation in Xcode11 is terribly slow. It looks like Apple fixed the Set.union performance.
Screenshot 2019-10-07 at 21 53 45

IPA file does not contain SwiftSupport directory

AppStore rejects our build due to missing SwiftSupport folder inside IPA file.
After analyzing source and target ipa files, the source one contains SwiftSupport folder, while obfuscated one does not.

Error message from AppStoreConnect:
ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.

image

Of course, unobfuscated app goes through AppStoreConnect without any issues.

Obfuscator destroys ivar_layout

Obfuscator probably should not destroy ivar_layout for ObjC classes. ivar_layout is stored in __objc_classname section alongside regular class names. Its format is 0-terminated byte array. __objc_classname section may contain also other class-related strings/byte arrays.

App file crash because obfuscated Set function

Hi Kam
I do appreciate this repo help me to solve the obfuscator problem. But I found a problem when I obfuscated .app file. This is the log:

2019-12-23 22:03:56.963655+0800 Simulation[3932:439170] -[XXXxxx setApiVersion:]: unrecognized selector sent to instance 0x280bb2780
2019-12-23 22:03:56.966199+0800 Simulation[3932:439170] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[XXXxxx setApiVersion:]: unrecognized selector sent to instance 0x280bb2780'
*** First throw call stack:
(0x1af5b180c 0x1af2d9fa4 0x1af4b536c 0x1af5b5c88 0x1af5b7a6c 0x1051f8578 0x1051f13e4 0x1051dae10 0x104f035e8 0x10573ffb8 0x1b3610ecc 0x1b3612cf8 0x1b361852c 0x1b2de6c3c 0x1b327bf9c 0x1b2de7724 0x1b2de717c 0x1b2de7550 0x1b2de6e0c 0x1b2deb328 0x1b31ae67c 0x1b3295588 0x1b2deb060 0x1b3295484 0x1b2deaecc 0x1b2c5cb04 0x1b2c5b66c 0x1b2c5c83c 0x1b36168ac 0x1b31cf074 0x1b46b6850 0x1b46db8e8 0x1b46c0fb4 0x1b46db5a4 0x1058aabd8 0x1058adffc 0x1b47004c8 0x1b4700194 0x1b47006bc 0x1af52f7c4 0x1af52f71c 0x1af52eeb4 0x1af52a000 0x1af5298a0 0x1b9481328 0x1b361a740 0x104f2e9b0 0x1af3b4360)
libc++abi.dylib: terminating with uncaught exception of type NSException

So I add this method to --objc-blacklist-selector, but app crash again.

After I dump header, I can't found this method, but there is a property with this name.

I want to know how to add an obfuscation strategy that does not obfuscate the specified attributes.

Automatic detection of problematic libraries

MachObfuscator should detect problematic libraries (like UnityAds, Firebase Performane, Ironsource, etc...) and warn the user about the danger. MachObfuscator could also provide a brief proposal for possible actions.

Failed when build with Xcode

Dear
When build with xcode, i show "Build Failed"

/Users/LinhMui/Library/Developer/Xcode/DerivedData/MachObfuscator-hiuiglqeupyhqzfaqyqbkxxmzanu/Build/Intermediates.noindex/MachObfuscator.build/Debug/MachObfuscator.build/Script-D481608B211CF068008671D8.sh: line 2: swiftformat: command not found
Command /bin/sh failed with exit code 127

Screenshot_1

Please help me or sent me binary file when built complete
Thanks

Erase assert/fatalError file paths

__cstring section contain filenames that are generated by #file (in Swift) or __FILE__ (C/C++/ObjC)
In particular they appear when using fatalError in Swift.
They are stored in binary near class names, so they should be deleted to not give original class name this way.

It is hard to detect them, so patten (prefix) to recognize them must be given as parameter.

Unsupported mach binary magic CEFAEDFE

I try to obfuscate the binary for an application I have built -

Will obfuscate file:///Users/mukoan/Programs/Yoyodyne.app/Contents/MacOS/Yoyodyne
Looking for dependencies...
WARN: Unable to resolve dylib path /AppleInternal/Library/Frameworks/InputMethodKitInternal.framework/Versions/A/InputMethodKitInternal
Fatal error: Unsupported mach binary magic CEFAEDFE: file /Users/mukoan/Software/MachObfuscator/MachObfuscator/Mach/Mach+Loading.swift, line 61
Illegal instruction: 4

My application is a mix of C++ and ObjectiveC++.
Xcode 11.3.1
macOS 10.15.3

Simplify Options parsing code

Simplify Options parsing code by passing Options struct between main and Obfuscator instead of separate variables/fields for each setting

Add dry-run option

Add dry-run option: analyse and try to perform obfuscation but do update the images.

Can't show Unity Ads after using MachOfuscator

Dear
My game can't show Unity Ads after using MachOfuscator. Please give quick fix. Because i don't check it before submit to Apple Store, now when submit and run campaign to boost install, i got no revenue so check game again and see that. Hope you can fix only today
Screenshot_1

Thanks

Hello

can You add some code comment ? On the principle of Obfuscator, I do not understand ,thank you

Erase Swift5 reflection sections

Add Swift5 (apparently used from Swift version 4.2) reflection sections to list of erased sections. Note, that this may cause problems with running the application.

External Frameworks - NSUnknownKeyException

Hi there!

I'm trying to integrate MachObfuscator in our current project, which uses external Pods / Frameworks. Obfuscation works great - using realWords - but application crashes on runtime with NSUnknownKeyException. Seems like obfuscator replaced some of the keys in FireBase.

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ConsiderNightSize 0x2829c82a0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key dataCollectionEnabled.'
*** First throw call stack:
(0x2222b1eb8 0x2214abf18 0x2221c7c08 0x222cd0f9c 0x222d2aa88 0x222c414b4 0x100d52c68 0x100d5d868 0x1034578a0 0x103458e38 0x10345be10 0x10346a110 0x10346ab04 0x221eb6bc0 0x221ebcdd4)
libc++abi.dylib: terminating with uncaught exception of type NSException

Would be great if MachObfuscator provided more options and args, like Frameworks / types to exclude from obfuscation.

Cheers!

Lukas

Invalid input options

Hello,

I tried to use your project and discovered that there is no "--swift-obfuscation" option.

I've been using this line of code:
sh("MACH_OBFUSCATOR=../MachObfuscator ../obfuscate.sh ../exported_ipa/#{TARGET_NAME}.ipa NO_RESIGN -v --swift-obfuscation | tee ../app/obfuscation.log")

Any kind of help would be highly appreciated.

Thanks.

Obfuscation of given image

Add possibility to pass path to the image instead of directory.
If executable file of iOS app instead of directory is passed, nibs will not be loaded, so this option should not be used for iOS apps. It is aimed at MacOS apps.

Add option to replace arbitrary cstrings

Add option to replace arbitrary cstrings. This is a bit dangerous, but sometimes useful, for example if there is a text that should be obfuscated but is not a symbol.

Crashes when the binary is Chinese

It looks like a problem with URL coding.
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "未能打开文件“%E6%95%B0%E5%AD%97%E7%88%86%E7%82%B8”,因为它不存在。"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.