[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73EZC8GASA4ZHCMAS55CN17":3,"skill-same:01M73EZC8GASA4ZHCMAS55CN17":112},{"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":54,"commitSha":55,"skillDirectory":56,"forksCount":57,"repositoryHtmlUrl":58,"repositoryHomepageUrl":59,"ownerHtmlUrl":60,"ownerBlogUrl":61,"ownerDescription":62,"updatedAt":63,"install":64,"resources":77},"01M73EZC8GASA4ZHCMAS55CN17","performing-sqlite-database-forensics",null,"Perform forensic analysis of SQLite databases to recover deleted records from freelists and WAL files, decode encoded timestamps, and extract evidence from browser history, messaging apps, and mobile device databases.","Horonomos-laps\u002FYana-AI","Horonomos-laps","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F355299122?v=4","01M76B3QPXE88ET2SQPDPVATZT"," Horonomos-laps","01M72ZQRJPCYPSSWT4D00VJR2A",13,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: performing-sqlite-database-forensics\ndescription: Perform forensic analysis of SQLite databases to recover deleted records\n  from freelists and WAL files, decode encoded timestamps, and extract evidence from\n  browser history, messaging apps, and mobile device databases.\ndomain: cybersecurity\nsubdomain: digital-forensics\ntags:\n- sqlite\n- database-forensics\n- freelist\n- wal\n- write-ahead-log\n- browser-history\n- mobile-forensics\n- deleted-records\n- b-tree\n- unallocated-space\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- RS.AN-01\n- RS.AN-03\n- DE.AE-02\n- RS.MA-01\nmitre_attack:\n- T1005\n- T1074\n- T1119\n- T1070\n- T1059\nsource: https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\nsource_commit: 04450304b12645cb2b974ab96d28c0664758a88d\nnote: \"Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics\u002Fthreat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy.\"\n---\n\n# Performing SQLite Database Forensics\n\n## Overview\n\nSQLite is the most widely deployed database engine in the world, used by virtually every mobile application, web browser, and many desktop applications to store user data. In digital forensics, SQLite databases are critical evidence sources containing browser history, messaging records, call logs, GPS locations, application preferences, and cached content. Forensic analysis goes beyond simple SQL queries to examine the internal B-tree page structures, freelist pages containing deleted records, Write-Ahead Log (WAL) files preserving transaction history, and unallocated space within database pages where recoverable data may persist after deletion.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing sqlite database forensics\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- DB Browser for SQLite (sqlitebrowser)\n- SQLite command-line tools (sqlite3)\n- Python 3.8+ with sqlite3 module\n- Belkasoft Evidence Center or Axiom (commercial)\n- Hex editor (HxD, 010 Editor) for manual page inspection\n- Understanding of B-tree data structures\n\n## SQLite Internal Structure\n\n### Database Header (First 100 Bytes)\n\n| Offset | Size | Description |\n|--------|------|-------------|\n| 0 | 16 | Magic string: \"SQLite format 3\\000\" |\n| 16 | 2 | Page size (512-65536 bytes) |\n| 18 | 1 | File format write version |\n| 19 | 1 | File format read version |\n| 24 | 4 | File change counter |\n| 28 | 4 | Database size in pages |\n| 32 | 4 | First freelist trunk page number |\n| 36 | 4 | Total freelist pages |\n| 52 | 4 | Text encoding (1=UTF-8, 2=UTF-16le, 3=UTF-16be) |\n| 96 | 4 | Version-valid-for number |\n\n### Page Types\n\n| Type | ID | Description |\n|------|----|-------------|\n| B-tree Interior | 0x05 | Internal table node |\n| B-tree Leaf | 0x0D | Table leaf page containing actual records |\n| Index Interior | 0x02 | Internal index node |\n| Index Leaf | 0x0A | Index leaf page |\n| Freelist Trunk | - | Tracks freed pages |\n| Freelist Leaf | - | Freed page with recoverable data |\n| Overflow | - | Continuation of large records |\n\n## Deleted Record Recovery\n\n### Method 1: Freelist Page Analysis\n\nWhen records are deleted, SQLite may place their pages on the freelist rather than overwriting them immediately.\n\n```python\nimport struct\nimport sqlite3\nimport os\n\n\ndef analyze_freelist(db_path: str) -> dict:\n    \"\"\"Analyze SQLite freelist to identify pages containing deleted data.\"\"\"\n    with open(db_path, \"rb\") as f:\n        # Read header\n        header = f.read(100)\n        page_size = struct.unpack(\">H\", header[16:18])[0]\n        if page_size == 1:\n            page_size = 65536\n        first_freelist_page = struct.unpack(\">I\", header[32:36])[0]\n        total_freelist_pages = struct.unpack(\">I\", header[36:40])[0]\n\n        freelist_info = {\n            \"page_size\": page_size,\n            \"first_freelist_page\": first_freelist_page,\n            \"total_freelist_pages\": total_freelist_pages,\n            \"trunk_pages\": [],\n            \"leaf_pages\": []\n        }\n\n        if first_freelist_page == 0:\n            return freelist_info\n\n        # Walk the freelist trunk chain\n        trunk_page = first_freelist_page\n        while trunk_page != 0:\n            offset = (trunk_page - 1) * page_size\n            f.seek(offset)\n            page_data = f.read(page_size)\n\n            next_trunk = struct.unpack(\">I\", page_data[0:4])[0]\n            leaf_count = struct.unpack(\">I\", page_data[4:8])[0]\n\n            leaves = []\n            for i in range(leaf_count):\n                leaf_page = struct.unpack(\">I\", page_data[8 + i * 4:12 + i * 4])[0]\n                leaves.append(leaf_page)\n\n            freelist_info[\"trunk_pages\"].append({\n                \"page_number\": trunk_page,\n                \"next_trunk\": next_trunk,\n                \"leaf_count\": leaf_count,\n                \"leaf_pages\": leaves\n            })\n            freelist_info[\"leaf_pages\"].extend(leaves)\n            trunk_page = next_trunk\n\n    return freelist_info\n\n\ndef extract_freelist_content(db_path: str, output_dir: str):\n    \"\"\"Extract raw content from freelist pages for analysis.\"\"\"\n    info = analyze_freelist(db_path)\n    os.makedirs(output_dir, exist_ok=True)\n\n    with open(db_path, \"rb\") as f:\n        page_size = info[\"page_size\"]\n        for page_num in info[\"leaf_pages\"]:\n            offset = (page_num - 1) * page_size\n            f.seek(offset)\n            page_data = f.read(page_size)\n            output_file = os.path.join(output_dir, f\"freelist_page_{page_num}.bin\")\n            with open(output_file, \"wb\") as out:\n                out.write(page_data)\n\n    return len(info[\"leaf_pages\"])\n```\n\n### Method 2: WAL (Write-Ahead Log) Analysis\n\nThe WAL file contains pending transactions that have not yet been checkpointed back to the main database.\n\n```python\ndef parse_wal_header(wal_path: str) -> dict:\n    \"\"\"Parse SQLite WAL file header and frame inventory.\"\"\"\n    with open(wal_path, \"rb\") as f:\n        header = f.read(32)\n        magic = struct.unpack(\">I\", header[0:4])[0]\n        file_format = struct.unpack(\">I\", header[4:8])[0]\n        page_size = struct.unpack(\">I\", header[8:12])[0]\n        checkpoint_seq = struct.unpack(\">I\", header[12:16])[0]\n        salt1 = struct.unpack(\">I\", header[16:20])[0]\n        salt2 = struct.unpack(\">I\", header[20:24])[0]\n\n        wal_info = {\n            \"magic\": hex(magic),\n            \"format\": file_format,\n            \"page_size\": page_size,\n            \"checkpoint_sequence\": checkpoint_seq,\n            \"frames\": []\n        }\n\n        # Parse frames (24-byte header + page_size data each)\n        frame_offset = 32\n        frame_num = 0\n        file_size = os.path.getsize(wal_path)\n\n        while frame_offset + 24 + page_size \u003C= file_size:\n            f.seek(frame_offset)\n            frame_header = f.read(24)\n            page_number = struct.unpack(\">I\", frame_header[0:4])[0]\n            db_size_after = struct.unpack(\">I\", frame_header[4:8])[0]\n\n            wal_info[\"frames\"].append({\n                \"frame_number\": frame_num,\n                \"page_number\": page_number,\n                \"db_size_pages\": db_size_after,\n                \"offset\": frame_offset\n            })\n            frame_offset += 24 + page_size\n            frame_num += 1\n\n    return wal_info\n```\n\n### Method 3: Unallocated Space Within Pages\n\nDeleted cells within active B-tree pages leave data in the unallocated region between the cell pointer array and the cell content area.\n\n```python\ndef analyze_unallocated_space(db_path: str, page_number: int) -> dict:\n    \"\"\"Analyze unallocated space within a specific B-tree page.\"\"\"\n    with open(db_path, \"rb\") as f:\n        header = f.read(100)\n        page_size = struct.unpack(\">H\", header[16:18])[0]\n        if page_size == 1:\n            page_size = 65536\n\n        offset = (page_number - 1) * page_size\n        f.seek(offset)\n        page_data = f.read(page_size)\n\n        # Parse page header (8 or 12 bytes depending on type)\n        page_type = page_data[0]\n        first_freeblock = struct.unpack(\">H\", page_data[1:3])[0]\n        cell_count = struct.unpack(\">H\", page_data[3:5])[0]\n        cell_content_offset = struct.unpack(\">H\", page_data[5:7])[0]\n        if cell_content_offset == 0:\n            cell_content_offset = 65536\n\n        header_size = 12 if page_type in (0x02, 0x05) else 8\n        cell_pointer_end = header_size + cell_count * 2\n\n        unallocated_start = cell_pointer_end\n        unallocated_end = cell_content_offset\n        unallocated_size = unallocated_end - unallocated_start\n\n        return {\n            \"page_number\": page_number,\n            \"page_type\": hex(page_type),\n            \"cell_count\": cell_count,\n            \"unallocated_start\": unallocated_start,\n            \"unallocated_end\": unallocated_end,\n            \"unallocated_size\": unallocated_size,\n            \"unallocated_data\": page_data[unallocated_start:unallocated_end].hex()\n        }\n```\n\n## Common Forensic Databases\n\n| Application | Database File | Key Tables |\n|------------|--------------|------------|\n| Chrome | History | urls, visits, downloads, keyword_search_terms |\n| Firefox | places.sqlite | moz_places, moz_historyvisits |\n| Safari | History.db | history_items, history_visits |\n| WhatsApp | msgstore.db | messages, chat_list |\n| Signal | signal.sqlite | sms, mms |\n| iMessage | sms.db | message, handle, chat |\n| Android SMS | mmssms.db | sms, mms, threads |\n| Skype | main.db | Messages, Conversations |\n\n## Timestamp Decoding\n\n```python\nfrom datetime import datetime, timedelta\n\ndef decode_chrome_timestamp(chrome_ts: int) -> datetime:\n    \"\"\"Convert Chrome\u002FWebKit timestamp to datetime (microseconds since 1601-01-01).\"\"\"\n    epoch_delta = 11644473600\n    return datetime.utcfromtimestamp((chrome_ts \u002F 1000000) - epoch_delta)\n\ndef decode_unix_timestamp(unix_ts: int) -> datetime:\n    \"\"\"Convert Unix timestamp to datetime.\"\"\"\n    return datetime.utcfromtimestamp(unix_ts)\n\ndef decode_mac_absolute_time(mac_ts: float) -> datetime:\n    \"\"\"Convert Mac Absolute Time (seconds since 2001-01-01).\"\"\"\n    mac_epoch = datetime(2001, 1, 1)\n    return mac_epoch + timedelta(seconds=mac_ts)\n\ndef decode_mozilla_timestamp(moz_ts: int) -> datetime:\n    \"\"\"Convert Mozilla PRTime (microseconds since Unix epoch).\"\"\"\n    return datetime.utcfromtimestamp(moz_ts \u002F 1000000)\n```\n\n## References\n\n- SQLite File Format: https:\u002F\u002Fwww.sqlite.org\u002Ffileformat2.html\n- Belkasoft SQLite Analysis: https:\u002F\u002Fbelkasoft.com\u002Fsqlite-analysis\n- Spyder Forensics SQLite Training: https:\u002F\u002Fwww.spyderforensics.com\u002Fsqlite-forensic-fundamentals-2025\u002F\n- Forensic Analysis of Damaged SQLite Databases: https:\u002F\u002Fwww.forensicfocus.com\u002Farticles\u002Fforensic-analysis-of-damaged-sqlite-databases\u002F\n\n## Example Output\n\n```text\n$ python3 sqlite_forensics.py --db \u002Fevidence\u002Fchrome\u002FDefault\u002FHistory \\\n    --wal \u002Fevidence\u002Fchrome\u002FDefault\u002FHistory-wal \\\n    --journal \u002Fevidence\u002Fchrome\u002FDefault\u002FHistory-journal \\\n    --output \u002Fanalysis\u002Fsqlite_report\n\nSQLite Database Forensic Analyzer v2.0\n========================================\nDatabase:    \u002Fevidence\u002Fchrome\u002FDefault\u002FHistory\nSize:        48.2 MB\nSQLite Ver:  3.39.5\nPage Size:   4096 bytes\nTotal Pages: 12,345\nEncoding:    UTF-8\n\n[+] Analyzing WAL (Write-Ahead Log)...\n    WAL file:       History-wal (2.1 MB)\n    WAL frames:     512\n    Checkpointed:   No (contains uncommitted data)\n    Recoverable rows from WAL: 234\n\n[+] Analyzing journal file...\n    Journal file:   History-journal (0 bytes - rolled back)\n\n[+] Scanning for deleted records (freelist pages)...\n    Freelist pages:     456\n    Deleted records recovered: 1,892\n\n[+] Analyzing table: urls\n    Active rows:     12,456\n    Deleted rows:    1,234 (recovered from freelist)\n    WAL-only rows:   89\n\n--- Recovered Deleted URLs (Last 10) ---\nRow ID | URL                                              | Title                    | Visit Count | Last Visit (UTC)\n-------|--------------------------------------------------|--------------------------|-------------|---------------------\n89234  | https:\u002F\u002Fmega.nz\u002Ffolder\u002FxYz123#key=AbCdEf        | MEGA                     | 5           | 2024-01-16 03:20:00\n89235  | https:\u002F\u002Ftransfer.sh\u002Fabc123\u002Fdata.7z               | transfer.sh              | 1           | 2024-01-16 03:25:00\n89240  | https:\u002F\u002Ftemp-mail.org\u002Fen\u002F                        | Temp Mail                | 3           | 2024-01-15 13:00:00\n89241  | https:\u002F\u002Fbrowserleaks.com\u002Fip                      | IP Leak Test             | 1           | 2024-01-15 12:55:00\n89245  | https:\u002F\u002Fwww.virustotal.com\u002Fgui\u002Ffile\u002Fa1b2c3...    | VirusTotal               | 2           | 2024-01-15 14:30:00\n89250  | https:\u002F\u002Fgithub.com\u002Fgentilkiwi\u002Fmimikatz\u002Freleases  | Mimikatz Releases        | 1           | 2024-01-15 16:00:00\n89260  | https:\u002F\u002Fraw.githubusercontent.com\u002F...\u002Fpayload.ps1| GitHub Raw               | 1           | 2024-01-15 14:34:00\n89270  | https:\u002F\u002Fpastebin.com\u002Fedit\u002FkL9mN2pQ               | Pastebin - Edit          | 2           | 2024-01-15 14:42:00\n89280  | https:\u002F\u002Fduckduckgo.com\u002F?q=clear+browser+history  | DuckDuckGo               | 1           | 2024-01-17 22:00:00\n89285  | https:\u002F\u002Fduckduckgo.com\u002F?q=anti+forensics+tools   | DuckDuckGo               | 1           | 2024-01-17 22:05:00\n\n[+] Analyzing table: downloads\n    Active rows:     234\n    Deleted rows:    12 (recovered)\n\n--- Recovered Deleted Downloads ---\nRow ID | Filename               | URL                                    | Size      | Start Time (UTC)\n-------|------------------------|----------------------------------------|-----------|---------------------\n5012   | payload.ps1            | https:\u002F\u002Fraw.githubusercontent.com\u002F...  | 4,096     | 2024-01-15 14:34:00\n5015   | mimikatz_trunk.zip     | https:\u002F\u002Fgithub.com\u002F...\u002Freleases\u002F...    | 1,892,352 | 2024-01-15 16:00:00\n5018   | netscan_portable.zip   | https:\u002F\u002Fwww.softperfect.com\u002F...        | 5,242,880 | 2024-01-15 15:05:00\n\n[+] Slack space analysis...\n    Pages with slack space data: 234\n    Partial strings recovered:   67 fragments\n\nSummary:\n  Total records analyzed:  14,578 (active) + 3,126 (deleted\u002FWAL)\n  Evidence-relevant URLs:  23 (flagged)\n  Deleted downloads:       12 (3 tool-related)\n  Anti-forensics evidence: Browser history deletion detected\n  Report: \u002Fanalysis\u002Fsqlite_report\u002Fsqlite_forensics.json\n  Recovered DB: \u002Fanalysis\u002Fsqlite_report\u002FHistory_recovered.db\n```\n","# Performing SQLite Database Forensics\n\n## Overview\n\nSQLite is the most widely deployed database engine in the world, used by virtually every mobile application, web browser, and many desktop applications to store user data. In digital forensics, SQLite databases are critical evidence sources containing browser history, messaging records, call logs, GPS locations, application preferences, and cached content. Forensic analysis goes beyond simple SQL queries to examine the internal B-tree page structures, freelist pages containing deleted records, Write-Ahead Log (WAL) files preserving transaction history, and unallocated space within database pages where recoverable data may persist after deletion.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing sqlite database forensics\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- DB Browser for SQLite (sqlitebrowser)\n- SQLite command-line tools (sqlite3)\n- Python 3.8+ with sqlite3 module\n- Belkasoft Evidence Center or Axiom (commercial)\n- Hex editor (HxD, 010 Editor) for manual page inspection\n- Understanding of B-tree data structures\n\n## SQLite Internal Structure\n\n### Database Header (First 100 Bytes)\n\n| Offset | Size | Description |\n|--------|------|-------------|\n| 0 | 16 | Magic string: \"SQLite format 3\\000\" |\n| 16 | 2 | Page size (512-65536 bytes) |\n| 18 | 1 | File format write version |\n| 19 | 1 | File format read version |\n| 24 | 4 | File change counter |\n| 28 | 4 | Database size in pages |\n| 32 | 4 | First freelist trunk page number |\n| 36 | 4 | Total freelist pages |\n| 52 | 4 | Text encoding (1=UTF-8, 2=UTF-16le, 3=UTF-16be) |\n| 96 | 4 | Version-valid-for number |\n\n### Page Types\n\n| Type | ID | Description |\n|------|----|-------------|\n| B-tree Interior | 0x05 | Internal table node |\n| B-tree Leaf | 0x0D | Table leaf page containing actual records |\n| Index Interior | 0x02 | Internal index node |\n| Index Leaf | 0x0A | Index leaf page |\n| Freelist Trunk | - | Tracks freed pages |\n| Freelist Leaf | - | Freed page with recoverable data |\n| Overflow | - | Continuation of large records |\n\n## Deleted Record Recovery\n\n### Method 1: Freelist Page Analysis\n\nWhen records are deleted, SQLite may place their pages on the freelist rather than overwriting them immediately.\n\n```python\nimport struct\nimport sqlite3\nimport os\n\n\ndef analyze_freelist(db_path: str) -> dict:\n    \"\"\"Analyze SQLite freelist to identify pages containing deleted data.\"\"\"\n    with open(db_path, \"rb\") as f:\n        # Read header\n        header = f.read(100)\n        page_size = struct.unpack(\">H\", header[16:18])[0]\n        if page_size == 1:\n            page_size = 65536\n        first_freelist_page = struct.unpack(\">I\", header[32:36])[0]\n        total_freelist_pages = struct.unpack(\">I\", header[36:40])[0]\n\n        freelist_info = {\n            \"page_size\": page_size,\n            \"first_freelist_page\": first_freelist_page,\n            \"total_freelist_pages\": total_freelist_pages,\n            \"trunk_pages\": [],\n            \"leaf_pages\": []\n        }\n\n        if first_freelist_page == 0:\n            return freelist_info\n\n        # Walk the freelist trunk chain\n        trunk_page = first_freelist_page\n        while trunk_page != 0:\n            offset = (trunk_page - 1) * page_size\n            f.seek(offset)\n            page_data = f.read(page_size)\n\n            next_trunk = struct.unpack(\">I\", page_data[0:4])[0]\n            leaf_count = struct.unpack(\">I\", page_data[4:8])[0]\n\n            leaves = []\n            for i in range(leaf_count):\n                leaf_page = struct.unpack(\">I\", page_data[8 + i * 4:12 + i * 4])[0]\n                leaves.append(leaf_page)\n\n            freelist_info[\"trunk_pages\"].append({\n                \"page_number\": trunk_page,\n                \"next_trunk\": next_trunk,\n                \"leaf_count\": leaf_count,\n                \"leaf_pages\": leaves\n            })\n            freelist_info[\"leaf_pages\"].extend(leaves)\n            trunk_page = next_trunk\n\n    return freelist_info\n\n\ndef extract_freelist_content(db_path: str, output_dir: str):\n    \"\"\"Extract raw content from freelist pages for analysis.\"\"\"\n    info = analyze_freelist(db_path)\n    os.makedirs(output_dir, exist_ok=True)\n\n    with open(db_path, \"rb\") as f:\n        page_size = info[\"page_size\"]\n        for page_num in info[\"leaf_pages\"]:\n            offset = (page_num - 1) * page_size\n            f.seek(offset)\n            page_data = f.read(page_size)\n            output_file = os.path.join(output_dir, f\"freelist_page_{page_num}.bin\")\n            with open(output_file, \"wb\") as out:\n                out.write(page_data)\n\n    return len(info[\"leaf_pages\"])\n```\n\n### Method 2: WAL (Write-Ahead Log) Analysis\n\nThe WAL file contains pending transactions that have not yet been checkpointed back to the main database.\n\n```python\ndef parse_wal_header(wal_path: str) -> dict:\n    \"\"\"Parse SQLite WAL file header and frame inventory.\"\"\"\n    with open(wal_path, \"rb\") as f:\n        header = f.read(32)\n        magic = struct.unpack(\">I\", header[0:4])[0]\n        file_format = struct.unpack(\">I\", header[4:8])[0]\n        page_size = struct.unpack(\">I\", header[8:12])[0]\n        checkpoint_seq = struct.unpack(\">I\", header[12:16])[0]\n        salt1 = struct.unpack(\">I\", header[16:20])[0]\n        salt2 = struct.unpack(\">I\", header[20:24])[0]\n\n        wal_info = {\n            \"magic\": hex(magic),\n            \"format\": file_format,\n            \"page_size\": page_size,\n            \"checkpoint_sequence\": checkpoint_seq,\n            \"frames\": []\n        }\n\n        # Parse frames (24-byte header + page_size data each)\n        frame_offset = 32\n        frame_num = 0\n        file_size = os.path.getsize(wal_path)\n\n        while frame_offset + 24 + page_size \u003C= file_size:\n            f.seek(frame_offset)\n            frame_header = f.read(24)\n            page_number = struct.unpack(\">I\", frame_header[0:4])[0]\n            db_size_after = struct.unpack(\">I\", frame_header[4:8])[0]\n\n            wal_info[\"frames\"].append({\n                \"frame_number\": frame_num,\n                \"page_number\": page_number,\n                \"db_size_pages\": db_size_after,\n                \"offset\": frame_offset\n            })\n            frame_offset += 24 + page_size\n            frame_num += 1\n\n    return wal_info\n```\n\n### Method 3: Unallocated Space Within Pages\n\nDeleted cells within active B-tree pages leave data in the unallocated region between the cell pointer array and the cell content area.\n\n```python\ndef analyze_unallocated_space(db_path: str, page_number: int) -> dict:\n    \"\"\"Analyze unallocated space within a specific B-tree page.\"\"\"\n    with open(db_path, \"rb\") as f:\n        header = f.read(100)\n        page_size = struct.unpack(\">H\", header[16:18])[0]\n        if page_size == 1:\n            page_size = 65536\n\n        offset = (page_number - 1) * page_size\n        f.seek(offset)\n        page_data = f.read(page_size)\n\n        # Parse page header (8 or 12 bytes depending on type)\n        page_type = page_data[0]\n        first_freeblock = struct.unpack(\">H\", page_data[1:3])[0]\n        cell_count = struct.unpack(\">H\", page_data[3:5])[0]\n        cell_content_offset = struct.unpack(\">H\", page_data[5:7])[0]\n        if cell_content_offset == 0:\n            cell_content_offset = 65536\n\n        header_size = 12 if page_type in (0x02, 0x05) else 8\n        cell_pointer_end = header_size + cell_count * 2\n\n        unallocated_start = cell_pointer_end\n        unallocated_end = cell_content_offset\n        unallocated_size = unallocated_end - unallocated_start\n\n        return {\n            \"page_number\": page_number,\n            \"page_type\": hex(page_type),\n            \"cell_count\": cell_count,\n            \"unallocated_start\": unallocated_start,\n            \"unallocated_end\": unallocated_end,\n            \"unallocated_size\": unallocated_size,\n            \"unallocated_data\": page_data[unallocated_start:unallocated_end].hex()\n        }\n```\n\n## Common Forensic Databases\n\n| Application | Database File | Key Tables |\n|------------|--------------|------------|\n| Chrome | History | urls, visits, downloads, keyword_search_terms |\n| Firefox | places.sqlite | moz_places, moz_historyvisits |\n| Safari | History.db | history_items, history_visits |\n| WhatsApp | msgstore.db | messages, chat_list |\n| Signal | signal.sqlite | sms, mms |\n| iMessage | sms.db | message, handle, chat |\n| Android SMS | mmssms.db | sms, mms, threads |\n| Skype | main.db | Messages, Conversations |\n\n## Timestamp Decoding\n\n```python\nfrom datetime import datetime, timedelta\n\ndef decode_chrome_timestamp(chrome_ts: int) -> datetime:\n    \"\"\"Convert Chrome\u002FWebKit timestamp to datetime (microseconds since 1601-01-01).\"\"\"\n    epoch_delta = 11644473600\n    return datetime.utcfromtimestamp((chrome_ts \u002F 1000000) - epoch_delta)\n\ndef decode_unix_timestamp(unix_ts: int) -> datetime:\n    \"\"\"Convert Unix timestamp to datetime.\"\"\"\n    return datetime.utcfromtimestamp(unix_ts)\n\ndef decode_mac_absolute_time(mac_ts: float) -> datetime:\n    \"\"\"Convert Mac Absolute Time (seconds since 2001-01-01).\"\"\"\n    mac_epoch = datetime(2001, 1, 1)\n    return mac_epoch + timedelta(seconds=mac_ts)\n\ndef decode_mozilla_timestamp(moz_ts: int) -> datetime:\n    \"\"\"Convert Mozilla PRTime (microseconds since Unix epoch).\"\"\"\n    return datetime.utcfromtimestamp(moz_ts \u002F 1000000)\n```\n\n## References\n\n- SQLite File Format: https:\u002F\u002Fwww.sqlite.org\u002Ffileformat2.html\n- Belkasoft SQLite Analysis: https:\u002F\u002Fbelkasoft.com\u002Fsqlite-analysis\n- Spyder Forensics SQLite Training: https:\u002F\u002Fwww.spyderforensics.com\u002Fsqlite-forensic-fundamentals-2025\u002F\n- Forensic Analysis of Damaged SQLite Databases: https:\u002F\u002Fwww.forensicfocus.com\u002Farticles\u002Fforensic-analysis-of-damaged-sqlite-databases\u002F\n\n## Example Output\n\n```text\n$ python3 sqlite_forensics.py --db \u002Fevidence\u002Fchrome\u002FDefault\u002FHistory \\\n    --wal \u002Fevidence\u002Fchrome\u002FDefault\u002FHistory-wal \\\n    --journal \u002Fevidence\u002Fchrome\u002FDefault\u002FHistory-journal \\\n    --output \u002Fanalysis\u002Fsqlite_report\n\nSQLite Database Forensic Analyzer v2.0\n========================================\nDatabase:    \u002Fevidence\u002Fchrome\u002FDefault\u002FHistory\nSize:        48.2 MB\nSQLite Ver:  3.39.5\nPage Size:   4096 bytes\nTotal Pages: 12,345\nEncoding:    UTF-8\n\n[+] Analyzing WAL (Write-Ahead Log)...\n    WAL file:       History-wal (2.1 MB)\n    WAL frames:     512\n    Checkpointed:   No (contains uncommitted data)\n    Recoverable rows from WAL: 234\n\n[+] Analyzing journal file...\n    Journal file:   History-journal (0 bytes - rolled back)\n\n[+] Scanning for deleted records (freelist pages)...\n    Freelist pages:     456\n    Deleted records recovered: 1,892\n\n[+] Analyzing table: urls\n    Active rows:     12,456\n    Deleted rows:    1,234 (recovered from freelist)\n    WAL-only rows:   89\n\n--- Recovered Deleted URLs (Last 10) ---\nRow ID | URL                                              | Title                    | Visit Count | Last Visit (UTC)\n-------|--------------------------------------------------|--------------------------|-------------|---------------------\n89234  | https:\u002F\u002Fmega.nz\u002Ffolder\u002FxYz123#key=AbCdEf        | MEGA                     | 5           | 2024-01-16 03:20:00\n89235  | https:\u002F\u002Ftransfer.sh\u002Fabc123\u002Fdata.7z               | transfer.sh              | 1           | 2024-01-16 03:25:00\n89240  | https:\u002F\u002Ftemp-mail.org\u002Fen\u002F                        | Temp Mail                | 3           | 2024-01-15 13:00:00\n89241  | https:\u002F\u002Fbrowserleaks.com\u002Fip                      | IP Leak Test             | 1           | 2024-01-15 12:55:00\n89245  | https:\u002F\u002Fwww.virustotal.com\u002Fgui\u002Ffile\u002Fa1b2c3...    | VirusTotal               | 2           | 2024-01-15 14:30:00\n89250  | https:\u002F\u002Fgithub.com\u002Fgentilkiwi\u002Fmimikatz\u002Freleases  | Mimikatz Releases        | 1           | 2024-01-15 16:00:00\n89260  | https:\u002F\u002Fraw.githubusercontent.com\u002F...\u002Fpayload.ps1| GitHub Raw               | 1           | 2024-01-15 14:34:00\n89270  | https:\u002F\u002Fpastebin.com\u002Fedit\u002FkL9mN2pQ               | Pastebin - Edit          | 2           | 2024-01-15 14:42:00\n89280  | https:\u002F\u002Fduckduckgo.com\u002F?q=clear+browser+history  | DuckDuckGo               | 1           | 2024-01-17 22:00:00\n89285  | https:\u002F\u002Fduckduckgo.com\u002F?q=anti+forensics+tools   | DuckDuckGo               | 1           | 2024-01-17 22:05:00\n\n[+] Analyzing table: downloads\n    Active rows:     234\n    Deleted rows:    12 (recovered)\n\n--- Recovered Deleted Downloads ---\nRow ID | Filename               | URL                                    | Size      | Start Time (UTC)\n-------|------------------------|----------------------------------------|-----------|---------------------\n5012   | payload.ps1            | https:\u002F\u002Fraw.githubusercontent.com\u002F...  | 4,096     | 2024-01-15 14:34:00\n5015   | mimikatz_trunk.zip     | https:\u002F\u002Fgithub.com\u002F...\u002Freleases\u002F...    | 1,892,352 | 2024-01-15 16:00:00\n5018   | netscan_portable.zip   | https:\u002F\u002Fwww.softperfect.com\u002F...        | 5,242,880 | 2024-01-15 15:05:00\n\n[+] Slack space analysis...\n    Pages with slack space data: 234\n    Partial strings recovered:   67 fragments\n\nSummary:\n  Total records analyzed:  14,578 (active) + 3,126 (deleted\u002FWAL)\n  Evidence-relevant URLs:  23 (flagged)\n  Deleted downloads:       12 (3 tool-related)\n  Anti-forensics evidence: Browser history deletion detected\n  Report: \u002Fanalysis\u002Fsqlite_report\u002Fsqlite_forensics.json\n  Recovered DB: \u002Fanalysis\u002Fsqlite_report\u002FHistory_recovered.db\n```\n",{"name":5,"note":25,"tags":26,"author":37,"domain":38,"source":39,"license":15,"version":40,"nist_csf":41,"subdomain":46,"description":7,"mitre_attack":47,"source_commit":53},"Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics\u002Fthreat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy.",[27,28,29,30,31,32,33,34,35,36],"sqlite","database-forensics","freelist","wal","write-ahead-log","browser-history","mobile-forensics","deleted-records","b-tree","unallocated-space","mahipal","cybersecurity","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","1.0",[42,43,44,45],"RS.AN-01","RS.AN-03","DE.AE-02","RS.MA-01","digital-forensics",[48,49,50,51,52],"T1005","T1074","T1119","T1070","T1059","04450304b12645cb2b974ab96d28c0664758a88d","main","481dcd7dd2e288b9d627a2bd017db70e64e6c6fa","core\u002Fskills\u002Fperforming-sqlite-database-forensics",2,"https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI","https:\u002F\u002Fyana.vutam.link\u002F","https:\u002F\u002Fgithub.com\u002FHoronomos-laps","https:\u002F\u002Fyana.vutam.link","An open-source governed runtime & execution environment for multi-agent AI systems.","2026-11-12 23:12:27",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add Horonomos-laps\u002FYana-AI --skill performing-sqlite-database-forensics",{"tool":70,"command":71},"bunx","bunx skills add Horonomos-laps\u002FYana-AI --skill performing-sqlite-database-forensics",{"tool":73,"command":74},"pnpm","pnpm dlx skills add Horonomos-laps\u002FYana-AI --skill performing-sqlite-database-forensics","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002FSKILL.md",true,[78,84,88,94,98,102,108],{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"assets\u002Ftemplate.md","ASSET","资产文件",613,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002Fassets\u002Ftemplate.md",{"path":85,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":89,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Fapi-reference.md","REFERENCE","参考文档",1939,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002Freferences\u002Fapi-reference.md",{"path":95,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":96,"sourceHtmlUrl":97},"references\u002Fstandards.md",967,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002Freferences\u002Fstandards.md",{"path":99,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":100,"sourceHtmlUrl":101},"references\u002Fworkflows.md",894,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002Freferences\u002Fworkflows.md",{"path":103,"resourceType":104,"resourceTypeDesc":105,"sizeBytes":106,"sourceHtmlUrl":107},"scripts\u002Fagent.py","SCRIPT","脚本",7901,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002Fscripts\u002Fagent.py",{"path":109,"resourceType":104,"resourceTypeDesc":105,"sizeBytes":110,"sourceHtmlUrl":111},"scripts\u002Fprocess.py",7234,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fperforming-sqlite-database-forensics\u002Fscripts\u002Fprocess.py",[113,121,128,136,144,152],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":117,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":20},"01M735GKET5YVYKAY62W2P5YXB","openai--sentry--sentry","Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.","MIT","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fopenai--sentry--sentry\u002FSKILL.md",[],[],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":20},"01M73DCAP83T17HY7SMGK7MGFE","ito-basket-compare","Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fito-basket-compare\u002FSKILL.md",[],[],{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":132,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":20},"01M734CYEMZFDR3KH6SW0JP8TD","implementing-network-traffic-baselining","Build network traffic baselines from NetFlow\u002FIPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly\u002Fdaily traffic pattern profiling","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FSKILL.md",[],[],{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":140,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":20},"01M73ASZ6NJRJM44Z2P84NGQ3Q","detecting-evasion-techniques-in-endpoint-logs","Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FSKILL.md",[],[],{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":148,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":20},"01M734AFNXD06Z78QRK0VKGT7Q","implementing-microsegmentation-with-guardicore","Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FSKILL.md",[],[],{"skillNo":153,"name":154,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":20},"01M736TK27QMCXK0DVCH25SJN5","ramdisk-tmpfs-patterns","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Framdisk-tmpfs-patterns\u002FSKILL.md",[],[]]