Skip to main content

A library for defining and creating structured data (called records) that can be streamed to disk or piped to other tools that use flow.record

Project description

flow.record

A library for defining and creating structured data (called records) that can be streamed to disk or piped to other tools that use flow.record.

Records can be read and transformed to other formats by using output adapters, such as CSV and JSON.

For more information on how Dissect uses this library, please see the documentation.

Requirements

This project is part of the Dissect framework and requires Python.

Information on the supported Python versions can be found in the Getting Started section of the documentation.

Installation

flow.record is available on PyPI.

pip install flow.record

Usage

This library contains the tool rdump. With rdump you can read, write, interact, and manipulate records from stdin or from record files saved on disk. Please refer to rdump -h or to the rdump documentation for all parameters.

Records are the primary output type when using the various functions of target-query. The following command shows how to pipe record output from target-query to rdump:

user@dissect~$ target-query -f runkeys targets/EXAMPLE.vmx | rdump
<windows/registry/run hostname='EXAMPLE' domain='EXAMPLE.local' ts=2022-12-09 12:06:20.037806+00:00 name='OneDriveSetup' path='C:/Windows/SysWOW64/OneDriveSetup.exe /thfirstsetup' key='HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run' hive_filepath='C:\\Windows/ServiceProfiles/LocalService/ntuser.dat' username='LocalService' user_sid='S-1-5-19' user_home='%systemroot%\\ServiceProfiles\\LocalService'>
<...>

Programming example

Define a RecordDescriptor (schema) and then create a few records and write them to disk

from flow.record import RecordDescriptor, RecordWriter

# define our descriptor
MyRecord = RecordDescriptor("my/record", [
    ("net.ipaddress", "ip"),
    ("string", "description"),
])

# define some records
records = [
    MyRecord("1.1.1.1", "cloudflare dns"),
    MyRecord("8.8.8.8", "google dns"),
]

# write the records to disk
with RecordWriter("output.records.gz") as writer:
    for record in records:
        writer.write(record)

The records can then be read from disk using the rdump tool or by instantiating a RecordReader when using the library.

$ rdump output.records.gz
<my/record ip=net.ipaddress('1.1.1.1') description='cloudflare dns'>
<my/record ip=net.ipaddress('8.8.8.8') description='google dns'>

Selectors

We can also use selectors for filtering and selecting records using a query (Python like syntax), e.g.:

$ rdump output.records.gz -s '"google" in r.description'
<my/record ip=net.ipaddress('8.8.8.8') description='google dns'>

$ rdump output.records.gz -s 'r.ip in net.ipnetwork("1.1.0.0/16")'
<my/record ip=net.ipaddress('1.1.1.1') description='cloudflare dns'>

Build and test instructions

This project uses tox to build source and wheel distributions. Run the following command from the root folder to build these:

tox -e build

The build artifacts can be found in the dist/ directory.

tox is also used to run linting and unit tests in a self-contained environment. To run both linting and unit tests using the default installed Python version, run:

tox

For a more elaborate explanation on how to build and test the project, please see the documentation.

Contributing

The Dissect project encourages any contribution to the codebase. To make your contribution fit into the project, please refer to the development guide.

Copyright and license

Dissect is released as open source by Fox-IT (https://www.fox-it.com) part of NCC Group Plc (https://www.nccgroup.com).

Developed by the Dissect Team (dissect@fox-it.com) and made available at https://github.com/fox-it/dissect.

License terms: AGPL3 (https://www.gnu.org/licenses/agpl-3.0.html). For more information, see the LICENSE file.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flow_record-3.18.dev2.tar.gz (115.3 kB view details)

Uploaded Source

Built Distribution

flow.record-3.18.dev2-py3-none-any.whl (80.0 kB view details)

Uploaded Python 3

File details

Details for the file flow_record-3.18.dev2.tar.gz.

File metadata

  • Download URL: flow_record-3.18.dev2.tar.gz
  • Upload date:
  • Size: 115.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for flow_record-3.18.dev2.tar.gz
Algorithm Hash digest
SHA256 97372a498419215f1be6f965c1e89290a36718207bc82fc89befef3e60408085
MD5 83ad27d194a22c8385fcf6fc2792428c
BLAKE2b-256 a073bbebec30686165bf8ed0f0042c945058b1eaa287a88edc53424572beb8ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for flow_record-3.18.dev2.tar.gz:

Publisher: GitHub
  • Repository: fox-it/flow.record
  • Workflow: dissect-ci.yml
Attestations:
  • Statement type: https://in-toto.io/Statement/v1
    • Predicate type: https://docs.pypi.org/attestations/publish/v1
    • Subject name: flow_record-3.18.dev2.tar.gz
    • Subject digest: 97372a498419215f1be6f965c1e89290a36718207bc82fc89befef3e60408085
    • Transparency log index: 148172576
    • Transparency log integration time:

File details

Details for the file flow.record-3.18.dev2-py3-none-any.whl.

File metadata

File hashes

Hashes for flow.record-3.18.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 a15f651f2a65215b93a831c024ef7940306a68c009a570238eb0ccc70182faff
MD5 cdd48f0efde8797d59ae6c0b206404ee
BLAKE2b-256 f4371a2df8aa1f51a1d8075573e50da9cbe1bd8eb2718050fd8bb697aa56d3f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for flow.record-3.18.dev2-py3-none-any.whl:

Publisher: GitHub
  • Repository: fox-it/flow.record
  • Workflow: dissect-ci.yml
Attestations:
  • Statement type: https://in-toto.io/Statement/v1
    • Predicate type: https://docs.pypi.org/attestations/publish/v1
    • Subject name: flow_record-3.18.dev2-py3-none-any.whl
    • Subject digest: a15f651f2a65215b93a831c024ef7940306a68c009a570238eb0ccc70182faff
    • Transparency log index: 148172580
    • Transparency log integration time:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page