This module is responsible for implementing the base Scanner type and various extensions to meet different scanning requirements.
This is the base
Scanner class which initialises and aggregates a
Rules class to perform match jobs against. It has the responsibility of managing a job queue and result queue and sets up the interface required for child class
Scanner implements the iter protocol which yields scan results as they complete. To enable more efficient scanning, Scanner deploys a thread pool for concurrent scanning and manages its execution through its internal job queues. Once a job completes, the job tag id and the results are returned through the dequeue function or yielded during iteration.
PathScanner([args, recurse_dirs, path_end_include, path_end_exclude, path_contains_include, path_contains_exclude, rules_rootpath, **scanner_kwargs])¶
PathScanner extends the Scanner class to enable simple queuing of filepaths found in the file system. It defines an exclude_path algorithm which utilises the path include exclude.
PathScanner has a paths property which is an interator for yielding the filepaths it discovers based on the various constraints.
The following example demonstrates how
PathScannercan be operated:# Recursively scan all subdirectories from the path '.' for path, result in PathScanner(args=['.']): print("%s : %s" % (path, result))
FileChunkScanner([file_chunk_size, file_readahead_limit, **path_scanner_kwargs])¶