def do_pull(self, user_args): args = user_args.split() if len(args) != 2: out = "." path = user_args else: out = args[1] path = args[0] f = self.afc.get_file_info(path) if not f: print "Source file does not exist.." return out_path = out + "/" + path if f['st_ifmt'] == 'S_IFDIR': if not os.path.isdir(out_path): os.makedirs(out_path, MODEMASK) for d in self.afc.read_directory(path): if d == "." or d == ".." or d == "": continue self.do_pull(path + "/" + d + " " + out) else: data = self.afc.get_file_contents(path) if data: if data and path.endswith(".plist"): z = parsePlist(data) plistlib.writePlist(z, out_path) else: with open(out_path, 'wb+') as f: f.write(data)
def __init__(self, domain, relative_path, flags, file_blob): self.domain = domain self.relative_path = relative_path self.flags = flags self.file_info = parsePlist(str(file_blob)) self._parse_file_info()
def do_pull(self, p): data = self.afc.get_file_contents(self.curdir + "/" + p) if data and p.endswith(".plist"): z = parsePlist(data) plistlib.writePlist(z, os.path.basename(p)) else: open(os.path.basename(p), "wb").write(data)
def do_cat(self, p): data = self.afc.get_file_contents(self.curdir + "/" + p) if data and p.endswith(".plist"): pprint(parsePlist(data)) else: print data
def do_pull(self, p): t = p.split() data = self.afc.get_file_contents(self.curdir + "/" + t[0]) if data and t[0].endswith(".plist"): z = parsePlist(data) plistlib.writePlist(z, os.path.basename(t[0])) else: if len(t) == 2: open(t[1], "wb").write(data) else: open(os.path.basename(t[0]), "wb").write(data)
def get_device_name(dataVolume): preferences = dataVolume.readFile( "/preferences/SystemConfiguration/preferences.plist", returnString=True) if preferences: preferences = parsePlist(preferences) return preferences.get("System", {}).get("System", {}).get("ComputerName", "[device name found]") return "[device name not found]"
def do_plist(self, p): d = None data = self.volume.readFile(self.get_path(p), returnString=True) if data: d = parsePlist(data) pprint(d) else: try: d = readPlist(p) if d: pprint(d) except: pass if d and d.has_key("_MKBIV"): print "=>System keybag file" print "_MKBPAYLOAD: encrypted" print "_MKBIV: %s" % d["_MKBIV"].data.encode("hex") print "_MKBWIPEID: 0x%x (%s)" % (d["_MKBWIPEID"], ("%x"%(d["_MKBWIPEID"])).decode("hex"))
def get_device_name(dataVolume): preferences = dataVolume.readFile("/preferences/SystemConfiguration/preferences.plist", returnString=True) if preferences: preferences = parsePlist(preferences) return preferences.get("System", {}).get("System", {}).get("ComputerName", "[device name found]") return "[device name not found]"
def do_cat(self, p): data = self.afc.get_file_contents(self.curdir + "/" + p) if data and p.endswith(".plist"): return parsePlist(data) else: return data