msl
Memory Slice (.msl) format parser.
Optional dependencies (lazy-imported when needed): - blake3: integrity chain verification - zstandard: zstd block decompression - lz4: lz4 block decompression
MSL file reader with mmap-backed, endianness-aware parsing.
- class MslReader[source]
Bases:
objectMemory-mapped MSL file reader (context manager).
- property file_header: MslFileHeader
- iter_blocks(merge_cont=True)[source]
Iterate blocks; merges continuation blocks when merge_cont is True.
- read_block_payload(hdr)[source]
Read and decompress a block’s payload bytes.
- Parameters:
hdr (MslBlockHeader)
- Return type:
- Return type:
List[MslRelatedDump]
MSL file writer for producing valid Memory Slice binary files.
All struct layouts must match the corresponding decoders.py decoder for roundtrip compatibility via MslReader.
- class MslWriter[source]
Bases:
objectAccumulate blocks and write a valid MSL file.
- add_memory_region(base_addr, data, protection=0x03, region_type=0x05, page_size_log2=12, timestamp_ns=0)[source]
Add a memory region block. Returns block UUID.
- add_key_hint(region_uuid, offset, key_length, key_type, protocol, confidence=0x01, key_state=0, note='')[source]
Add a key hint block referencing a memory region.
- add_import_provenance(source_format, tool_name, orig_file_size, note='', source_path=None)[source]
Add an import provenance block.
When source_path is provided and readable, its BLAKE3 digest is computed and written as source_hash. Otherwise source_hash is 32 zero bytes.
Add a RELATED_DUMP block (type 0x0041).
When target_path is provided and readable, its BLAKE3 digest is computed and written as target_hash, pinning the cross-reference. Otherwise target_hash is 32 zero bytes.
Raw-to-MSL import: convert .dump files to .msl format.
- import_raw_dump(raw_path, output_path, pid=0, secrets=None, os_type=OSType.UNKNOWN, arch_type=ArchType.UNKNOWN, page_size_log2=12)[source]
Convert a raw .dump file to .msl format.
- Parameters:
- Return type:
- import_run_directory(run_dir, output_dir, keylog_filename='keylog.csv')[source]
Import all .dump files in a run directory to .msl format.
- Parameters:
- Return type:
MSL format constants and enumerations (Memory Slice spec v1.1.0).
Magic bytes and all IntEnum/IntFlag types from the specification tables.
- class HeaderFlag[source]
Bases:
IntFlag- IMPORTED = 1
- INVESTIGATION = 2
- ENCRYPTED = 4
- __new__(value)
- class BlockType[source]
Bases:
IntEnumBlock type registry (spec Table 9).
- INVALID = 0
- MEMORY_REGION = 1
- MODULE_ENTRY = 2
- MODULE_LIST_INDEX = 16
- THREAD_CONTEXT = 17
- FILE_DESCRIPTOR = 18
- NETWORK_CONNECTION = 19
- ENVIRONMENT_BLOCK = 20
- SECURITY_TOKEN = 21
- KEY_HINT = 32
- IMPORT_PROVENANCE = 48
- PROCESS_IDENTITY = 64
- RELATED_DUMP = 65
- SYSTEM_CONTEXT = 80
- PROCESS_TABLE = 81
- CONNECTION_TABLE = 82
- HANDLE_TABLE = 83
- CONNECTIVITY_TABLE = 85
- END_OF_CAPTURE = 4095
- VAS_MAP = 4097
- POINTER_GRAPH = 4099
- __new__(value)
- class BlockFlag[source]
Bases:
IntFlagPer-block flags (spec Table 7).
- COMPRESSED = 1
- COMP_ZSTD = 2
- COMP_LZ4 = 4
- HAS_KEY_HINTS = 8
- HAS_CHILDREN = 16
- CONTINUATION = 32
- __new__(value)
- class PageState[source]
Bases:
IntEnumThree-state page acquisition model (spec Table 22).
- CAPTURED = 0
- FAILED = 1
- UNMAPPED = 2
- RESERVED = 3
- __new__(value)
- class Protection[source]
Bases:
IntFlagMemory region protection flags (spec Section 5.1).
- READ = 1
- WRITE = 2
- EXECUTE = 4
- GUARD = 8
- COW = 16
- __new__(value)
- class RegionType[source]
Bases:
IntEnumMemory region types (spec Section 5.1).
- UNKNOWN = 0
- HEAP = 1
- STACK = 2
- IMAGE = 3
- MAPPED_FILE = 4
- ANONYMOUS = 5
- SHARED_MEM = 6
- OTHER = 255
- __new__(value)
- class OSType[source]
Bases:
IntEnum- WINDOWS = 0
- LINUX = 1
- MACOS = 2
- ANDROID = 3
- IOS = 4
- FREEBSD = 5
- UNKNOWN = 65535
- __new__(value)
- class ArchType[source]
Bases:
IntEnum- X86 = 0
- X86_64 = 1
- ARM64 = 2
- ARM32 = 3
- UNKNOWN = 65535
- __new__(value)
- class MslKeyType[source]
Bases:
IntEnumCrypto key type codes (spec Table 17).
- UNKNOWN = 0
- PRE_MASTER_SECRET = 1
- MASTER_SECRET = 2
- SESSION_KEY = 3
- HANDSHAKE_SECRET = 4
- APP_TRAFFIC_SECRET = 5
- RSA_PRIVATE_KEY = 6
- ECDH_PRIVATE_KEY = 7
- IKE_SA_KEY = 8
- ESP_AH_KEY = 9
- SSH_SESSION_KEY = 10
- WIREGUARD_KEY = 11
- ML_KEM_PRIVATE_KEY = 12
- OTHER = 65535
- __new__(value)
- class MslProtocol[source]
Bases:
IntEnumProtocol codes (spec Table 17).
- UNKNOWN = 0
- TLS_12 = 1
- TLS_13 = 2
- DTLS_12 = 3
- DTLS_13 = 4
- QUIC = 5
- IKEV2_IPSEC = 6
- SSH = 7
- WIREGUARD = 8
- PQ_TLS = 9
- OTHER = 65535
- __new__(value)
- class Confidence[source]
Bases:
IntEnumKey hint confidence levels (spec Section 5.6).
- SPECULATIVE = 0
- HEURISTIC = 1
- CONFIRMED = 2
- __new__(value)
- class KeyState[source]
Bases:
IntEnumKey lifecycle state (spec Section 5.6).
- UNKNOWN = 0
- ACTIVE = 1
- EXPIRED = 2
- __new__(value)