khanhduytran0 / LiveContainer

Run iOS app without actually installing it!
Apache License 2.0
971 stars 119 forks source link

[Question] How to install tweaks in LiveContainer #167

Open Vishram1123 opened 1 week ago

Vishram1123 commented 1 week ago

I apologize if this isn't the right place to ask, but I have been wondering, how do I install tweaks for apps in LiveContainer? I have tried to add tweaks in a .deb format as well as extracted .dylib files from the archives in the "tweaks" tab (this is version 3.0.0-release (main/6574fdd)), into folders (setting the per-app tweak folder as necessary) and in the global tab. When I add a .deb file, apps launch with no effect caused by the tweak, but with a .dylib, the following error occurs:

Error
dlopen(/private/var/mobile/Containers/Data/Application/57B2AB76-D571-43AB-A898-AC84868B708D/Documents/Tweaks/SideloadSpoofer-07.dylib, 0x0009): Library not loaded: /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate
  Referenced from: <4C0791DA-D818-30AA-B4B8-08298847A953> /private/var/mobile/Containers/Data/Application/57B2AB76-D571-43AB-A898-AC84868B708D/Documents/Tweaks/SideloadSpoofer-07.dylib
  Reason: tried: '/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate' (no such file), '/private/preboot/Cryptexes/OS/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate' (no such file), '/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate' (no such file), '/System/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate' (no such file, not in dyld cache)

This happens even after using install_name_tool -change /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate @loader_path/CydiaSubstrate.framework/CydiaSubstrate SideloadSpoofer-07.dylib to fix the CydiaSubstrate linking.

Edit: I tried this with YTSideloadFix on Youtube and Youtube Music, BHInsta on Instagram, as well as SideloadSpoofer-07 from Sideloadly's servers, and none of these work

hugeBlack commented 1 week ago

Can't reproduce. Are you sure you imported the modified one? From the error you provide I cannot find any indication of it trying to load CydiaSubstrate from @loader_path. I can successfully load it if I use @loader_path or @rpath.

By the way, LiveContainer is shipped with CydiaSubstrate so you can directly use it if you use @rpath.

Vishram1123 commented 1 week ago

Okay, so the dylib injection works with @rpath instead of @loader_path, but how do I inject straight .deb files? Do I have to extract deb files and run the install_name_tool command? If so, is there a way to do this on-device, using iSH or similar?

hugeBlack commented 1 week ago

deb is not currently supported in LiveContainer. It is possible to manipulate MachO headers on-device, but I don't know if there's a tool out there.

Vishram1123 commented 1 week ago

llvm-install-name-tool is available with iSH it seems, so I'm using that for now

Vishram1123 commented 1 week ago

Also it's weird because I added the deb one time, and it worked, but when I restarted the app, it stopped working and didn't do anything

Vishram1123 commented 1 week ago

It also seems as though there is code in LCTweaksView.swift to account for .deb installation, but I don't really understand how it works.