dismanager 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dismanager-1.0.0/LICENSE +165 -0
- dismanager-1.0.0/PKG-INFO +86 -0
- dismanager-1.0.0/README.md +57 -0
- dismanager-1.0.0/dismanager/__init__.py +0 -0
- dismanager-1.0.0/dismanager/classes/__init__.py +8 -0
- dismanager-1.0.0/dismanager/classes/addon.py +43 -0
- dismanager-1.0.0/dismanager/classes/plugin.py +33 -0
- dismanager-1.0.0/dismanager/cli.py +41 -0
- dismanager-1.0.0/dismanager/core/__init__.py +0 -0
- dismanager-1.0.0/dismanager/core/bootstrap/__init__.py +20 -0
- dismanager-1.0.0/dismanager/core/bootstrap/config.py +112 -0
- dismanager-1.0.0/dismanager/core/bootstrap/i18n.py +28 -0
- dismanager-1.0.0/dismanager/core/bootstrap/logs.py +117 -0
- dismanager-1.0.0/dismanager/core/bootstrap/paths.py +14 -0
- dismanager-1.0.0/dismanager/core/commands/__init__.py +15 -0
- dismanager-1.0.0/dismanager/core/commands/dispatcher.py +137 -0
- dismanager-1.0.0/dismanager/core/extensions/__init__.py +19 -0
- dismanager-1.0.0/dismanager/core/extensions/loader.py +109 -0
- dismanager-1.0.0/dismanager/core/files/__init__.py +57 -0
- dismanager-1.0.0/dismanager/core/files/archive_operations.py +236 -0
- dismanager-1.0.0/dismanager/core/files/file_operations.py +150 -0
- dismanager-1.0.0/dismanager/core/files/file_preview.py +94 -0
- dismanager-1.0.0/dismanager/core/files/sandbox_paths.py +121 -0
- dismanager-1.0.0/dismanager/core/files/text_files.py +120 -0
- dismanager-1.0.0/dismanager/core/format/__init__.py +5 -0
- dismanager-1.0.0/dismanager/core/format/bytes.py +10 -0
- dismanager-1.0.0/dismanager/core/logs/__init__.py +6 -0
- dismanager-1.0.0/dismanager/core/logs/buffer.py +43 -0
- dismanager-1.0.0/dismanager/core/logs/writer.py +72 -0
- dismanager-1.0.0/dismanager/core/managed_process/__init__.py +6 -0
- dismanager-1.0.0/dismanager/core/managed_process/managers/__init__.py +16 -0
- dismanager-1.0.0/dismanager/core/managed_process/managers/backups.py +145 -0
- dismanager-1.0.0/dismanager/core/managed_process/managers/console_thread.py +231 -0
- dismanager-1.0.0/dismanager/core/managed_process/managers/logger.py +61 -0
- dismanager-1.0.0/dismanager/core/managed_process/managers/plugins.py +113 -0
- dismanager-1.0.0/dismanager/core/managed_process/managers/runner.py +252 -0
- dismanager-1.0.0/dismanager/core/managed_process/process.py +201 -0
- dismanager-1.0.0/dismanager/core/process_store/__init__.py +11 -0
- dismanager-1.0.0/dismanager/core/process_store/config.py +22 -0
- dismanager-1.0.0/dismanager/core/process_store/store.py +218 -0
- dismanager-1.0.0/dismanager/core/system/__init__.py +6 -0
- dismanager-1.0.0/dismanager/core/system/metrics.py +92 -0
- dismanager-1.0.0/dismanager/discord/__init__.py +0 -0
- dismanager-1.0.0/dismanager/discord/client/__init__.py +5 -0
- dismanager-1.0.0/dismanager/discord/client/client.py +165 -0
- dismanager-1.0.0/dismanager/discord/client/cogs/__init__.py +18 -0
- dismanager-1.0.0/dismanager/discord/client/cogs/commands.py +127 -0
- dismanager-1.0.0/dismanager/discord/client/cogs/events.py +74 -0
- dismanager-1.0.0/dismanager/discord/client/managers/__init__.py +8 -0
- dismanager-1.0.0/dismanager/discord/client/managers/addons.py +107 -0
- dismanager-1.0.0/dismanager/discord/client/managers/console.py +175 -0
- dismanager-1.0.0/dismanager/discord/client/managers/panel.py +129 -0
- dismanager-1.0.0/dismanager/discord/client/managers/processes.py +126 -0
- dismanager-1.0.0/dismanager/discord/panel/__init__.py +6 -0
- dismanager-1.0.0/dismanager/discord/panel/backups/__init__.py +5 -0
- dismanager-1.0.0/dismanager/discord/panel/backups/views.py +297 -0
- dismanager-1.0.0/dismanager/discord/panel/embed.py +216 -0
- dismanager-1.0.0/dismanager/discord/panel/files/__init__.py +5 -0
- dismanager-1.0.0/dismanager/discord/panel/files/actions.py +330 -0
- dismanager-1.0.0/dismanager/discord/panel/files/embed.py +115 -0
- dismanager-1.0.0/dismanager/discord/panel/files/modals.py +319 -0
- dismanager-1.0.0/dismanager/discord/panel/files/preview.py +92 -0
- dismanager-1.0.0/dismanager/discord/panel/files/views.py +226 -0
- dismanager-1.0.0/dismanager/discord/panel/guide/__init__.py +3 -0
- dismanager-1.0.0/dismanager/discord/panel/guide/embed.py +211 -0
- dismanager-1.0.0/dismanager/discord/panel/guide/views.py +91 -0
- dismanager-1.0.0/dismanager/discord/panel/processes/__init__.py +5 -0
- dismanager-1.0.0/dismanager/discord/panel/processes/embed.py +24 -0
- dismanager-1.0.0/dismanager/discord/panel/processes/modals.py +168 -0
- dismanager-1.0.0/dismanager/discord/panel/processes/views.py +95 -0
- dismanager-1.0.0/dismanager/discord/panel/views.py +112 -0
- dismanager-1.0.0/dismanager/discord/utils/__init__.py +6 -0
- dismanager-1.0.0/dismanager/discord/utils/confirm.py +45 -0
- dismanager-1.0.0/dismanager/discord/utils/threads.py +26 -0
- dismanager-1.0.0/dismanager/locales/es/LC_MESSAGES/app.mo +0 -0
- dismanager-1.0.0/dismanager/main.py +55 -0
- dismanager-1.0.0/dismanager/py.typed +0 -0
- dismanager-1.0.0/dismanager/templates/config.yml +33 -0
- dismanager-1.0.0/dismanager.egg-info/PKG-INFO +86 -0
- dismanager-1.0.0/dismanager.egg-info/SOURCES.txt +84 -0
- dismanager-1.0.0/dismanager.egg-info/dependency_links.txt +1 -0
- dismanager-1.0.0/dismanager.egg-info/entry_points.txt +2 -0
- dismanager-1.0.0/dismanager.egg-info/requires.txt +3 -0
- dismanager-1.0.0/dismanager.egg-info/top_level.txt +1 -0
- dismanager-1.0.0/pyproject.toml +69 -0
- dismanager-1.0.0/setup.cfg +4 -0
dismanager-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dismanager
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Manage processes and stream their consoles through Discord.
|
|
5
|
+
Author-email: Mauricio <150753762+mjpr-3435@users.noreply.github.com>
|
|
6
|
+
License-Expression: LGPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/mjpr-3435/DisManager
|
|
8
|
+
Project-URL: Repository, https://github.com/mjpr-3435/DisManager
|
|
9
|
+
Project-URL: Issues, https://github.com/mjpr-3435/DisManager/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/mjpr-3435/DisManager/blob/main/docs/GUIDE.md
|
|
11
|
+
Keywords: discord,process-manager,console,bot,server-manager
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Communications :: Chat
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.13
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: discord-py>=2.7.1
|
|
26
|
+
Requires-Dist: psutil>=7.2.2
|
|
27
|
+
Requires-Dist: ruamel-yaml>=0.19.1
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# DisManager
|
|
31
|
+
|
|
32
|
+
[](https://pypi.org/project/dismanager/)
|
|
33
|
+
[](https://www.python.org/downloads/)
|
|
34
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/LICENSE)
|
|
35
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/README.md)
|
|
36
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/docs/README.en.md)
|
|
37
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/docs/GUIDE.md)
|
|
38
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/docs/GUIDE.en.md)
|
|
39
|
+
|
|
40
|
+
**DisManager** es una aplicación en Python para administrar múltiples procesos y retransmitir sus consolas en tiempo real a través de un bot de Discord. Es una evolución de **McDis-RCON** (desarrollado a mano originalmente con las contribuciones de Mauricio y Elí Maciel); gran parte de su adaptación a esta nueva versión se realizó con **Gemini 4 Hydrogen**, combinada con partes escritas a mano y una revisión de la lógica principal adaptada por el modelo.
|
|
41
|
+
|
|
42
|
+
## Características
|
|
43
|
+
|
|
44
|
+
- **Soporte para inglés y español:** interfaz y mensajes configurables desde `config.yml`.
|
|
45
|
+
- **Panel interactivo en Discord:** vista general de CPU, RAM, almacenamiento y estado de cada proceso.
|
|
46
|
+
- **Control de procesos:** inicia, detiene, reinicia o fuerza el cierre (`start`, `stop`, `restart`, `kill` y variantes `-all`) desde el canal del panel, los hilos de consola o la consola local.
|
|
47
|
+
- **Retransmisión de consola y filtros:** envía la salida `stdout`/`stderr` al hilo `Console <proceso>` con soporte de `blacklist` por proceso y archivo de log descargable (`logs`).
|
|
48
|
+
- **Configuración desde Discord (`Config`):** crea, edita y elimina procesos directamente desde el panel (persistidos en `.dismanager/processes.json`, hasta 15 procesos).
|
|
49
|
+
- **Sistema de copias de seguridad (`Backups`):** crea y restaura backups rotativos por proceso con indicador de progreso.
|
|
50
|
+
- **Explorador de archivos (`Files`):** navega dentro del directorio de ejecución (`DisManager/...`), previsualiza texto, imágenes y contenido de archivos `.zip`/`.tar`, sube archivos, edita archivos de texto, renombra, elimina y comprime/descomprime `.zip`.
|
|
51
|
+
- **Plugins y Addons:** extiende cada proceso (`.plugins/`) o todo el bot (`.addons/`) con hooks de ciclo de vida (`on_process_start`, `on_process_stop`, `on_process_crash`, `on_plugins_load`, `on_plugins_unload`, `on_addons_load`, `on_addons_unload`) y recarga en caliente (`plreload`, `adreload`).
|
|
52
|
+
- **Registro y reporte de errores:** log de sesión de DisManager en `.dismanager/logs/` y notificaciones automáticas en el hilo `Error Reports` (descargable con `<prefijo>log`).
|
|
53
|
+
- **No intrusivo:** ejecuta cualquier programa o servidor mediante `subprocess.Popen` sin modificar sus archivos.
|
|
54
|
+
|
|
55
|
+
## Instalación
|
|
56
|
+
|
|
57
|
+
Requisitos: **Python 3.13 o superior**.
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
pip install dismanager
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Primeros pasos
|
|
64
|
+
|
|
65
|
+
En la carpeta donde quieras alojar los directorios de tus procesos, inicializa la configuración:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
dismanager init
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Esto creará `config.yml`, donde debes configurar:
|
|
72
|
+
- `Bot Token`: token de tu bot de Discord.
|
|
73
|
+
- `Bot Prefix`: prefijo para comandos de texto (por ejemplo `!!`).
|
|
74
|
+
- `Panel ID`: ID del canal de texto donde DisManager publicará el panel.
|
|
75
|
+
- `Language`: `en` o `es`.
|
|
76
|
+
- `Backups`: cantidad máxima de copias rotativas por proceso.
|
|
77
|
+
|
|
78
|
+
Después, inicia DisManager con:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
dismanager run
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Una vez conectado, usa el botón **Config** del panel en Discord para registrar tus procesos.
|
|
85
|
+
|
|
86
|
+
Para instrucciones paso a paso (incluyendo instalación desde cero, comandos, gestor de archivos, backups y addons/plugins), consulta la [Guía de uso](https://github.com/mjpr-3435/DisManager/blob/main/docs/GUIDE.md).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# DisManager
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/dismanager/)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/LICENSE)
|
|
6
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/README.md)
|
|
7
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/docs/README.en.md)
|
|
8
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/docs/GUIDE.md)
|
|
9
|
+
[](https://github.com/mjpr-3435/DisManager/blob/main/docs/GUIDE.en.md)
|
|
10
|
+
|
|
11
|
+
**DisManager** es una aplicación en Python para administrar múltiples procesos y retransmitir sus consolas en tiempo real a través de un bot de Discord. Es una evolución de **McDis-RCON** (desarrollado a mano originalmente con las contribuciones de Mauricio y Elí Maciel); gran parte de su adaptación a esta nueva versión se realizó con **Gemini 4 Hydrogen**, combinada con partes escritas a mano y una revisión de la lógica principal adaptada por el modelo.
|
|
12
|
+
|
|
13
|
+
## Características
|
|
14
|
+
|
|
15
|
+
- **Soporte para inglés y español:** interfaz y mensajes configurables desde `config.yml`.
|
|
16
|
+
- **Panel interactivo en Discord:** vista general de CPU, RAM, almacenamiento y estado de cada proceso.
|
|
17
|
+
- **Control de procesos:** inicia, detiene, reinicia o fuerza el cierre (`start`, `stop`, `restart`, `kill` y variantes `-all`) desde el canal del panel, los hilos de consola o la consola local.
|
|
18
|
+
- **Retransmisión de consola y filtros:** envía la salida `stdout`/`stderr` al hilo `Console <proceso>` con soporte de `blacklist` por proceso y archivo de log descargable (`logs`).
|
|
19
|
+
- **Configuración desde Discord (`Config`):** crea, edita y elimina procesos directamente desde el panel (persistidos en `.dismanager/processes.json`, hasta 15 procesos).
|
|
20
|
+
- **Sistema de copias de seguridad (`Backups`):** crea y restaura backups rotativos por proceso con indicador de progreso.
|
|
21
|
+
- **Explorador de archivos (`Files`):** navega dentro del directorio de ejecución (`DisManager/...`), previsualiza texto, imágenes y contenido de archivos `.zip`/`.tar`, sube archivos, edita archivos de texto, renombra, elimina y comprime/descomprime `.zip`.
|
|
22
|
+
- **Plugins y Addons:** extiende cada proceso (`.plugins/`) o todo el bot (`.addons/`) con hooks de ciclo de vida (`on_process_start`, `on_process_stop`, `on_process_crash`, `on_plugins_load`, `on_plugins_unload`, `on_addons_load`, `on_addons_unload`) y recarga en caliente (`plreload`, `adreload`).
|
|
23
|
+
- **Registro y reporte de errores:** log de sesión de DisManager en `.dismanager/logs/` y notificaciones automáticas en el hilo `Error Reports` (descargable con `<prefijo>log`).
|
|
24
|
+
- **No intrusivo:** ejecuta cualquier programa o servidor mediante `subprocess.Popen` sin modificar sus archivos.
|
|
25
|
+
|
|
26
|
+
## Instalación
|
|
27
|
+
|
|
28
|
+
Requisitos: **Python 3.13 o superior**.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install dismanager
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Primeros pasos
|
|
35
|
+
|
|
36
|
+
En la carpeta donde quieras alojar los directorios de tus procesos, inicializa la configuración:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
dismanager init
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Esto creará `config.yml`, donde debes configurar:
|
|
43
|
+
- `Bot Token`: token de tu bot de Discord.
|
|
44
|
+
- `Bot Prefix`: prefijo para comandos de texto (por ejemplo `!!`).
|
|
45
|
+
- `Panel ID`: ID del canal de texto donde DisManager publicará el panel.
|
|
46
|
+
- `Language`: `en` o `es`.
|
|
47
|
+
- `Backups`: cantidad máxima de copias rotativas por proceso.
|
|
48
|
+
|
|
49
|
+
Después, inicia DisManager con:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
dismanager run
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Una vez conectado, usa el botón **Config** del panel en Discord para registrar tus procesos.
|
|
56
|
+
|
|
57
|
+
Para instrucciones paso a paso (incluyendo instalación desde cero, comandos, gestor de archivos, backups y addons/plugins), consulta la [Guía de uso](https://github.com/mjpr-3435/DisManager/blob/main/docs/GUIDE.md).
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from ..core.managed_process import ManagedProcess
|
|
4
|
+
from ..discord.client import DisManagerClient
|
|
5
|
+
from .addon import BaseAddon
|
|
6
|
+
from .plugin import BasePlugin
|
|
7
|
+
|
|
8
|
+
__all__ = ['BaseAddon', 'BasePlugin', 'DisManagerClient', 'ManagedProcess']
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from ..core.managed_process import ManagedProcess
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BaseAddon:
|
|
7
|
+
"""Optional base class providing typed hook signatures for DisManager addons."""
|
|
8
|
+
|
|
9
|
+
def unload(self) -> object:
|
|
10
|
+
"""Called when the addon is unloaded or reloaded."""
|
|
11
|
+
return None
|
|
12
|
+
|
|
13
|
+
async def on_addons_load(self) -> object:
|
|
14
|
+
"""Called after all addons have been imported."""
|
|
15
|
+
return None
|
|
16
|
+
|
|
17
|
+
async def on_addons_unload(self) -> object:
|
|
18
|
+
"""Called before addons are unloaded."""
|
|
19
|
+
return None
|
|
20
|
+
|
|
21
|
+
async def on_plugins_load(self, process: ManagedProcess) -> object:
|
|
22
|
+
"""Called when a process finishes loading its plugins."""
|
|
23
|
+
return None
|
|
24
|
+
|
|
25
|
+
async def on_plugins_unload(self, process: ManagedProcess) -> object:
|
|
26
|
+
"""Called before a process unloads its plugins."""
|
|
27
|
+
return None
|
|
28
|
+
|
|
29
|
+
async def on_process_start(self, process: ManagedProcess) -> object:
|
|
30
|
+
"""Called when a managed process starts."""
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
async def on_process_stop(self, process: ManagedProcess) -> object:
|
|
34
|
+
"""Called when a managed process is requested to stop or kill."""
|
|
35
|
+
return None
|
|
36
|
+
|
|
37
|
+
async def on_process_crash(self, process: ManagedProcess) -> object:
|
|
38
|
+
"""Called when a managed process exits unexpectedly with a non-zero code."""
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
async def on_process_log(self, process: ManagedProcess, log: str) -> object:
|
|
42
|
+
"""Called for each filtered console output line emitted by ``process``."""
|
|
43
|
+
return None
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class BasePlugin:
|
|
5
|
+
"""Optional base class providing typed hook signatures for per-process plugins."""
|
|
6
|
+
|
|
7
|
+
def unload(self) -> object:
|
|
8
|
+
"""Called when the plugin is unloaded or reloaded."""
|
|
9
|
+
return None
|
|
10
|
+
|
|
11
|
+
async def on_plugins_load(self) -> object:
|
|
12
|
+
"""Called after this process's plugins have been imported."""
|
|
13
|
+
return None
|
|
14
|
+
|
|
15
|
+
async def on_plugins_unload(self) -> object:
|
|
16
|
+
"""Called before this process's plugins are unloaded."""
|
|
17
|
+
return None
|
|
18
|
+
|
|
19
|
+
async def on_process_start(self) -> object:
|
|
20
|
+
"""Called when the owning process starts."""
|
|
21
|
+
return None
|
|
22
|
+
|
|
23
|
+
async def on_process_stop(self) -> object:
|
|
24
|
+
"""Called when the owning process is requested to stop or kill."""
|
|
25
|
+
return None
|
|
26
|
+
|
|
27
|
+
async def on_process_crash(self) -> object:
|
|
28
|
+
"""Called when the owning process exits unexpectedly with a non-zero code."""
|
|
29
|
+
return None
|
|
30
|
+
|
|
31
|
+
async def on_process_log(self, log: str) -> object:
|
|
32
|
+
"""Called for each filtered console output line emitted by the process."""
|
|
33
|
+
return None
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import shutil
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from .main import run
|
|
8
|
+
|
|
9
|
+
_TEMPLATES_DIR = Path(__file__).resolve().parent / 'templates'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def init() -> None:
|
|
13
|
+
"""Initialize the project by copying the default configuration template."""
|
|
14
|
+
target = Path('config.yml')
|
|
15
|
+
source = _TEMPLATES_DIR / 'config.yml'
|
|
16
|
+
if not target.exists():
|
|
17
|
+
shutil.copy(source, target)
|
|
18
|
+
|
|
19
|
+
print('✔ Successfully generated config.yml.')
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main() -> None:
|
|
23
|
+
"""Parse CLI arguments and dispatch the requested subcommand."""
|
|
24
|
+
parser = argparse.ArgumentParser(description='DisManager CLI')
|
|
25
|
+
subparsers = parser.add_subparsers(dest='command')
|
|
26
|
+
|
|
27
|
+
init_parser = subparsers.add_parser('init', help='Initialize the project')
|
|
28
|
+
init_parser.set_defaults(func=init)
|
|
29
|
+
|
|
30
|
+
run_parser = subparsers.add_parser('run', help='Run DisManager')
|
|
31
|
+
run_parser.set_defaults(func=run)
|
|
32
|
+
|
|
33
|
+
args = parser.parse_args()
|
|
34
|
+
if args.command:
|
|
35
|
+
args.func()
|
|
36
|
+
else:
|
|
37
|
+
parser.print_help()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if __name__ == '__main__':
|
|
41
|
+
main()
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from .config import ConfigError, DisManagerConfig, load_config
|
|
4
|
+
from .i18n import _, init_i18n
|
|
5
|
+
from .logs import LogSession
|
|
6
|
+
from .paths import ADDONS_DIR, BACKUPS_DIR, DATA_DIR, LOGS_DIR, ensure_workspace_dirs
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
'ADDONS_DIR',
|
|
10
|
+
'BACKUPS_DIR',
|
|
11
|
+
'ConfigError',
|
|
12
|
+
'DATA_DIR',
|
|
13
|
+
'DisManagerConfig',
|
|
14
|
+
'LOGS_DIR',
|
|
15
|
+
'LogSession',
|
|
16
|
+
'_',
|
|
17
|
+
'ensure_workspace_dirs',
|
|
18
|
+
'init_i18n',
|
|
19
|
+
'load_config',
|
|
20
|
+
]
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any, TypeGuard
|
|
7
|
+
|
|
8
|
+
from ruamel.yaml import YAML
|
|
9
|
+
from ruamel.yaml.error import YAMLError
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ConfigError(Exception):
|
|
13
|
+
"""Raised when the DisManager configuration file cannot be read or is invalid."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(frozen=True, slots=True)
|
|
17
|
+
class DisManagerConfig:
|
|
18
|
+
"""Validated runtime configuration for DisManager."""
|
|
19
|
+
|
|
20
|
+
bot_token : str
|
|
21
|
+
bot_prefix : str
|
|
22
|
+
panel_id : int
|
|
23
|
+
language : str
|
|
24
|
+
backups : int
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def load_config() -> DisManagerConfig:
|
|
28
|
+
"""Load and validate a YAML configuration file from disk."""
|
|
29
|
+
config_path = Path('config.yml')
|
|
30
|
+
yaml = YAML(typ='safe')
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
content = config_path.read_text(encoding='utf-8')
|
|
34
|
+
except OSError as exc:
|
|
35
|
+
raise ConfigError(f"The file '{config_path}' could not be opened: {exc}") from exc
|
|
36
|
+
|
|
37
|
+
try:
|
|
38
|
+
raw: object = yaml.load(content)
|
|
39
|
+
except YAMLError as exc:
|
|
40
|
+
raise ConfigError(f"The file '{config_path}' contains invalid YAML: {exc}") from exc
|
|
41
|
+
|
|
42
|
+
return _validate_config(raw)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# =========================================
|
|
46
|
+
# Internal Helpers
|
|
47
|
+
# =========================================
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _validate_config(raw: object) -> DisManagerConfig:
|
|
51
|
+
if not isinstance(raw, Mapping):
|
|
52
|
+
raise ConfigError('Configuration root must be a YAML mapping.')
|
|
53
|
+
|
|
54
|
+
return DisManagerConfig(
|
|
55
|
+
bot_token=_require_non_empty_str(raw, 'Bot Token'),
|
|
56
|
+
bot_prefix=_parse_bot_prefix(raw),
|
|
57
|
+
panel_id=_parse_panel_id(raw),
|
|
58
|
+
language=_parse_language(raw),
|
|
59
|
+
backups=_parse_backups(raw),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _is_strict_int(value: object) -> TypeGuard[int]:
|
|
64
|
+
return isinstance(value, int) and not isinstance(value, bool)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _require_non_empty_str(data: Mapping[str, Any], key: str) -> str:
|
|
68
|
+
value = data.get(key)
|
|
69
|
+
if not isinstance(value, str) or not value.strip():
|
|
70
|
+
raise ConfigError(f"The '{key}' variable must be a non-empty string.")
|
|
71
|
+
return value.strip()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _parse_bot_prefix(data: Mapping[str, Any]) -> str:
|
|
75
|
+
default_prefix = '!!'
|
|
76
|
+
value = data.get('Bot Prefix')
|
|
77
|
+
if value is None:
|
|
78
|
+
return default_prefix
|
|
79
|
+
if not isinstance(value, str) or not value.strip():
|
|
80
|
+
raise ConfigError("The 'Bot Prefix' variable must be a non-empty string or null.")
|
|
81
|
+
return value
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _parse_panel_id(data: Mapping[str, Any]) -> int:
|
|
85
|
+
value = data.get('Panel ID')
|
|
86
|
+
if not _is_strict_int(value) or value <= 0:
|
|
87
|
+
raise ConfigError("The 'Panel ID' variable must be a positive integer.")
|
|
88
|
+
return value
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _parse_language(data: Mapping[str, Any]) -> str:
|
|
92
|
+
allowed_languages: tuple[str, ...] = ('en', 'es')
|
|
93
|
+
value = data.get('Language')
|
|
94
|
+
if not isinstance(value, str) or value not in allowed_languages:
|
|
95
|
+
allowed = ', '.join(allowed_languages)
|
|
96
|
+
raise ConfigError(f"The 'Language' variable must be one of the following: {allowed}.")
|
|
97
|
+
return value
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _parse_backups(data: Mapping[str, Any]) -> int:
|
|
101
|
+
min_backups = 1
|
|
102
|
+
max_backups = 5
|
|
103
|
+
value = data.get('Backups')
|
|
104
|
+
if not _is_strict_int(value):
|
|
105
|
+
raise ConfigError(
|
|
106
|
+
f"The 'Backups' variable must be an integer between {min_backups} and {max_backups}."
|
|
107
|
+
)
|
|
108
|
+
if not (min_backups <= value <= max_backups):
|
|
109
|
+
raise ConfigError(
|
|
110
|
+
f"The 'Backups' variable must be between {min_backups} and {max_backups}, not {value}."
|
|
111
|
+
)
|
|
112
|
+
return value
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import gettext
|
|
4
|
+
import logging
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
_LOCALES_DIR = Path(__file__).resolve().parent.parent.parent / 'locales'
|
|
8
|
+
_logger = logging.getLogger(__name__)
|
|
9
|
+
_translations: gettext.NullTranslations = gettext.NullTranslations()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def init_i18n(language: str) -> None:
|
|
13
|
+
"""Load gettext translations for ``language`` into the active module translator."""
|
|
14
|
+
global _translations
|
|
15
|
+
if language == 'en':
|
|
16
|
+
_translations = gettext.NullTranslations()
|
|
17
|
+
return
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
_translations = gettext.translation('app', localedir=str(_LOCALES_DIR), languages=[language])
|
|
21
|
+
except (OSError, ValueError) as exc:
|
|
22
|
+
_logger.warning("Could not load translations for '%s': %s", language, exc)
|
|
23
|
+
_translations = gettext.NullTranslations()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _(text: str) -> str:
|
|
27
|
+
"""Translate ``text`` using the active DisManager language."""
|
|
28
|
+
return _translations.gettext(text)
|