Skip to main content

Overview

The ese module provides a parser for Microsoft Extensible Storage Engine (ESE) databases, commonly used in Windows for Active Directory (NTDS.dit), Windows Search, and other system components.

ESENT_DB Class

Main class for opening and querying ESE databases.

Constructor

Parameters

  • fileName (str): Path to ESE database file
  • pageSize (int): Database page size (default: 8192)
  • isRemote (bool): Whether file is remote (default: False)

Database Information

Catalog Operations

printCatalog()

Display database schema (tables, columns, indexes).

Table Structure

The catalog contains:
  • Tables: Database tables
  • Columns: Column definitions with types and IDs
  • Indexes: Index definitions
  • Long Values: Large value storage references

Table Operations

openTable()

Open a table for reading records.

Parameters

  • tableName (str/bytes): Name of table to open

Returns

Table cursor dictionary or None if table not found

getNextRow()

Read the next row from a table.

Parameters

  • cursor (dict): Table cursor from openTable()
  • filter_tables (list): Optional list of column names to retrieve

Returns

OrderedDict with column data or None when no more records

Column Types

Supported Types

ColumnTypeToName

Map column type to human-readable name:

String Codepages

StringCodePages

Supported text encodings:

Complete Examples

Extract NTDS.dit Users

Query Specific Columns

Enumerate All Tables

Handle Long Values

Extract with Date Conversion

Database State

Database States

Utility Functions

getUnixTime()

Convert Windows FILETIME to Unix timestamp.

Parameters

  • t (int): Windows FILETIME (100-nanosecond intervals since 1601-01-01)

Returns

Unix timestamp (seconds since 1970-01-01)

Low-Level Operations

getPage()

Read a specific database page.

close()

Close the database file.

Page Flags

Performance Tips

  1. Filter columns - Use filter_tables to retrieve only needed columns
  2. Close database - Always close when done to release file handle
  3. Batch processing - Process records in batches for large databases
  4. Index awareness - Understanding indexes can help with query planning
  5. Remote files - Set isRemote=True for remote file objects

Limitations

  • Read-only - The parser only supports reading, not writing
  • Recovery - Dirty databases may have incomplete data
  • Multi-values - Multi-valued attributes returned as hex strings
  • Long values - Some long values may not be fully parsed
  • Transactions - No transaction log replay support

Common Use Cases

NTDS.dit Analysis

Extract Active Directory data:
  • User accounts and hashes
  • Computer accounts
  • Group memberships
  • Domain trusts
  • Security descriptors
Query search index:
  • Indexed documents
  • File metadata
  • Search history

Exchange Databases

Access mailbox data:
  • Message store
  • Folder structure
  • Attachments

References