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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87d88e09f74bdb6301aa70018d6541f726ffa61f2eaa77568935bf089d6d0eb9
|
|
| MD5 |
bbea32f1ac9bc7737cafdcc0b9ce1fcf
|
|
| BLAKE2b-256 |
46533e7d0113029e0bbc277e507731fedb5c2e7908fb9a6ac92237c3c104e524
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
demon_cry_base-0.2.1.tar.gz -
Subject digest:
87d88e09f74bdb6301aa70018d6541f726ffa61f2eaa77568935bf089d6d0eb9 - Sigstore transparency entry: 2742362562
- Sigstore integration time:
-
Permalink:
Mooncore-inc/demon-cry-base@e5339c9d0efbbcdfbcfd43cc1a310744f11f7a6a -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Mooncore-inc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e5339c9d0efbbcdfbcfd43cc1a310744f11f7a6a -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b57b2defa436e15c0fc440d5cb832bb82e15f830c584fb26a9b13bbfb78d6e2f
|
|
| MD5 |
6517dd90b70d76a1a3fd6b5161413c8d
|
|
| BLAKE2b-256 |
2e3a722bcb32ea42149ffbefb8ab3e40e6a2432b99914d30a3fd37df8c7d8c1c
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
demon_cry_base-0.2.1-py3-none-any.whl -
Subject digest:
b57b2defa436e15c0fc440d5cb832bb82e15f830c584fb26a9b13bbfb78d6e2f - Sigstore transparency entry: 2742362575
- Sigstore integration time:
-
Permalink:
Mooncore-inc/demon-cry-base@e5339c9d0efbbcdfbcfd43cc1a310744f11f7a6a -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Mooncore-inc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e5339c9d0efbbcdfbcfd43cc1a310744f11f7a6a -
Trigger Event:
push
-
Statement type: