blackops-cli 0.1.5__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.
- blackops_cli/__init__.py +62 -0
- blackops_cli/colour.py +29 -0
- blackops_cli/entrypoint.py +94 -0
- blackops_cli/logging.py +88 -0
- blackops_cli/output.py +202 -0
- blackops_cli/prompts.py +56 -0
- blackops_cli/report_html.py +358 -0
- blackops_cli/report_sarif.py +208 -0
- blackops_cli/reporter.py +92 -0
- blackops_cli/severity.py +95 -0
- blackops_cli-0.1.5.dist-info/METADATA +19 -0
- blackops_cli-0.1.5.dist-info/RECORD +14 -0
- blackops_cli-0.1.5.dist-info/WHEEL +4 -0
- blackops_cli-0.1.5.dist-info/licenses/LICENSE +661 -0
blackops_cli/severity.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
# Copyright (c) 2026 CommonHuman-Lab
|
|
3
|
+
"""Severity levels for scan findings — shared across all BlackOpsSQL tools.
|
|
4
|
+
|
|
5
|
+
Usage::
|
|
6
|
+
|
|
7
|
+
from blackops_cli.severity import Severity, severity_colour, CRITICAL, HIGH
|
|
8
|
+
|
|
9
|
+
# In a finding dataclass:
|
|
10
|
+
severity: str = Severity.HIGH
|
|
11
|
+
|
|
12
|
+
# In output code:
|
|
13
|
+
colour_fn = severity_colour(finding.severity)
|
|
14
|
+
print(colour_fn(f"[{finding.severity}] {finding.url}"))
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from typing import Callable
|
|
20
|
+
|
|
21
|
+
from blackops_cli.colour import RED, YELLOW, CYAN, GREEN, DIM
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"Severity",
|
|
25
|
+
"CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO",
|
|
26
|
+
"severity_colour",
|
|
27
|
+
"severity_label",
|
|
28
|
+
"SEVERITY_ORDER",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Severity:
|
|
33
|
+
"""String constants for finding severity levels.
|
|
34
|
+
|
|
35
|
+
Designed as a simple namespace of constants rather than an Enum so that
|
|
36
|
+
finding dataclasses can use ``severity: str = Severity.HIGH`` without
|
|
37
|
+
importing an Enum type — keeping finding dataclasses dependency-light.
|
|
38
|
+
"""
|
|
39
|
+
CRITICAL = "critical"
|
|
40
|
+
HIGH = "high"
|
|
41
|
+
MEDIUM = "medium"
|
|
42
|
+
LOW = "low"
|
|
43
|
+
INFO = "info"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Convenience aliases at module level
|
|
47
|
+
CRITICAL = Severity.CRITICAL
|
|
48
|
+
HIGH = Severity.HIGH
|
|
49
|
+
MEDIUM = Severity.MEDIUM
|
|
50
|
+
LOW = Severity.LOW
|
|
51
|
+
INFO = Severity.INFO
|
|
52
|
+
|
|
53
|
+
# Ordered from most to least severe (useful for sorting / filtering)
|
|
54
|
+
SEVERITY_ORDER: list[str] = [CRITICAL, HIGH, MEDIUM, LOW, INFO]
|
|
55
|
+
|
|
56
|
+
# Numeric scores for sorting / ranking
|
|
57
|
+
_SEVERITY_SCORE: dict[str, int] = {
|
|
58
|
+
CRITICAL: 4,
|
|
59
|
+
HIGH: 3,
|
|
60
|
+
MEDIUM: 2,
|
|
61
|
+
LOW: 1,
|
|
62
|
+
INFO: 0,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def severity_colour(severity: str) -> Callable[[str], str]:
|
|
67
|
+
"""Return the terminal colour function appropriate for *severity*.
|
|
68
|
+
|
|
69
|
+
Falls back to DIM for unknown values.
|
|
70
|
+
|
|
71
|
+
Example::
|
|
72
|
+
|
|
73
|
+
colour = severity_colour(Severity.HIGH)
|
|
74
|
+
print(colour("[HIGH] Reflected XSS confirmed"))
|
|
75
|
+
"""
|
|
76
|
+
return {
|
|
77
|
+
CRITICAL: RED,
|
|
78
|
+
HIGH: RED,
|
|
79
|
+
MEDIUM: YELLOW,
|
|
80
|
+
LOW: CYAN,
|
|
81
|
+
INFO: DIM,
|
|
82
|
+
}.get(severity, DIM)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def severity_label(severity: str) -> str:
|
|
86
|
+
"""Return a fixed-width uppercase severity label for display.
|
|
87
|
+
|
|
88
|
+
Example: ``severity_label("high")`` → ``"HIGH "``
|
|
89
|
+
"""
|
|
90
|
+
return severity.upper().ljust(8)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def severity_score(severity: str) -> int:
|
|
94
|
+
"""Return a numeric score for sorting (higher = more severe)."""
|
|
95
|
+
return _SEVERITY_SCORE.get(severity, 0)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: blackops-cli
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: Shared CLI/terminal UX primitives for BlackOpsSQL tools
|
|
5
|
+
Project-URL: Homepage, https://github.com/roc1t1z3not/BlackOpsSQL
|
|
6
|
+
Author: roc1t1z3not
|
|
7
|
+
License: AGPL-3.0-or-later
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: ansi,cli,logging,pentest,security,terminal
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Security
|
|
19
|
+
Requires-Python: >=3.10
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
blackops_cli/__init__.py,sha256=hMoXwLI5NwUS8nAFc3ZUNqyi9FXzxbHiTQbhlTG-UHE,2145
|
|
2
|
+
blackops_cli/colour.py,sha256=SWELnfaViW_D5tIRYi-dF_r66nqk4TiOzqMvjxHMWik,814
|
|
3
|
+
blackops_cli/entrypoint.py,sha256=dLYibBOsQ7cuZRcSC01f5RGWD8lcZ-2Evf-0HiNK2yI,2789
|
|
4
|
+
blackops_cli/logging.py,sha256=NsA8lNR1VtqBItbOYIou77lOx4AtPoSAiDJuYqgOLP4,2681
|
|
5
|
+
blackops_cli/output.py,sha256=636Wi08e-r2c4w2J20DSKiylrcHBBrTj8yrGiaBoxpc,6474
|
|
6
|
+
blackops_cli/prompts.py,sha256=CglDNx_z2M3Hj3ULvk5qlyyDCZxVZBf859sSfh0mduM,1721
|
|
7
|
+
blackops_cli/report_html.py,sha256=-5NJb9wWtz85A9X8qGq5BT0arwfFSAMZ71f9DXhRQL0,13554
|
|
8
|
+
blackops_cli/report_sarif.py,sha256=ehxo7hVDaCIpPZFYSALgp0xOlDxhV9Qv3R5i4jABAW8,7540
|
|
9
|
+
blackops_cli/reporter.py,sha256=MCXsFW9NzOQ3O6_8bt07lRPPH97rJ_fkLcEVxS_XiF0,3339
|
|
10
|
+
blackops_cli/severity.py,sha256=53OKrfuOFZ-CWiBPe24QTpWtvC9DzmOA_nX8QbLbgtY,2449
|
|
11
|
+
blackops_cli-0.1.5.dist-info/METADATA,sha256=isEhpGenVVaZgnJ5iyqCn4lant0H5bWpJPsZ6c9labs,781
|
|
12
|
+
blackops_cli-0.1.5.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
13
|
+
blackops_cli-0.1.5.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
14
|
+
blackops_cli-0.1.5.dist-info/RECORD,,
|