Saltar al contenido
Skillpedia
Bases de datos35 mil · #8309

performing-sqlite-database-forensics

Qué hace

Esta herramienta te ayuda a investigar bases de datos SQLite, que muchas aplicaciones usan para guardar información. Busca datos que se han borrado o que aún no se han guardado de forma definitiva, como el historial de navegación o los mensajes.

Cuándo usarla

  • ✓Cuando investigas un incidente de seguridad.
  • ✓Cuando pruebas la seguridad de aplicaciones que usan SQLite.
  • ✓Cuando intentas recuperar información perdida de una base de datos.

Link de la skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-sqlite-database-forensics/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-sqlite-database-forensics/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Recupera los datos borrados de la base de datos de WhatsApp.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La herramienta examina la estructura interna de la base de datos SQLite y busca fragmentos de datos que están marcados como borrados pero que todavía no se han eliminado del todo. También analiza los archivos de registro que guardan los cambios antes de que se confirmen.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Performing SQLite Database Forensics

Overview

SQLite 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.

When to Use

  • When conducting security assessments that involve performing sqlite database forensics
  • When following incident response procedures for related security events
  • When performing scheduled security testing or auditing activities
  • When validating security controls through hands-on testing

Prerequisites

  • DB Browser for SQLite (sqlitebrowser)
  • SQLite command-line tools (sqlite3)
  • Python 3.8+ with sqlite3 module
  • Belkasoft Evidence Center or Axiom (commercial)
  • Hex editor (HxD, 010 Editor) for manual page inspection
  • Understanding of B-tree data structures

SQLite Internal Structure

Database Header (First 100 Bytes)

Offset Size Description
0 16 Magic string: "SQLite format 3\000"
16 2 Page size (512-65536 bytes)
18 1 File format write version
19 1 File format read version
24 4 File change counter
28 4 Database size in pages
32 4 First freelist trunk page number
36 4 Total freelist pages
52 4 Text encoding (1=UTF-8, 2=UTF-16le, 3=UTF-16be)
96 4 Version-valid-for number

Page Types

Type ID Description
B-tree Interior 0x05 Internal table node
B-tree Leaf 0x0D Table leaf page containing actual records
Index Interior 0x02 Internal index node
Index Leaf 0x0A Index leaf page
Freelist Trunk - Tracks freed pages
Freelist Leaf - Freed page with recoverable data
Overflow - Continuation of large records

Deleted Record Recovery

Method 1: Freelist Page Analysis

When records are deleted, SQLite may place their pages on the freelist rather than overwriting them immediately.

import struct
import sqlite3
import os


def analyze_freelist(db_path: str) -> dict:
    """Analyze SQLite freelist to identify pages containing deleted data."""
    with open(db_path, "rb") as f:
        # Read header
        header = f.read(100)
        page_size = struct.unpack(">H", header[16:18])[0]
        if page_size == 1:
            page_size = 65536
        first_freelist_page = struct.unpack(">I", header[32:36])[0]
        total_freelist_pages = struct.unpack(">I", header[36:40])[0]

        freelist_info = {
            "page_size": page_size,
            "first_freelist_page": first_freelist_page,
            "total_freelist_pages": total_freelist_pages,
            "trunk_pages": [],
            "leaf_pages": []
        }

        if first_freelist_page == 0:
            return freelist_info

        # Walk the freelist trunk chain
        trunk_page = first_freelist_page
        while trunk_page != 0:
            offset = (trunk_page - 1) * page_size
            f.seek(offset)
            page_data = f.read(page_size)

            next_trunk = struct.unpack(">I", page_data[0:4])[0]
            leaf_count = struct.unpack(">I", page_data[4:8])[0]

            leaves = []
            for i in range(leaf_count):
                leaf_page = struct.unpack(">I", page_data[8 + i * 4:12 + i * 4])[0]
                leaves.append(leaf_page)

            freelist_info["trunk_pages"].append({
                "page_number": trunk_page,
                "next_trunk": next_trunk,
                "leaf_count": leaf_count,
                "leaf_pages": leaves
            })
            freelist_info["leaf_pages"].extend(leaves)
            trunk_page = next_trunk

    return freelist_info


def extract_freelist_content(db_path: str, output_dir: str):
    """Extract raw content from freelist pages for analysis."""
    info = analyze_freelist(db_path)
    os.makedirs(output_dir, exist_ok=True)

    with open(db_path, "rb") as f:
        page_size = info["page_size"]

…
Preguntas frecuentes

¿Qué es una base de datos SQLite?

Es un tipo de base de datos ligero y sencillo que usan muchas aplicaciones de móviles y ordenadores para guardar información.

¿Qué son los 'datos borrados' en este contexto?

Es información que existía en la base de datos pero que se eliminó. La herramienta intenta encontrarla antes de que se sobrescriba de forma definitiva.

¿Qué es un archivo WAL?

WAL significa Write-Ahead Log (registro de escritura anticipada). Es un archivo que registra los cambios hechos en la base de datos antes de guardarlos de forma definitiva, lo que ayuda a recuperar datos.

Detalles

Descripción original del autor

Performs forensic analysis of SQLite databases by examining B-tree page structures, recovering deleted records from freelist pages and Write-Ahead Log (WAL) files, decoding encoded timestamps, and extracting evidence from browser history, messaging apps, and mobile device databases. Use when recovering deleted or unallocated data from a SQLite database during digital forensics or mobile/browser ev

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularidad

Estrellas en GitHub
35 mil
Posición en el ranking
#8309
Licencia
Apache-2.0
Actualizada
31/8/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas