44from hawk_scanner .internals import system
55import os
66import concurrent .futures
7+ import time
78
89def process_file (file_path , key , results ):
910 matches = system .read_match_strings (file_path , 'fs' )
@@ -28,20 +29,29 @@ def execute(args):
2829 fs_config = sources_config .get ('fs' )
2930 if fs_config :
3031 for key , config in fs_config .items ():
31- path = config .get ('path' ) or os .getcwd ()
32+ if 'path' not in config :
33+ system .print_error (f"Path not found in fs profile '{ key } '" )
34+ continue
35+ path = config .get ('path' )
3236 if not os .path .exists (path ):
33- path = os .getcwd ()
37+ system .print_error (f"Path '{ path } ' does not exist" )
38+
3439 exclude_patterns = fs_config .get (key , {}).get ('exclude_patterns' , [])
40+ start_time = time .time ()
3541 files = system .list_all_files_iteratively (path , exclude_patterns )
3642
3743 # Use ThreadPoolExecutor for parallel processing
44+ file_count = 0
3845 with concurrent .futures .ThreadPoolExecutor () as executor :
3946 futures = []
4047 for file_path in files :
48+ file_count += 1
4149 futures .append (executor .submit (process_file , file_path , key , results ))
4250
4351 # Wait for all tasks to complete
4452 concurrent .futures .wait (futures )
53+ end_time = time .time ()
54+ system .print_info (f"Time taken to analyze { file_count } files: { end_time - start_time } seconds" )
4555 else :
4656 system .print_error ("No filesystem 'fs' connection details found in connection.yml" )
4757 else :
0 commit comments