diff --git a/cyan/__main__.py b/cyan/__main__.py index c98ad04..1f97c2b 100755 --- a/cyan/__main__.py +++ b/cyan/__main__.py @@ -35,6 +35,10 @@ def main() -> None: "-w", "--no-watch", action="store_true", help="remove all watch apps" ) + parser.add_argument( + "-d", "--enable-documents", action="store_true", + help="enable documents support" + ) parser.add_argument( "-c", "--compress", metavar="level", type=int, default=6, diff --git a/cyan/logic.py b/cyan/logic.py index 204781f..4d0cedf 100644 --- a/cyan/logic.py +++ b/cyan/logic.py @@ -45,6 +45,8 @@ def main(parser: ArgumentParser) -> None: app.plist.remove_uisd() if args.no_watch: app.remove_watch_apps() + if args.enable_documents: + app.plist.enable_documents() # create subdirectories if necessary if "/" in args.o: diff --git a/cyan/tbhtypes/plist.py b/cyan/tbhtypes/plist.py index 620861c..193249d 100644 --- a/cyan/tbhtypes/plist.py +++ b/cyan/tbhtypes/plist.py @@ -26,10 +26,27 @@ class Plist: except KeyError: return False + def change(self, key: str, val: Any) -> bool: + try: + if self[key] == val: + return False + except KeyError: + self[key] = val + return True + def remove_uisd(self) -> None: if self.remove("UISupportedDevices"): self.save() - print("[*] removed UISupportedDevices") + print("[*] removed UISupportedDevices") else: print("[?] no UISupportedDevices") + def enable_documents(self) -> None: + c1 = self.change("UISupportsDocumentBrowser", True) + c2 = self.change("UIFileSharingEnabled", True) + + if c1 or c2: + self.save() + print("[*] enabled documents support") + else: + print("[?] documents support was already enabled")