DEV IN PROGRESS

Module pychrysalide.analysis.contents

Documentation

This module provides several ways to load and deal with raw binary contents.

The most used BinContent implementation is probably the FileContent class.

Classes

Class EncapsulatedContent

EncapsulatedContent gathers items relative to a binary encapsulated content.

For instance, if a ZIP archive is processed, the encapsulated content stores:

  • the archive as a base;
  • the access path to the archive member;
  • the content of this extracted member.

Instances can be created using the following constructor:

    EncapsulatedContent(base, path, endpoint)

Where base, path and endpoint are the previously described expected properties. The base and the endpoint must be BinContent instances and the access path must be provided as a string.

Hierarchy

builtins.object
 ╰── gi._gi.GObject
      ╰── pychrysalide.analysis.BinContent
           ╰── pychrysalide.analysis.contents.EncapsulatedContent

Implements: pychrysalide.analysis.storage.SerializableObject

Attributes

base

Give access to the base of the encapsulated content.

endpoint

Give access to the encapsulated binary content.

path

Provide the access path to the inner binary content.

Class FileContent

FileContent handles binary content loaded from a file.

Instances can be created using the following constructor:

    FileContent(filename)

Where filename is a path to an existing file.

Hierarchy

builtins.object
 ╰── gi._gi.GObject
      ╰── pychrysalide.analysis.BinContent
           ╰── pychrysalide.analysis.contents.MemoryContent
                ╰── pychrysalide.analysis.contents.FileContent

Implements: pychrysalide.analysis.storage.SerializableObject

Attributes

filename

Provide the access path to the binary content.

Class MemoryContent

MemoryContent builds a binary content from memory data only. Thus no existing file backend is needed.

Instances can be created using the following constructor:

    MemoryContent(data)

Where data is provided as string or read-only bytes-like object. The string may contain embedded null bytes.

Hierarchy

builtins.object
 ╰── gi._gi.GObject
      ╰── pychrysalide.analysis.BinContent
           ╰── pychrysalide.analysis.contents.MemoryContent

Implements: pychrysalide.analysis.storage.SerializableObject

Known subclass: pychrysalide.analysis.contents.FileContent

Class RestrictedContent

RestrictedContent restricts access to a given area for a binary content.

Instances can be created using the following constructor:

    RestrictedContent(content, range)

Where content is a BinContent instance and range a Python object which can be converted into mrange.

Hierarchy

builtins.object
 ╰── gi._gi.GObject
      ╰── pychrysalide.analysis.BinContent
           ╰── pychrysalide.analysis.contents.RestrictedContent

Implements: pychrysalide.analysis.storage.SerializableObject

Attributes

range

Give the restricting range applied to a binary content.