def EnumerateFilesystemsFromClient(args): """List all local filesystems mounted on this system.""" del args # Unused. for fs_struct in client_utils_osx.GetFileSystems(): yield rdf_client_fs.Filesystem( device=fs_struct.f_mntfromname, mount_point=fs_struct.f_mntonname, type=fs_struct.f_fstypename) drive_re = re.compile("r?disk[0-9].*") for drive in os.listdir("/dev"): if not drive_re.match(drive): continue path = os.path.join("/dev", drive) try: img_inf = pytsk3.Img_Info(path) # This is a volume or a partition - we send back a TSK device. yield rdf_client_fs.Filesystem(device=path) vol_inf = pytsk3.Volume_Info(img_inf) for volume in vol_inf: if volume.flags == pytsk3.TSK_VS_PART_FLAG_ALLOC: offset = volume.start * vol_inf.info.block_size yield rdf_client_fs.Filesystem( device="{path}:{offset}".format(path=path, offset=offset), type="partition") except (IOError, RuntimeError): continue
def Run(self, unused_args): """List all local filesystems mounted on this system.""" for fs_struct in client_utils_osx.GetFileSystems(): self.SendReply( rdf_client.Filesystem(device=fs_struct.f_mntfromname, mount_point=fs_struct.f_mntonname, type=fs_struct.f_fstypename)) drive_re = re.compile("r?disk[0-9].*") for drive in os.listdir("/dev"): if not drive_re.match(drive): continue path = os.path.join("/dev", drive) try: img_inf = pytsk3.Img_Info(path) # This is a volume or a partition - we send back a TSK device. self.SendReply(rdf_client.Filesystem(device=path)) vol_inf = pytsk3.Volume_Info(img_inf) for volume in vol_inf: if volume.flags == pytsk3.TSK_VS_PART_FLAG_ALLOC: offset = volume.start * vol_inf.info.block_size self.SendReply( rdf_client.Filesystem(device=path + ":" + str(offset), type="partition")) except (IOError, RuntimeError): continue