Skip to main content

demon-cry-base

Базовый класс для OSINT-модулей demon-cry

Установка

pip install demon-cry-base

Использование

Модуль без конфига

Для простых Stateless-модулей можно использовать ModuleConfig напрямую:

from demon_cry_base import BaseModule, ModuleConfig


class PingModule(BaseModule):
    name = "ping"
    description = "Check if host is alive"
    category = "utility"
    parameters = {}

    async def execute(self, config: ModuleConfig, **kwargs) -> dict:
        return {"status": "ok"}

Создание модуля

from demon_cry_base import BaseModule, ModuleConfig


class MyModuleConfig(ModuleConfig):
    timeout: int = 30


class MyModule(BaseModule):
    name = "my_module"
    description = "My OSINT module"
    category = "custom"
    config_model = MyModuleConfig
    parameters = {
        "type": "object",
        "properties": {
            "target": {"type": "string", "description": "Target to scan"},
            "query": {"type": "string", "description": "Search query"}
        },
        "required": ["target"]
    }

    async def execute(self, config: MyModuleConfig, target: str, query: str, **kwargs) -> dict:
        return {"result": f"Scanned {target}"}

Два источника данных

Каждый модуль работает с двумя потоками данных:

Config Parameters
Откуда БД / ядро Запрос / пользователь
Формат Pydantic-модель (ModuleConfig) JSON Schema (dict)
Зачем Настройки модуля Входные данные
Передаётся config в execute() **kwargs в execute()

Config — настройки из БД

ModuleConfig — это Pydantic-модель. Наследуйте её и добавляйте поля:

class ReconConfig(ModuleConfig):
    deep: bool = False
    ports: list[int] = [80, 443]


class ApiConfig(ModuleConfig):
    api_key: str
    rate_limit: int = 100
    timeout: int = 30

Затем укажите config_model в модуле. Ядро загрузит конфиг из БД и передаст в execute():

class ReconModule(BaseModule):
    name = "recon"
    description = "Network reconnaissance"
    category = "osint"
    config_model = ReconConfig
    parameters = {
        "type": "object",
        "properties": {
            "target": {"type": "string", "description": "Target to scan"}
        },
        "required": ["target"]
    }

    async def execute(self, config: ReconConfig, target: str, **kwargs) -> dict:
        if config.deep:
            ...

Parameters — входные данные

parameters — JSON Schema, описывает что модуль принимает от пользователя:

parameters = {
    "type": "object",
    "properties": {
        "domain": {"type": "string", "description": "Domain to lookup"},
        "record_type": {
            "type": "array",
            "items": {"type": "string", "enum": ["A", "AAAA", "MX", "NS", "TXT", "CNAME", "SOA", "PTR"]},
            "default": ["A"],
            "description": "Record types to query"
        }
    },
    "required": ["domain"]
}

Полный пример: модуль с обоими источниками

import asyncio
import aiodns
from demon_cry_base import BaseModule, ModuleConfig


class DnsLookupConfig(ModuleConfig):
    name_servers: list[str] = ["1.1.1.1", "8.8.8.8"]


class DnsLookup(BaseModule):
    name = "dns_lookup"
    description = "Finds DNS records"
    category = "network"
    config_model = DnsLookupConfig
    parameters = {
        "type": "object",
        "properties": {
            "domain": {"type": "string", "description": "Domain to lookup"},
            "record_type": {
                "type": "array",
                "items": {"type": "string", "enum": ["A", "AAAA", "MX", "NS", "TXT", "CNAME", "SOA", "PTR"]},
                "default": ["A"],
                "description": "Record types to query"
            }
        },
        "required": ["domain"]
    }

    async def execute(self, config: DnsLookupConfig, domain: str, record_type: list[str] | None = None) -> dict:
        resolver = aiodns.DNSResolver(nameservers=config.name_servers)
        # config — настройки из БД (name_servers)
        # domain, record_type — входные данные из параметров
        ...

Download files

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

Source Distribution

demon_cry_base-0.2.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

demon_cry_base-0.2.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file demon_cry_base-0.2.1.tar.gz.

File metadata

  • Download URL: demon_cry_base-0.2.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for demon_cry_base-0.2.1.tar.gz
Algorithm Hash digest
SHA256 87d88e09f74bdb6301aa70018d6541f726ffa61f2eaa77568935bf089d6d0eb9
MD5 bbea32f1ac9bc7737cafdcc0b9ce1fcf
BLAKE2b-256 46533e7d0113029e0bbc277e507731fedb5c2e7908fb9a6ac92237c3c104e524

See more details on using hashes here.

Provenance

The following attestation bundles were made for demon_cry_base-0.2.1.tar.gz:

Publisher: publish.yml on Mooncore-inc/demon-cry-base

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file demon_cry_base-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: demon_cry_base-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for demon_cry_base-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b57b2defa436e15c0fc440d5cb832bb82e15f830c584fb26a9b13bbfb78d6e2f
MD5 6517dd90b70d76a1a3fd6b5161413c8d
BLAKE2b-256 2e3a722bcb32ea42149ffbefb8ab3e40e6a2432b99914d30a3fd37df8c7d8c1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for demon_cry_base-0.2.1-py3-none-any.whl:

Publisher: publish.yml on Mooncore-inc/demon-cry-base

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page