def ignorable_name(fn): """Filter out recognized pseudo-file names, accommodating user request for including dotdirs.""" if fn is None: return False if args.include_dotdirs and os.path.basename(fn) in [".", ".."]: return False return make_differential_dfxml.ignorable_name(fn)
def ignorable_name(fn): """Filter out recognized pseudo-file names, accomodating user request for including dotdirs.""" if fn is None: return False if args.include_dotdirs and os.path.basename(fn) in [".", ".."]: return False return make_differential_dfxml.ignorable_name(fn)
def main(): counter = collections.defaultdict(lambda: 0) prev_obj = None for (event, obj) in Objects.iterparse(args.input_image): if isinstance(obj, Objects.FileObject): if args.ignore_virtual_files and make_differential_dfxml.ignorable_name(obj.filename): continue counter[(obj.alloc_inode, obj.alloc_name)] += 1 #Inspect weird data if args.debug and obj.alloc_inode is None and obj.alloc_name is None: _logger.debug("Encountered a file with all-null allocation.") _logger.debug("Event: %r." % event) _logger.debug("Previous object: %s." % ET.tostring(prev_obj.to_Element())) _logger.debug("Current object: %s." % ET.tostring(obj.to_Element())) prev_obj = obj print(repr(counter))