Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #applink (lesser)
- #scp mobile@192.168.X.X:/var/mobile/Library/Caches/com.apple.mobile.installation.plist ./
- #plutil -i com.apple.mobile.installation.plist | applink.py xml.plist > applink.sh
- #scp applink.sh mobile@192.168.X.X:~/
- #ssh mobile@192.168.X.X
- #sh applink.sh
- PATH="/var/mobile/applink"
- applist={}
- import sys,os,plistlib,codecs
- # Gets the info from the MobileInstallation cache.
- def find_apps():
- #if not os.path.exists(plist):
- # sys.stderr.write("MobileInstallation cache not found. Fallback not available on PC.\n")
- #find_apps_old()
- # return
- try:
- mobileInstallationCache = plistlib.readPlist(sys.stdin)
- except:
- sys.stderr.write("Reading the MobileInstallation cache failed. Fallback not available on PC.\n")
- #find_apps_old()
- return
- if "User" not in mobileInstallationCache:
- sys.stderr.write("MobileInstallation cache doesn't have a User key. Fallback not available on PC.\n")
- #find_apps_old()
- return
- appStoreApps = mobileInstallationCache["User"]
- sys.stderr.write("Here are the app bundles I found:\n")
- for key in appStoreApps:
- i = appStoreApps[key]
- path = "/".join(i["Path"].rstrip("/").split("/")[:-1])
- if "CFBundleDisplayName" in i and i["CFBundleDisplayName"] != "": #os.path.exists(path)
- #dotApp = i["Path"].rstrip("/").split("/")[-1]
- #dotAppFull = path + "/" + dotApp
- if path.startswith("/private"):
- path = path.split("/private", 1)[1]
- guid = path.split("/")[-1]
- sys.stderr.write(guid+"\n")
- if i["CFBundleDisplayName"] in applist:
- sys.stderr.write("Duplicate name\n")
- #sys.stdout.write("rm \""+i["CFBundleDisplayName"]+"_"+guid+"\"\n")
- sys.stdout.write("ln -s \""+path+"\" \""+i["CFBundleDisplayName"]+"_"+guid+"\"\n")
- else:
- applist[i["CFBundleDisplayName"]]=guid
- #sys.stdout.write("rm \""+i["CFBundleDisplayName"]+"\"\n")
- sys.stdout.write("ln -s \""+path+"\" \""+i["CFBundleDisplayName"]+"\"\n")
- #main
- sys.stdout = codecs.getwriter('utf_8')(sys.stdout)
- sys.stdout.write("#!/bin/sh\n")
- #sys.stdout.write("export LC_ALL=en_US.UTF-8\n")
- sys.stdout.write("rm -rf \""+PATH+"\"\n")
- sys.stdout.write("mkdir \""+PATH+"\"\n")
- sys.stdout.write("cd \""+PATH+"\"\n")
- find_apps()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement