Skip to main content

A collection of tool for EC.

Project description

ec_tools

A lightweight Python toolbox for data modeling, SQLite DAOs, encrypted key-value storage, and small productivity utilities.

Highlights

  • Data objects with JSON serialization and type-aware formatting.
  • SQLite client + DAO layer with query generation.
  • KV DAO with optional AES-backed encryption.
  • Encryption helpers for bytes, chunks, and files.
  • Utility helpers for IO, hashing, logging, and timing.

Requirements

  • Python >= 3.12

Install (from source)

pip install -e .

Quick start

Encrypted KV storage with a KeyManager

from ec_tools.database import CipherKvDao, SqliteClient, SqliteKvDao
from ec_tools.tools.cipher import AesCipherGenerator
from ec_tools.tools.key_manager import KeyManager

sqlite_client = SqliteClient(":memory:")
kv_dao = SqliteKvDao(sqlite_client)
cipher_generator = AesCipherGenerator()
cipher_kv_dao = CipherKvDao(kv_dao, cipher_generator)

manager = KeyManager(cipher_kv_dao, "my-password")
manager.refresh_keys(["token", "cookie"])
print(manager.get_key("token"))

Build headers from stored secrets

from ec_tools.tools.headers_manager import HeadersManager

headers = HeadersManager(manager, ["token"], {"User-Agent": "ec-tools"}).get()
print(headers)

Data objects

Define dataclasses that serialize to/from JSON with helpers for enums, lists, sets, and nested objects.

import dataclasses
from ec_tools.data import DataObject

@dataclasses.dataclass
class User(DataObject):
    name: str
    age: int

user = User.from_json({"name": "Ada", "age": "42"})
print(user.to_json())

Encryption helpers

  • AesCipher for encrypting/decrypting bytes.
  • Chunked and file-level encryption utilities in ec_tools.tools.cipher.

Project layout

  • ec_tools/data: data-object helpers and JSON formatting.
  • ec_tools/database: SQLite client, DAO, and KV DAO.
  • ec_tools/tools: key/headers managers, cipher tools, thread pool.
  • ec_tools/utils: IO, hashing, logging, and timing helpers.

Development

pytest

License

MIT

Project details


Download files

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

Source Distribution

ec_tools-3.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ec_tools-3.0-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file ec_tools-3.0.tar.gz.

File metadata

  • Download URL: ec_tools-3.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for ec_tools-3.0.tar.gz
Algorithm Hash digest
SHA256 d0feea1b8d28818bb88ac0898e79357b48c0b1e1ebc70073b1ee19ae66a69784
MD5 5b4c61a1f14adacf5be3977e5b31b7cf
BLAKE2b-256 42937a5e6f07c52a0ce9519a3a1e3efaec716bb19e6c1d0c0d2f24b6e196c840

See more details on using hashes here.

File details

Details for the file ec_tools-3.0-py3-none-any.whl.

File metadata

  • Download URL: ec_tools-3.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for ec_tools-3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c2bf1d0692d2d3ab1a4de4cf99dea0afa58307a5bf69f21b5c4fb417722f703
MD5 d8c9de174d1d3eb9069cf4b47d5b323d
BLAKE2b-256 1ef18c0e6b79610faadf30b5bfe000ebe4e82f30dda5abf045b6eb70a5240ee3

See more details on using hashes here.

Supported by

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