[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7E29FS83PC3HNXHZQAZR194":3,"skill-same:01M7E29FS83PC3HNXHZQAZR194":83},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M7E29FS83PC3HNXHZQAZR194","analyzing-prefetch-files-for-execution-history",null,"Parse Windows Prefetch files (versions 17, 23, 26, 30) with tools like PECmd, WinPrefetchView, or python-prefetch to determine program execution history, including run counts, execution timestamps, and referenced files\u002FDLLs. Use when building a timeline of program execution on a Windows system, confirming whether a suspicious binary ran, or correlating execution evidence with other forensic artifacts during an investigation.","sanjeevafk\u002Fagent-skills","sanjeevafk","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F230678117?v=4","01M7C540EFY46ETG1NNWKS5X3Q","Sanjeev","01M7C540F366J5C1D587BMKH9Q",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: analyzing-prefetch-files-for-execution-history\ndescription: Parse Windows Prefetch files (versions 17, 23, 26, 30) with tools like PECmd, WinPrefetchView, or python-prefetch to determine program execution history, including run counts, execution timestamps, and referenced files\u002FDLLs. Use when building a timeline of program execution on a Windows system, confirming whether a suspicious binary ran, or correlating execution evidence with other forensic artifacts during an investigation.\ndomain: cybersecurity\nsubdomain: digital-forensics\ntags:\n- forensics\n- prefetch\n- windows-artifacts\n- execution-history\n- timeline-analysis\n- evidence-collection\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- RS.AN-03\n- DE.AE-02\n- RS.MA-01\nmitre_attack:\n- T1059.001\n- T1003.001\n- T1021.002\n- T1567.002\n---\n\n# Analyzing Prefetch Files for Execution History\n\n## When to Use\n- When determining which programs were executed on a Windows system and when\n- During malware investigations to confirm execution of suspicious binaries\n- For establishing a timeline of application usage during an incident\n- When correlating program execution with other forensic artifacts\n- To identify anti-forensic tools or unauthorized software that was run\n\n## Prerequisites\n- Access to Windows Prefetch directory (C:\\Windows\\Prefetch\\) from forensic image\n- PECmd (Eric Zimmerman), WinPrefetchView, or python-prefetch parser\n- Understanding of Prefetch file format (versions 17, 23, 26, 30)\n- Windows system with Prefetch enabled (default on client OS, disabled on servers)\n- Knowledge of Prefetch naming conventions (APPNAME-HASH.pf)\n\n## Workflow\n\n### Step 1: Extract Prefetch Files from Forensic Image\n\n```bash\n# Mount the forensic image\nmount -o ro,loop,offset=$((2048*512)) \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd \u002Fmnt\u002Fevidence\n\n# Copy all prefetch files\nmkdir -p \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F\ncp \u002Fmnt\u002Fevidence\u002FWindows\u002FPrefetch\u002F*.pf \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F\n\n# Count and list prefetch files\nls -la \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | wc -l\nls -la \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | head -30\n\n# Hash all prefetch files for integrity\nsha256sum \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F*.pf > \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002Fpf_hashes.txt\n\n# Note: Prefetch filename format is EXECUTABLE_NAME-XXXXXXXX.pf\n# The hash (XXXXXXXX) is based on the executable path\n# Same executable from different paths creates different prefetch files\n```\n\n### Step 2: Parse Prefetch Files with PECmd\n\n```bash\n# Using Eric Zimmerman's PECmd (Windows or via Mono\u002FWine on Linux)\n# Download from https:\u002F\u002Fericzimmerman.github.io\u002F\n\n# Parse a single prefetch file\nPECmd.exe -f \"C:\\cases\\prefetch\\POWERSHELL.EXE-A]B2C3D4.pf\"\n\n# Parse all prefetch files and output to CSV\nPECmd.exe -d \"C:\\cases\\prefetch\\\" --csv \"C:\\cases\\analysis\\\" --csvf prefetch_results.csv\n\n# Parse with JSON output\nPECmd.exe -d \"C:\\cases\\prefetch\\\" --json \"C:\\cases\\analysis\\\" --jsonf prefetch_results.json\n\n# Output includes for each file:\n# - Executable name and path\n# - Run count\n# - Last run time (up to 8 timestamps in Windows 10)\n# - Files and directories referenced during execution\n# - Volume information (serial number, creation date)\n# - Prefetch file creation time\n```\n\n### Step 3: Parse with Python for Linux-Based Analysis\n\n```bash\npip install prefetch\n\npython3 \u003C\u003C 'PYEOF'\nimport os\nimport json\nfrom datetime import datetime\n\n# Parse prefetch files using python\nimport struct\n\ndef parse_prefetch(filepath):\n    \"\"\"Parse a Windows Prefetch file.\"\"\"\n    with open(filepath, 'rb') as f:\n        data = f.read()\n\n    # Check for MAM compressed format (Windows 10)\n    if data[:4] == b'MAM\\x04':\n        import lznt1  # or use DecompressBuffer\n        # Windows 10 prefetch files are compressed\n        print(f\"  [Compressed Win10 format - use PECmd for full parsing]\")\n        return None\n\n    # Version 17 (XP), 23 (Vista\u002F7), 26 (8.1), 30 (10)\n    version = struct.unpack('\u003CI', data[0:4])[0]\n    signature = data[4:8]\n\n    if signature != b'SCCA':\n        print(f\"  Invalid prefetch signature\")\n        return None\n\n    file_size = struct.unpack('\u003CI', data[8:12])[0]\n    exec_name = data[16:76].decode('utf-16-le').strip('\\x00')\n    run_count = struct.unpack('\u003CI', data[208:212])[0] if version >= 23 else struct.unpack('\u003CI', data[144:148])[0]\n\n    result = {\n        'version': version,\n        'executable': exec_name,\n        'file_size': file_size,\n        'run_count': run_count,\n    }\n\n    # Extract last execution timestamps\n    if version == 23:  # Vista\u002F7 - 1 timestamp\n        ts = struct.unpack('\u003CQ', data[128:136])[0]\n        result['last_run'] = filetime_to_datetime(ts)\n    elif version >= 26:  # Win8+ - up to 8 timestamps\n        timestamps = []\n        for i in range(8):\n            ts = struct.unpack('\u003CQ', data[128+i*8:136+i*8])[0]\n            if ts > 0:\n                timestamps.append(filetime_to_datetime(ts))\n        result['last_run_times'] = timestamps\n\n    return result\n\ndef filetime_to_datetime(ft):\n    \"\"\"Convert Windows FILETIME to datetime string.\"\"\"\n    if ft == 0:\n        return None\n    timestamp = (ft - 116444736000000000) \u002F 10000000\n    try:\n        return datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S UTC')\n    except (OSError, ValueError):\n        return None\n\n# Process all prefetch files\nprefetch_dir = '\u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F'\nresults = []\n\nfor filename in sorted(os.listdir(prefetch_dir)):\n    if filename.lower().endswith('.pf'):\n        filepath = os.path.join(prefetch_dir, filename)\n        print(f\"\\n=== {filename} ===\")\n        result = parse_prefetch(filepath)\n        if result:\n            print(f\"  Executable: {result['executable']}\")\n            print(f\"  Run Count:  {result['run_count']}\")\n            if 'last_run' in result:\n                print(f\"  Last Run:   {result['last_run']}\")\n            elif 'last_run_times' in result:\n                for i, ts in enumerate(result['last_run_times']):\n                    print(f\"  Run Time {i+1}: {ts}\")\n            results.append(result)\n\n# Save results\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fprefetch_analysis.json', 'w') as f:\n    json.dump(results, f, indent=2)\nPYEOF\n```\n\n### Step 4: Identify Suspicious Execution Evidence\n\n```bash\n# Search for known malicious tool names in prefetch\nls \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | grep -iE \\\n   '(MIMIKATZ|PSEXEC|WMIC|COBALT|BEACON|PWDUMP|PROCDUMP|LAZAGNE|RUBEUS|BLOODHOUND|SHARPHOUND|CERTUTIL|BITSADMIN)'\n\n# Search for script interpreters (potential malicious execution)\nls \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | grep -iE \\\n   '(POWERSHELL|CMD\\.EXE|WSCRIPT|CSCRIPT|MSHTA|REGSVR32|RUNDLL32|MSIEXEC)'\n\n# Search for remote access tools\nls \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | grep -iE \\\n   '(TEAMVIEWER|ANYDESK|LOGMEIN|VNC|SPLASHTOP|SCREENCONNECT|AMMYY)'\n\n# Search for data exfiltration tools\nls \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | grep -iE \\\n   '(RAR|7Z|ZIP|RCLONE|MEGA|DROPBOX|ONEDRIVE|GDRIVE|FTP|CURL|WGET)'\n\n# Find recently created prefetch files (newest executables run)\nls -lt \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | head -20\n\n# Cross-reference with Shimcache and Amcache for confirmation\n# Prefetch existence = program was executed at least once\n```\n\n### Step 5: Build Execution Timeline\n\n```bash\n# Create timeline from prefetch data\npython3 \u003C\u003C 'PYEOF'\nimport json\nimport csv\n\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fprefetch_analysis.json') as f:\n    data = json.load(f)\n\ntimeline = []\nfor entry in data:\n    if 'last_run_times' in entry:\n        for ts in entry['last_run_times']:\n            if ts:\n                timeline.append({\n                    'timestamp': ts,\n                    'executable': entry['executable'],\n                    'run_count': entry['run_count'],\n                    'source': 'Prefetch'\n                })\n    elif 'last_run' in entry and entry['last_run']:\n        timeline.append({\n            'timestamp': entry['last_run'],\n            'executable': entry['executable'],\n            'run_count': entry['run_count'],\n            'source': 'Prefetch'\n        })\n\n# Sort chronologically\ntimeline.sort(key=lambda x: x['timestamp'])\n\n# Write timeline CSV\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fexecution_timeline.csv', 'w', newline='') as f:\n    writer = csv.DictWriter(f, fieldnames=['timestamp', 'executable', 'run_count', 'source'])\n    writer.writeheader()\n    writer.writerows(timeline)\n\n# Print suspicious time window\nfor entry in timeline:\n    if '2024-01-15' in entry['timestamp'] or '2024-01-16' in entry['timestamp']:\n        print(f\"  {entry['timestamp']} | {entry['executable']} (x{entry['run_count']})\")\nPYEOF\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| Prefetch | Windows performance optimization that pre-loads application data and tracks execution |\n| SCCA signature | Magic bytes identifying a valid Prefetch file |\n| Path hash | CRC-based hash of the executable path forming part of the .pf filename |\n| Run count | Number of times the executable has been launched (may wrap around) |\n| Last run timestamps | Windows 8+ stores up to 8 most recent execution timestamps |\n| Referenced files | List of files and directories accessed during the first 10 seconds of execution |\n| Volume information | Drive serial number and creation date identifying the source volume |\n| MAM compression | Windows 10 Prefetch files use MAM4 compression requiring decompression before parsing |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| PECmd | Eric Zimmerman's Prefetch parser with CSV\u002FJSON output |\n| WinPrefetchView | NirSoft GUI tool for viewing Prefetch files |\n| python-prefetch | Python library for parsing Prefetch files |\n| Prefetch Hash Calculator | Tool to calculate expected hash from executable paths |\n| KAPE | Automated artifact collection including Prefetch |\n| Autopsy | Forensic platform with Prefetch analysis module |\n| Plaso\u002Flog2timeline | Super-timeline tool that includes Prefetch parser |\n| Velociraptor | Endpoint agent with Prefetch collection and analysis artifacts |\n\n## Common Scenarios\n\n**Scenario 1: Confirming Malware Execution**\nSearch Prefetch directory for the malware executable name, confirm execution via Prefetch existence, extract run count and last run time, identify referenced DLLs to understand malware behavior, correlate with registry autorun entries.\n\n**Scenario 2: Attacker Tool Usage Timeline**\nIdentify Prefetch files for PsExec, Mimikatz, BloodHound, and other attacker tools, build chronological timeline of tool execution, determine the sequence of the attack (reconnaissance, credential theft, lateral movement), match timestamps with network connection logs.\n\n**Scenario 3: Data Staging and Exfiltration**\nLook for Prefetch entries of compression tools (7z, WinRAR, zip), identify execution of file transfer utilities (rclone, FTP clients), check for cloud storage client execution, timeline when data staging and transfer occurred.\n\n**Scenario 4: Anti-Forensics Detection**\nCheck for execution of known anti-forensic tools (CCleaner, Eraser, SDelete), identify if Prefetch directory was recently cleared (fewer files than expected for active system), note timestamps of anti-forensic tool execution relative to other evidence.\n\n## Output Format\n\n```\nPrefetch Analysis Summary:\n  System: Windows 10 Pro (Build 19041)\n  Prefetch Files: 234\n  Analysis Period: All available execution history\n\n  Execution Statistics:\n    Total unique executables: 234\n    First execution: 2023-06-15 (system install)\n    Latest execution: 2024-01-18 23:45 UTC\n\n  Suspicious Executions:\n    MIMIKATZ.EXE-5F2A3B1C.pf\n      Run Count: 3 | Last: 2024-01-16 02:30:15 UTC\n    PSEXEC.EXE-AD70946C.pf\n      Run Count: 7 | Last: 2024-01-16 02:45:30 UTC\n    RCLONE.EXE-1F3E5A2B.pf\n      Run Count: 2 | Last: 2024-01-17 03:15:00 UTC\n    POWERSHELL.EXE-022A1004.pf\n      Run Count: 145 | Last: 2024-01-18 14:00:00 UTC\n\n  Attack Timeline (from Prefetch):\n    2024-01-15 14:32 - POWERSHELL.EXE (initial access)\n    2024-01-16 02:30 - MIMIKATZ.EXE (credential theft)\n    2024-01-16 02:45 - PSEXEC.EXE (lateral movement)\n    2024-01-17 03:15 - RCLONE.EXE (data exfiltration)\n\n  Report: \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fexecution_timeline.csv\n```\n","# Analyzing Prefetch Files for Execution History\n\n## When to Use\n- When determining which programs were executed on a Windows system and when\n- During malware investigations to confirm execution of suspicious binaries\n- For establishing a timeline of application usage during an incident\n- When correlating program execution with other forensic artifacts\n- To identify anti-forensic tools or unauthorized software that was run\n\n## Prerequisites\n- Access to Windows Prefetch directory (C:\\Windows\\Prefetch\\) from forensic image\n- PECmd (Eric Zimmerman), WinPrefetchView, or python-prefetch parser\n- Understanding of Prefetch file format (versions 17, 23, 26, 30)\n- Windows system with Prefetch enabled (default on client OS, disabled on servers)\n- Knowledge of Prefetch naming conventions (APPNAME-HASH.pf)\n\n## Workflow\n\n### Step 1: Extract Prefetch Files from Forensic Image\n\n```bash\n# Mount the forensic image\nmount -o ro,loop,offset=$((2048*512)) \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd \u002Fmnt\u002Fevidence\n\n# Copy all prefetch files\nmkdir -p \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F\ncp \u002Fmnt\u002Fevidence\u002FWindows\u002FPrefetch\u002F*.pf \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F\n\n# Count and list prefetch files\nls -la \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | wc -l\nls -la \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | head -30\n\n# Hash all prefetch files for integrity\nsha256sum \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F*.pf > \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002Fpf_hashes.txt\n\n# Note: Prefetch filename format is EXECUTABLE_NAME-XXXXXXXX.pf\n# The hash (XXXXXXXX) is based on the executable path\n# Same executable from different paths creates different prefetch files\n```\n\n### Step 2: Parse Prefetch Files with PECmd\n\n```bash\n# Using Eric Zimmerman's PECmd (Windows or via Mono\u002FWine on Linux)\n# Download from https:\u002F\u002Fericzimmerman.github.io\u002F\n\n# Parse a single prefetch file\nPECmd.exe -f \"C:\\cases\\prefetch\\POWERSHELL.EXE-A]B2C3D4.pf\"\n\n# Parse all prefetch files and output to CSV\nPECmd.exe -d \"C:\\cases\\prefetch\\\" --csv \"C:\\cases\\analysis\\\" --csvf prefetch_results.csv\n\n# Parse with JSON output\nPECmd.exe -d \"C:\\cases\\prefetch\\\" --json \"C:\\cases\\analysis\\\" --jsonf prefetch_results.json\n\n# Output includes for each file:\n# - Executable name and path\n# - Run count\n# - Last run time (up to 8 timestamps in Windows 10)\n# - Files and directories referenced during execution\n# - Volume information (serial number, creation date)\n# - Prefetch file creation time\n```\n\n### Step 3: Parse with Python for Linux-Based Analysis\n\n```bash\npip install prefetch\n\npython3 \u003C\u003C 'PYEOF'\nimport os\nimport json\nfrom datetime import datetime\n\n# Parse prefetch files using python\nimport struct\n\ndef parse_prefetch(filepath):\n    \"\"\"Parse a Windows Prefetch file.\"\"\"\n    with open(filepath, 'rb') as f:\n        data = f.read()\n\n    # Check for MAM compressed format (Windows 10)\n    if data[:4] == b'MAM\\x04':\n        import lznt1  # or use DecompressBuffer\n        # Windows 10 prefetch files are compressed\n        print(f\"  [Compressed Win10 format - use PECmd for full parsing]\")\n        return None\n\n    # Version 17 (XP), 23 (Vista\u002F7), 26 (8.1), 30 (10)\n    version = struct.unpack('\u003CI', data[0:4])[0]\n    signature = data[4:8]\n\n    if signature != b'SCCA':\n        print(f\"  Invalid prefetch signature\")\n        return None\n\n    file_size = struct.unpack('\u003CI', data[8:12])[0]\n    exec_name = data[16:76].decode('utf-16-le').strip('\\x00')\n    run_count = struct.unpack('\u003CI', data[208:212])[0] if version >= 23 else struct.unpack('\u003CI', data[144:148])[0]\n\n    result = {\n        'version': version,\n        'executable': exec_name,\n        'file_size': file_size,\n        'run_count': run_count,\n    }\n\n    # Extract last execution timestamps\n    if version == 23:  # Vista\u002F7 - 1 timestamp\n        ts = struct.unpack('\u003CQ', data[128:136])[0]\n        result['last_run'] = filetime_to_datetime(ts)\n    elif version >= 26:  # Win8+ - up to 8 timestamps\n        timestamps = []\n        for i in range(8):\n            ts = struct.unpack('\u003CQ', data[128+i*8:136+i*8])[0]\n            if ts > 0:\n                timestamps.append(filetime_to_datetime(ts))\n        result['last_run_times'] = timestamps\n\n    return result\n\ndef filetime_to_datetime(ft):\n    \"\"\"Convert Windows FILETIME to datetime string.\"\"\"\n    if ft == 0:\n        return None\n    timestamp = (ft - 116444736000000000) \u002F 10000000\n    try:\n        return datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S UTC')\n    except (OSError, ValueError):\n        return None\n\n# Process all prefetch files\nprefetch_dir = '\u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F'\nresults = []\n\nfor filename in sorted(os.listdir(prefetch_dir)):\n    if filename.lower().endswith('.pf'):\n        filepath = os.path.join(prefetch_dir, filename)\n        print(f\"\\n=== {filename} ===\")\n        result = parse_prefetch(filepath)\n        if result:\n            print(f\"  Executable: {result['executable']}\")\n            print(f\"  Run Count:  {result['run_count']}\")\n            if 'last_run' in result:\n                print(f\"  Last Run:   {result['last_run']}\")\n            elif 'last_run_times' in result:\n                for i, ts in enumerate(result['last_run_times']):\n                    print(f\"  Run Time {i+1}: {ts}\")\n            results.append(result)\n\n# Save results\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fprefetch_analysis.json', 'w') as f:\n    json.dump(results, f, indent=2)\nPYEOF\n```\n\n### Step 4: Identify Suspicious Execution Evidence\n\n```bash\n# Search for known malicious tool names in prefetch\nls \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | grep -iE \\\n   '(MIMIKATZ|PSEXEC|WMIC|COBALT|BEACON|PWDUMP|PROCDUMP|LAZAGNE|RUBEUS|BLOODHOUND|SHARPHOUND|CERTUTIL|BITSADMIN)'\n\n# Search for script interpreters (potential malicious execution)\nls \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | grep -iE \\\n   '(POWERSHELL|CMD\\.EXE|WSCRIPT|CSCRIPT|MSHTA|REGSVR32|RUNDLL32|MSIEXEC)'\n\n# Search for remote access tools\nls \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | grep -iE \\\n   '(TEAMVIEWER|ANYDESK|LOGMEIN|VNC|SPLASHTOP|SCREENCONNECT|AMMYY)'\n\n# Search for data exfiltration tools\nls \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | grep -iE \\\n   '(RAR|7Z|ZIP|RCLONE|MEGA|DROPBOX|ONEDRIVE|GDRIVE|FTP|CURL|WGET)'\n\n# Find recently created prefetch files (newest executables run)\nls -lt \u002Fcases\u002Fcase-2024-001\u002Fprefetch\u002F | head -20\n\n# Cross-reference with Shimcache and Amcache for confirmation\n# Prefetch existence = program was executed at least once\n```\n\n### Step 5: Build Execution Timeline\n\n```bash\n# Create timeline from prefetch data\npython3 \u003C\u003C 'PYEOF'\nimport json\nimport csv\n\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fprefetch_analysis.json') as f:\n    data = json.load(f)\n\ntimeline = []\nfor entry in data:\n    if 'last_run_times' in entry:\n        for ts in entry['last_run_times']:\n            if ts:\n                timeline.append({\n                    'timestamp': ts,\n                    'executable': entry['executable'],\n                    'run_count': entry['run_count'],\n                    'source': 'Prefetch'\n                })\n    elif 'last_run' in entry and entry['last_run']:\n        timeline.append({\n            'timestamp': entry['last_run'],\n            'executable': entry['executable'],\n            'run_count': entry['run_count'],\n            'source': 'Prefetch'\n        })\n\n# Sort chronologically\ntimeline.sort(key=lambda x: x['timestamp'])\n\n# Write timeline CSV\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fexecution_timeline.csv', 'w', newline='') as f:\n    writer = csv.DictWriter(f, fieldnames=['timestamp', 'executable', 'run_count', 'source'])\n    writer.writeheader()\n    writer.writerows(timeline)\n\n# Print suspicious time window\nfor entry in timeline:\n    if '2024-01-15' in entry['timestamp'] or '2024-01-16' in entry['timestamp']:\n        print(f\"  {entry['timestamp']} | {entry['executable']} (x{entry['run_count']})\")\nPYEOF\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| Prefetch | Windows performance optimization that pre-loads application data and tracks execution |\n| SCCA signature | Magic bytes identifying a valid Prefetch file |\n| Path hash | CRC-based hash of the executable path forming part of the .pf filename |\n| Run count | Number of times the executable has been launched (may wrap around) |\n| Last run timestamps | Windows 8+ stores up to 8 most recent execution timestamps |\n| Referenced files | List of files and directories accessed during the first 10 seconds of execution |\n| Volume information | Drive serial number and creation date identifying the source volume |\n| MAM compression | Windows 10 Prefetch files use MAM4 compression requiring decompression before parsing |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| PECmd | Eric Zimmerman's Prefetch parser with CSV\u002FJSON output |\n| WinPrefetchView | NirSoft GUI tool for viewing Prefetch files |\n| python-prefetch | Python library for parsing Prefetch files |\n| Prefetch Hash Calculator | Tool to calculate expected hash from executable paths |\n| KAPE | Automated artifact collection including Prefetch |\n| Autopsy | Forensic platform with Prefetch analysis module |\n| Plaso\u002Flog2timeline | Super-timeline tool that includes Prefetch parser |\n| Velociraptor | Endpoint agent with Prefetch collection and analysis artifacts |\n\n## Common Scenarios\n\n**Scenario 1: Confirming Malware Execution**\nSearch Prefetch directory for the malware executable name, confirm execution via Prefetch existence, extract run count and last run time, identify referenced DLLs to understand malware behavior, correlate with registry autorun entries.\n\n**Scenario 2: Attacker Tool Usage Timeline**\nIdentify Prefetch files for PsExec, Mimikatz, BloodHound, and other attacker tools, build chronological timeline of tool execution, determine the sequence of the attack (reconnaissance, credential theft, lateral movement), match timestamps with network connection logs.\n\n**Scenario 3: Data Staging and Exfiltration**\nLook for Prefetch entries of compression tools (7z, WinRAR, zip), identify execution of file transfer utilities (rclone, FTP clients), check for cloud storage client execution, timeline when data staging and transfer occurred.\n\n**Scenario 4: Anti-Forensics Detection**\nCheck for execution of known anti-forensic tools (CCleaner, Eraser, SDelete), identify if Prefetch directory was recently cleared (fewer files than expected for active system), note timestamps of anti-forensic tool execution relative to other evidence.\n\n## Output Format\n\n```\nPrefetch Analysis Summary:\n  System: Windows 10 Pro (Build 19041)\n  Prefetch Files: 234\n  Analysis Period: All available execution history\n\n  Execution Statistics:\n    Total unique executables: 234\n    First execution: 2023-06-15 (system install)\n    Latest execution: 2024-01-18 23:45 UTC\n\n  Suspicious Executions:\n    MIMIKATZ.EXE-5F2A3B1C.pf\n      Run Count: 3 | Last: 2024-01-16 02:30:15 UTC\n    PSEXEC.EXE-AD70946C.pf\n      Run Count: 7 | Last: 2024-01-16 02:45:30 UTC\n    RCLONE.EXE-1F3E5A2B.pf\n      Run Count: 2 | Last: 2024-01-17 03:15:00 UTC\n    POWERSHELL.EXE-022A1004.pf\n      Run Count: 145 | Last: 2024-01-18 14:00:00 UTC\n\n  Attack Timeline (from Prefetch):\n    2024-01-15 14:32 - POWERSHELL.EXE (initial access)\n    2024-01-16 02:30 - MIMIKATZ.EXE (credential theft)\n    2024-01-16 02:45 - PSEXEC.EXE (lateral movement)\n    2024-01-17 03:15 - RCLONE.EXE (data exfiltration)\n\n  Report: \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fexecution_timeline.csv\n```\n",{"name":5,"tags":25,"author":32,"domain":33,"license":15,"version":34,"nist_csf":35,"subdomain":39,"description":7,"mitre_attack":40},[26,27,28,29,30,31],"forensics","prefetch","windows-artifacts","execution-history","timeline-analysis","evidence-collection","mahipal","cybersecurity","1.0",[36,37,38],"RS.AN-03","DE.AE-02","RS.MA-01","digital-forensics",[41,42,43,44],"T1059.001","T1003.001","T1021.002","T1567.002","main","4e084e84eb42fc53e144c89c0f7f48b39c8a4b0f","collections\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history",1,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills","https:\u002F\u002Fgithub.com\u002Fsanjeevafk","First make it work. Then make it right. Then make it fast.","2026-11-14 13:36:16",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add sanjeevafk\u002Fagent-skills --skill analyzing-prefetch-files-for-execution-history",{"tool":59,"command":60},"bunx","bunx skills add sanjeevafk\u002Fagent-skills --skill analyzing-prefetch-files-for-execution-history",{"tool":62,"command":63},"pnpm","pnpm dlx skills add sanjeevafk\u002Fagent-skills --skill analyzing-prefetch-files-for-execution-history","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002FSKILL.md",true,[67,71,77],{"path":68,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fapi-reference.md","REFERENCE","参考文档",3146,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002Freferences\u002Fapi-reference.md",{"path":78,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":81,"sourceHtmlUrl":82},"scripts\u002Fagent.py","SCRIPT","脚本",8231,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002Fscripts\u002Fagent.py",[84,92,100,108,116,123],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":20},"01M7EFHX67M3KKXT1BXVPA5ADT","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","MIT","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":96,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":20},"01M7EFFQGM51TZBGRENXY50ZYM","whiteboard-diagrams","Create accurate, simple, hand-drawn whiteboard diagrams from a user's process, system, architecture, learning workflow, comparison, or causal explanation. Use when the user asks for a scribbly whiteboard visual, educational workflow graphic, hand-drawn explainer, or diagram like the bundled reference; ask one focused clarification question when the subject or relationships are missing, then generate and visually verify the final image.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":104,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":20},"01M7EFF1CSQNTDMHFK4ZGY6NYK","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":112,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":20},"01M7EFE8106X6C28FT8PA74427","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":20},"01M7EFCSNZM9G7ZHS6F127Q71X","verification-loop","A comprehensive verification system for Claude Code sessions.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":127,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":20},"01M7EFCE7EZMKPRYDDNKBQ9EEH","vercel-deploy","Deploy applications and websites to Vercel. Use when the user requests deployment actions like \"deploy my app\", \"deploy and give me the link\", \"push this live\", or \"create a preview deployment\".","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FSKILL.md",[],[]]