GuardianUnivalle-Benito-Yucra 0.1.51__py3-none-any.whl → 0.1.53__py3-none-any.whl

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.

Potentially problematic release.


This version of GuardianUnivalle-Benito-Yucra might be problematic. Click here for more details.

@@ -2,8 +2,9 @@ import os
2
2
  import datetime
3
3
  import json
4
4
 
5
- LOG_FILE = "auditoria_guardian.log"
6
-
5
+ # 📁 Guardar los logs dentro de una carpeta "logs"
6
+ LOG_DIR = "logs"
7
+ LOG_FILE = os.path.join(LOG_DIR, "auditoria_guardian.log")
7
8
 
8
9
  def registrar_evento(
9
10
  tipo: str,
@@ -11,6 +12,10 @@ def registrar_evento(
11
12
  severidad: str = "MEDIA",
12
13
  extra: dict | None = None,
13
14
  ):
15
+ """
16
+ Registra un evento de auditoría en un archivo JSON línea por línea.
17
+ Cada línea representa un evento.
18
+ """
14
19
  try:
15
20
  evento = {
16
21
  "fecha": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
@@ -20,10 +25,8 @@ def registrar_evento(
20
25
  "extra": extra or {},
21
26
  }
22
27
 
23
- # ✅ Crear carpeta solo si hay directorio en la ruta
24
- log_dir = os.path.dirname(LOG_FILE)
25
- if log_dir:
26
- os.makedirs(log_dir, exist_ok=True)
28
+ # ✅ Crear carpeta si no existe
29
+ os.makedirs(LOG_DIR, exist_ok=True)
27
30
 
28
31
  with open(LOG_FILE, "a", encoding="utf-8") as f:
29
32
  f.write(json.dumps(evento, ensure_ascii=False) + "\n")
@@ -31,9 +34,8 @@ def registrar_evento(
31
34
  except Exception as e:
32
35
  print(f"[Auditoría] Error al registrar evento: {e}")
33
36
 
34
-
35
37
  def generar_reporte() -> str:
36
- """Devuelve todo el contenido del archivo de auditoría."""
38
+ """Devuelve el contenido completo del archivo de auditoría."""
37
39
  if not os.path.exists(LOG_FILE):
38
40
  return "No hay registros aún."
39
41
  with open(LOG_FILE, "r", encoding="utf-8") as f:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GuardianUnivalle-Benito-Yucra
3
- Version: 0.1.51
3
+ Version: 0.1.53
4
4
  Summary: Middleware y detectores de seguridad (SQLi, XSS, CSRF, DoS, Keylogger) para Django/Flask
5
5
  Author-email: Andres Benito Calle Yucra <benitoandrescalle035@gmail.com>
6
6
  License: MIT
@@ -1,13 +1,13 @@
1
1
  GuardianUnivalle_Benito_Yucra/__init__.py,sha256=lbIRb8fCFYfAdyJV6NsYVZJ5pKYSJZKhhK-En9g_1M8,762
2
2
  GuardianUnivalle_Benito_Yucra/utilidades.py,sha256=lFNVnlyTSYmQ1CqtmHx6aefK5uNw0wsMdHRQyxAIZy0,120
3
- GuardianUnivalle_Benito_Yucra/auditoria/registro_auditoria.py,sha256=NnKBOeRWkXVGaMBeQRYU528rWlaBDBPmTAzfji9n8fw,1135
3
+ GuardianUnivalle_Benito_Yucra/auditoria/registro_auditoria.py,sha256=866LKUjh1XwsYGmW6qLEM3pUdtATYCfiqLaeio2EOrg,1272
4
4
  GuardianUnivalle_Benito_Yucra/detectores/detector_csrf.py,sha256=q7-UsVseTtIYZz4bbpx2X0kzpDmu2Cetm7eYPJtsruA,7608
5
5
  GuardianUnivalle_Benito_Yucra/detectores/detector_dos.py,sha256=m5ibalfC5ZVd-Ec8303lfVgxsnupA7FHQGssyhbGB7o,14193
6
6
  GuardianUnivalle_Benito_Yucra/detectores/detector_keylogger.py,sha256=L5RQ0Sdgg7hTU1qkZYwt7AcDqtAzT6u-jwBGo7YWfsw,8078
7
7
  GuardianUnivalle_Benito_Yucra/detectores/detector_sql.py,sha256=EEbnn5J7sZxnsA2a0cT1VAB4ZS7BMhQiHSeqrR2SU3A,4820
8
8
  GuardianUnivalle_Benito_Yucra/detectores/detector_xss.py,sha256=EDxGDaOosFJCyWTS_HkB300qL30ArxAEi-i0cVrzXyU,11027
9
- guardianunivalle_benito_yucra-0.1.51.dist-info/licenses/LICENSE,sha256=5e4IdL542v1E8Ft0A24GZjrxZeTsVK7XrS3mZEUhPtM,37
10
- guardianunivalle_benito_yucra-0.1.51.dist-info/METADATA,sha256=-cN5bh7xRQHQ9TqZ5r_-PbhYzF5seAt7-cVW0kPsW2A,1893
11
- guardianunivalle_benito_yucra-0.1.51.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- guardianunivalle_benito_yucra-0.1.51.dist-info/top_level.txt,sha256=HTWfZM64WAV_QYr5cnXnLuabQt92dvlxqlR3pCwpbDQ,30
13
- guardianunivalle_benito_yucra-0.1.51.dist-info/RECORD,,
9
+ guardianunivalle_benito_yucra-0.1.53.dist-info/licenses/LICENSE,sha256=5e4IdL542v1E8Ft0A24GZjrxZeTsVK7XrS3mZEUhPtM,37
10
+ guardianunivalle_benito_yucra-0.1.53.dist-info/METADATA,sha256=Op0GV0NDL_2bCh-mLiJ6-d9LvCibq3eS0ULX7WpN_6c,1893
11
+ guardianunivalle_benito_yucra-0.1.53.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ guardianunivalle_benito_yucra-0.1.53.dist-info/top_level.txt,sha256=HTWfZM64WAV_QYr5cnXnLuabQt92dvlxqlR3pCwpbDQ,30
13
+ guardianunivalle_benito_yucra-0.1.53.dist-info/RECORD,,