#!/usr/bin/env python3 """Windows Prefetch file analysis agent for program execution history forensics.""" import struct import os import sys import datetime import json import glob def parse_prefetch_header(filepath): """Parse the Prefetch file header to extract execution metadata.""" with open(filepath, "rb") as f: data = f.read() # Check for compression (Windows 10 prefetch files are MAM compressed) if data[:4] == b"MAM\x04": # Windows 10 compressed format - need decompression return {"error": "Compressed prefetch (Windows 10 MAM format) - use PECmd for full parsing", "compressed": True, "raw_size": len(data)} # Standard prefetch header (versions 17, 23, 26, 30) if len(data) < 84: return {"error": "File too small to be a valid prefetch file"} version = struct.unpack_from(" # Analyze all .pf files") print(f" python agent.py # Analyze single prefetch file")