File Scanner
Phase 1 – File discovery and safe access checking
Build a Python script that walks through user-accessible directories, checks permissions before opening files, and lists only the paths that can be safely read.
- Recursively explore directories
- Check read permissions before access
- Collect readable file paths
Functional result: Script outputs a correct list of safely accessible files.
Phase 2 – Keyword search and line extraction
Extend the script to scan readable files for target keywords and print each matching line while handling errors gracefully.
- Open each readable file securely
- Search for keywords like “secret”, “password”, “info”
- Print lines containing matches
Functional result: Script outputs all detected lines containing specified keywords.