[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GWRF04Z7R3XF3P4747CKKM":3,"skill-same:01M6GWRF04Z7R3XF3P4747CKKM":85},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M6GWRF04Z7R3XF3P4747CKKM","analyzing-prefetch-files-for-execution-history",null,"Parse Windows Prefetch files to determine program execution history including run counts, timestamps, and referenced files for forensic investigation.","micsapp\u002Fmicstec-skills","micsapp","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F82411001?v=4","01M6GWCFQ6D3PV8EHNY62NN5VW","01M6GWCFVE1PA5HG0DKC7AMFJ3",4,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"files","history","analyzing","prefetch","execution","analyzing prefetch files for execution history","evidence-collection","timestamps","evidence","investigation","analysis","collection","cybersecurity","timeline-analysis","execution-history","windows-artifacts","forensics","artifacts","run","windows","2026-11-10 10:12:30",false,"---\nname: analyzing-prefetch-files-for-execution-history\ndescription: Parse Windows Prefetch files to determine program execution history including run counts, timestamps, and referenced files for forensic investigation.\ndomain: cybersecurity\nsubdomain: digital-forensics\ntags: [forensics, prefetch, windows-artifacts, execution-history, timeline-analysis, evidence-collection]\nversion: \"1.0\"\nauthor: mahipal\nlicense: Apache-2.0\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":43,"author":44,"domain":30,"license":14,"version":45,"subdomain":46,"description":7},[34,21,33,32,31,24],"mahipal","1.0","digital-forensics","master","3f5d983eb4ef375b749adcd6b07ec03bd82ae8a8","_universal\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history",0,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills","https:\u002F\u002Fgithub.com\u002Fmicsapp","2026-03-20 11:24:18",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add micsapp\u002Fmicstec-skills --skill analyzing-prefetch-files-for-execution-history",{"tool":60,"command":61},"bunx","bunx skills add micsapp\u002Fmicstec-skills --skill analyzing-prefetch-files-for-execution-history",{"tool":63,"command":64},"pnpm","pnpm dlx skills add micsapp\u002Fmicstec-skills --skill analyzing-prefetch-files-for-execution-history","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002FSKILL.md",true,[68,73,79],{"path":69,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002FLICENSE",{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fapi-reference.md","REFERENCE","参考文档",3146,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002Freferences\u002Fapi-reference.md",{"path":80,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":83,"sourceHtmlUrl":84},"scripts\u002Fagent.py","SCRIPT","脚本",8231,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fanalyzing-prefetch-files-for-execution-history\u002Fscripts\u002Fagent.py",[86,114,136,156,174,199],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":90,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":38},"01M6HBTJ02FXBFG9NYEHHYAP52","azure-apim-architecture","Analyzes and explains Azure API Management architecture decisions for enterprise API marketplace implementations using VNet Internal mode, Front Door, hybrid authentication, and multi-environment strategies. Use when discussing APIM component selection, network topology, cost optimization, or comparing alternatives like workspaces vs instances, VNet Internal vs External mode, or Front Door vs Application Gateway.","MIT","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fcopilot-agent-skills\u002F.github\u002Fskills\u002Fazure-apim-architecture\u002FSKILL.md",[],[94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113],"architecture","azure","azure apim architecture","component","authentication","gateway","topology","Optimization","network","api","team","environment","multi-environment","workspaces","instances","selection","strategies","azure api management","mode","for",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":90,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":38},"01M6HBT7J4H082JEEA670B3EQ9","apiops-deployment","Guides deployment of Azure API Management infrastructure using Infrastructure as Code (Bicep\u002FTerraform), CI\u002FCD pipelines (GitHub Actions\u002FAzure DevOps), and APIOps workflows. Use when deploying APIM, creating pipelines, or implementing dev→test→prod promotion strategies.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fcopilot-agent-skills\u002F.github\u002Fskills\u002Fapiops-deployment\u002FSKILL.md",[],[121,122,123,124,95,125,126,127,128,129,130,131,103,104,110,132,133,111,134,135],"deployment","apiops deployment","workflows","azure devops","infrastructure","code","infrastructure as code","actions","ci","github actions","github-actions","as","guides","CI\u002FCD","implementing",{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":90,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":38},"01M6HBT2HEA23THNE9E00GYQBE","apim-policy-authoring","Creates production-ready Azure API Management policy XML for authentication (OAuth 2.0, JWT validation, subscription keys), rate limiting, CORS configuration, error handling, and API transformations. Use when implementing API security, access control, or request\u002Fresponse processing logic.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fcopilot-agent-skills\u002F.github\u002Fskills\u002Fapim-policy-authoring\u002FSKILL.md",[],[143,144,145,146,95,98,103,104,147,148,149,150,151,152,153,111,154,155,135,113],"policy","authoring","apim policy authoring","security","access","use","ready","api security","Access Control","error","processing","cors configuration","production-ready",{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":90,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":38},"01M6HBSY65SB29J9WE9KYD0K6T","api-security-review","Reviews Azure API Management configurations for security vulnerabilities, OWASP API Security Top 10 compliance, VNet Internal mode validation, Private Link verification, and Azure Security Benchmark alignment. Use when performing security audits, pre-deployment validation, or compliance reviews.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fcopilot-agent-skills\u002F.github\u002Fskills\u002Fapi-security-review\u002FSKILL.md",[],[163,146,164,103,150,165,95,121,166,167,168,169,104,170,111,171,172,173,112,113],"review","security review","api security review","benchmark","verification","owasp","owasp-api","alignment","azure security","reviews","top",{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":90,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":180,"publishedAt":38},"01M6HBSRW4PDFE6K4F8JYPZQ05","jira-cli","Interact with Jira from the command line to create, list, view, edit, and transition issues, manage sprints and epics, and perform common Jira workflows. Use when the user asks about Jira tasks, tickets, issues, sprints, or needs to manage project work items.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fawesome-copilot-agents\u002Fskills\u002Fjira-cli\u002FSKILL.md",[],[181,182,183,123,184,185,186,187,103,188,189,190,191,192,193,194,195,196,197,198],"cli","jira","jira cli","init","tasks","create","issues","common","work","command","edit","list","view","project","project work","token","line","sprints",{"skillNo":200,"name":201,"nameZh":6,"description":202,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":90,"licenseFileUrl":6,"sourceHtmlUrl":203,"categories":204,"keywords":205,"publishedAt":38},"01M6HBSNS3JHMW603G47TWE31H","calculator","Performs arbitrary-precision arithmetic calculations including addition, subtraction, multiplication, division, and exponents. Use when the user asks to calculate, compute, or evaluate math expressions, or when precise decimal arithmetic is needed to avoid floating-point errors.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fawesome-copilot-agents\u002Fskills\u002Fcalculator\u002FSKILL.md",[],[201,206,207,208,209,210,211,148,212,213],"npm","js","calculate","node","math","user","compute","errors"]