printerxpl-forge 6.2.0__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.
- nse/README.md +204 -0
- nse/__init__.py +6 -0
- nse/install_nse.py +412 -0
- nse/lib/printerxpl.lua +238 -0
- nse/scripts/cups-info.nse +74 -0
- nse/scripts/cups-queue-info.nse +43 -0
- nse/scripts/hp-printers-cve-2022-1026.nse +121 -0
- nse/scripts/http-device-mac.nse +107 -0
- nse/scripts/http-hp-ilo-info.nse +121 -0
- nse/scripts/http-info-xerox-enum.nse +101 -0
- nse/scripts/http-vuln-cve2022-1026.nse +158 -0
- nse/scripts/lexmark-config.nse +89 -0
- nse/scripts/pjl-ready-message.nse +106 -0
- nse/scripts/printer-banner.nse +217 -0
- nse/scripts/printer-cups-rce.nse +189 -0
- nse/scripts/printer-cve-detect.nse +279 -0
- nse/scripts/printer-discover.nse +205 -0
- nse/scripts/printer-firmware-exposed.nse +219 -0
- nse/scripts/printer-hp-pjl.nse +192 -0
- nse/scripts/printer-http-ews.nse +293 -0
- nse/scripts/printer-ipp-info.nse +235 -0
- nse/scripts/printer-lexmark-ipp.nse +203 -0
- nse/scripts/printer-passback.nse +204 -0
- nse/scripts/printer-pjl-info.nse +146 -0
- nse/scripts/printer-printnightmare.nse +211 -0
- nse/scripts/printer-snmp-info.nse +176 -0
- nse/scripts/printer-vuln-check.nse +256 -0
- nse/scripts/snmp-device-mac.nse +93 -0
- nse/scripts/snmp-info.nse +146 -0
- nse/scripts/snmp-sysdescr.nse +70 -0
- printerxpl_forge-6.2.0.dist-info/METADATA +919 -0
- printerxpl_forge-6.2.0.dist-info/RECORD +97 -0
- printerxpl_forge-6.2.0.dist-info/WHEEL +5 -0
- printerxpl_forge-6.2.0.dist-info/entry_points.txt +4 -0
- printerxpl_forge-6.2.0.dist-info/licenses/LICENSE +21 -0
- printerxpl_forge-6.2.0.dist-info/top_level.txt +4 -0
- src/assets/fonts/gunplay.pfa +1671 -0
- src/assets/fonts/kshandwrt.pfa +315 -0
- src/assets/fonts/laksoner.pfa +2402 -0
- src/assets/fonts/paintcans.pfa +9699 -0
- src/assets/fonts/stencilod.pfa +4076 -0
- src/assets/fonts/takecover.pfa +26138 -0
- src/assets/fonts/topsecret.pfa +6652 -0
- src/assets/fonts/whoa.pfa +773 -0
- src/assets/mibs/HOST-RESOURCES-MIB +1540 -0
- src/assets/mibs/Printer-MIB +4389 -0
- src/assets/mibs/README.md +9 -0
- src/assets/mibs/SNMPv2-MIB +854 -0
- src/assets/overlays/hacker.eps +596 -0
- src/assets/overlays/smiley.eps +214 -0
- src/assets/overlays/smiley2.eps +240 -0
- src/core/attack_orchestrator.py +1025 -0
- src/core/capabilities.py +323 -0
- src/core/destructive_audit.py +430 -0
- src/core/discovery.py +488 -0
- src/core/osdetect.py +74 -0
- src/core/poly_runner.py +579 -0
- src/core/printer.py +1426 -0
- src/main.py +2134 -0
- src/modules/install_printer.py +318 -0
- src/modules/login_bruteforce.py +852 -0
- src/modules/pcl.py +506 -0
- src/modules/pjl.py +3575 -0
- src/modules/print_job.py +1290 -0
- src/modules/ps.py +1102 -0
- src/payloads/__init__.py +98 -0
- src/payloads/assets/overlays/notice.eps +9 -0
- src/protocols/__init__.py +19 -0
- src/protocols/firmware.py +738 -0
- src/protocols/ipp.py +216 -0
- src/protocols/ipp_attacks.py +609 -0
- src/protocols/lpd.py +141 -0
- src/protocols/network_map.py +1004 -0
- src/protocols/raw.py +173 -0
- src/protocols/smb.py +359 -0
- src/protocols/ssrf_pivot.py +427 -0
- src/protocols/storage.py +587 -0
- src/ui/__init__.py +6 -0
- src/ui/interactive.py +742 -0
- src/ui/spinner.py +112 -0
- src/ui/tables.py +132 -0
- src/utils/banner_grabber.py +852 -0
- src/utils/codebook.py +456 -0
- src/utils/config.py +522 -0
- src/utils/cve_loader.py +158 -0
- src/utils/default_creds.py +134 -0
- src/utils/discovery_online.py +1327 -0
- src/utils/exploit_manager.py +805 -0
- src/utils/fuzzer.py +220 -0
- src/utils/helper.py +732 -0
- src/utils/local_printers.py +307 -0
- src/utils/ml_engine.py +491 -0
- src/utils/operators.py +474 -0
- src/utils/ports.py +234 -0
- src/utils/vuln_scanner.py +823 -0
- src/utils/wordlist_loader.py +412 -0
- src/version.py +36 -0
src/ui/spinner.py
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
PrinterXPL-Forge — Terminal Spinner
|
|
5
|
+
==================================
|
|
6
|
+
Thread-based spinner for long-running operations.
|
|
7
|
+
Works on Windows, Linux and macOS without external deps.
|
|
8
|
+
"""
|
|
9
|
+
# Author : Andre Henrique (@mrhenrike)
|
|
10
|
+
# GitHub : https://github.com/mrhenrike
|
|
11
|
+
# LinkedIn : https://linkedin.com/in/mrhenrike
|
|
12
|
+
# X/Twitter : https://x.com/mrhenrike
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import sys
|
|
17
|
+
import threading
|
|
18
|
+
import time
|
|
19
|
+
from contextlib import contextmanager
|
|
20
|
+
from typing import Optional
|
|
21
|
+
|
|
22
|
+
_CYN = '\033[1;36m'
|
|
23
|
+
_GRN = '\033[1;32m'
|
|
24
|
+
_YEL = '\033[1;33m'
|
|
25
|
+
_RED = '\033[1;31m'
|
|
26
|
+
_DIM = '\033[2;37m'
|
|
27
|
+
_RST = '\033[0m'
|
|
28
|
+
_CLR = '\r\033[K' # carriage return + clear line
|
|
29
|
+
|
|
30
|
+
_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
|
|
31
|
+
_FRAMES_ASCII = ['|', '/', '-', '\\'] # fallback for terminals without unicode
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _supports_unicode() -> bool:
|
|
35
|
+
try:
|
|
36
|
+
'⠋'.encode(sys.stdout.encoding or 'utf-8')
|
|
37
|
+
return True
|
|
38
|
+
except (UnicodeEncodeError, LookupError, AttributeError):
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Spinner:
|
|
43
|
+
"""
|
|
44
|
+
Context-manager spinner that shows animated activity during slow operations.
|
|
45
|
+
|
|
46
|
+
Usage:
|
|
47
|
+
with Spinner("Scanning...") as sp:
|
|
48
|
+
do_slow_thing()
|
|
49
|
+
sp.update("Still scanning...")
|
|
50
|
+
# On exit: shows [DONE] or [FAIL] automatically
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(self, message: str = '', color: str = _CYN,
|
|
54
|
+
interval: float = 0.08) -> None:
|
|
55
|
+
self.message = message
|
|
56
|
+
self.color = color
|
|
57
|
+
self.interval = interval
|
|
58
|
+
self._stop = threading.Event()
|
|
59
|
+
self._thread: Optional[threading.Thread] = None
|
|
60
|
+
self._frames = _FRAMES if _supports_unicode() else _FRAMES_ASCII
|
|
61
|
+
self._done = False
|
|
62
|
+
self._failed = False
|
|
63
|
+
|
|
64
|
+
def _spin(self) -> None:
|
|
65
|
+
i = 0
|
|
66
|
+
while not self._stop.is_set():
|
|
67
|
+
frame = self._frames[i % len(self._frames)]
|
|
68
|
+
sys.stdout.write(
|
|
69
|
+
f'{_CLR} {self.color}{frame}{_RST} {_DIM}{self.message}{_RST}'
|
|
70
|
+
)
|
|
71
|
+
sys.stdout.flush()
|
|
72
|
+
time.sleep(self.interval)
|
|
73
|
+
i += 1
|
|
74
|
+
|
|
75
|
+
def start(self) -> 'Spinner':
|
|
76
|
+
self._stop.clear()
|
|
77
|
+
self._thread = threading.Thread(target=self._spin, daemon=True)
|
|
78
|
+
self._thread.start()
|
|
79
|
+
return self
|
|
80
|
+
|
|
81
|
+
def update(self, message: str) -> None:
|
|
82
|
+
"""Update the spinner message while running."""
|
|
83
|
+
self.message = message
|
|
84
|
+
|
|
85
|
+
def stop(self, success: bool = True, final_msg: str = '') -> None:
|
|
86
|
+
self._stop.set()
|
|
87
|
+
if self._thread:
|
|
88
|
+
self._thread.join(timeout=0.5)
|
|
89
|
+
icon = f'{_GRN}✔{_RST}' if success else f'{_RED}✘{_RST}'
|
|
90
|
+
label = final_msg or self.message
|
|
91
|
+
sys.stdout.write(f'{_CLR} {icon} {label}\n')
|
|
92
|
+
sys.stdout.flush()
|
|
93
|
+
|
|
94
|
+
def __enter__(self) -> 'Spinner':
|
|
95
|
+
return self.start()
|
|
96
|
+
|
|
97
|
+
def __exit__(self, exc_type, exc_val, exc_tb) -> None:
|
|
98
|
+
self.stop(success=(exc_type is None))
|
|
99
|
+
return False # re-raise exceptions
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@contextmanager
|
|
103
|
+
def spinning(message: str, color: str = _CYN, done_msg: str = ''):
|
|
104
|
+
"""Convenience context manager."""
|
|
105
|
+
sp = Spinner(message, color)
|
|
106
|
+
sp.start()
|
|
107
|
+
try:
|
|
108
|
+
yield sp
|
|
109
|
+
sp.stop(True, done_msg or message)
|
|
110
|
+
except Exception:
|
|
111
|
+
sp.stop(False, f'{message} — failed')
|
|
112
|
+
raise
|
src/ui/tables.py
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
PrinterXPL-Forge — Terminal Table Renderer
|
|
5
|
+
========================================
|
|
6
|
+
Simple, dependency-free table rendering for CLI output.
|
|
7
|
+
"""
|
|
8
|
+
# Author : Andre Henrique (@mrhenrike)
|
|
9
|
+
# GitHub : https://github.com/mrhenrike
|
|
10
|
+
# LinkedIn : https://linkedin.com/in/mrhenrike
|
|
11
|
+
# X/Twitter : https://x.com/mrhenrike
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import shutil
|
|
16
|
+
from typing import Any, List, Optional, Tuple
|
|
17
|
+
|
|
18
|
+
_RST = '\033[0m'
|
|
19
|
+
_DIM = '\033[2;37m'
|
|
20
|
+
_BLD = '\033[1m'
|
|
21
|
+
_CYN = '\033[1;36m'
|
|
22
|
+
_GRN = '\033[1;32m'
|
|
23
|
+
_YEL = '\033[1;33m'
|
|
24
|
+
_RED = '\033[1;31m'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _strip_ansi(s: str) -> str:
|
|
28
|
+
"""Return string length ignoring ANSI escape sequences."""
|
|
29
|
+
import re
|
|
30
|
+
return re.sub(r'\033\[[0-9;]*m', '', s)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _vis_len(s: str) -> int:
|
|
34
|
+
return len(_strip_ansi(s))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def box(title: str = '', lines: List[str] = None,
|
|
38
|
+
width: Optional[int] = None, color: str = _CYN) -> str:
|
|
39
|
+
"""
|
|
40
|
+
Render a bordered box with optional title and content lines.
|
|
41
|
+
|
|
42
|
+
Example:
|
|
43
|
+
╔══════════════════════╗
|
|
44
|
+
║ Title ║
|
|
45
|
+
╠══════════════════════╣
|
|
46
|
+
║ Line 1 ║
|
|
47
|
+
╚══════════════════════╝
|
|
48
|
+
"""
|
|
49
|
+
term_w = shutil.get_terminal_size((80, 24)).columns
|
|
50
|
+
w = min(width or 66, term_w - 2)
|
|
51
|
+
inner = w - 2
|
|
52
|
+
|
|
53
|
+
top = f" {color}╔{'═' * inner}╗{_RST}"
|
|
54
|
+
div = f" {color}╠{'═' * inner}╣{_RST}"
|
|
55
|
+
bot = f" {color}╚{'═' * inner}╝{_RST}"
|
|
56
|
+
side = lambda s: f" {color}║{_RST} {s:<{inner - 1}}{color}║{_RST}"
|
|
57
|
+
|
|
58
|
+
parts = [top]
|
|
59
|
+
if title:
|
|
60
|
+
parts.append(side(f'{_BLD}{title}{_RST}'))
|
|
61
|
+
if lines:
|
|
62
|
+
parts.append(div)
|
|
63
|
+
for line in (lines or []):
|
|
64
|
+
# Handle long lines
|
|
65
|
+
visible = _strip_ansi(line)
|
|
66
|
+
if len(visible) <= inner - 1:
|
|
67
|
+
parts.append(side(line))
|
|
68
|
+
else:
|
|
69
|
+
# Truncate with ellipsis
|
|
70
|
+
parts.append(side(line[:inner - 4] + '...'))
|
|
71
|
+
parts.append(bot)
|
|
72
|
+
return '\n'.join(parts)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def table(headers: List[str], rows: List[List[Any]],
|
|
76
|
+
col_colors: List[str] = None,
|
|
77
|
+
header_color: str = _CYN,
|
|
78
|
+
indent: str = ' ') -> str:
|
|
79
|
+
"""
|
|
80
|
+
Render a simple aligned table.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
headers: Column header labels.
|
|
84
|
+
rows: List of row data (each row is a list of values).
|
|
85
|
+
col_colors: Per-column ANSI color codes.
|
|
86
|
+
header_color: Color for header row.
|
|
87
|
+
"""
|
|
88
|
+
if not rows and not headers:
|
|
89
|
+
return ''
|
|
90
|
+
|
|
91
|
+
num_cols = len(headers)
|
|
92
|
+
col_widths = [_vis_len(str(h)) for h in headers]
|
|
93
|
+
for row in rows:
|
|
94
|
+
for i, cell in enumerate(row[:num_cols]):
|
|
95
|
+
col_widths[i] = max(col_widths[i], _vis_len(str(cell)))
|
|
96
|
+
|
|
97
|
+
def fmt_row(cells: List[Any], colors: List[str] = None) -> str:
|
|
98
|
+
parts = []
|
|
99
|
+
for i, cell in enumerate(cells[:num_cols]):
|
|
100
|
+
w = col_widths[i]
|
|
101
|
+
s = str(cell)
|
|
102
|
+
vis = _vis_len(s)
|
|
103
|
+
pad = ' ' * max(0, w - vis)
|
|
104
|
+
clr = (colors[i] if colors and i < len(colors) else '') if colors else ''
|
|
105
|
+
rst = _RST if clr else ''
|
|
106
|
+
parts.append(f"{clr}{s}{rst}{pad}")
|
|
107
|
+
return f"{indent} " + ' '.join(parts)
|
|
108
|
+
|
|
109
|
+
sep_line = indent + ' ' + ' '.join('─' * w for w in col_widths)
|
|
110
|
+
|
|
111
|
+
lines = []
|
|
112
|
+
lines.append(fmt_row(
|
|
113
|
+
[f"{header_color}{h}{_RST}" for h in headers],
|
|
114
|
+
))
|
|
115
|
+
lines.append(sep_line)
|
|
116
|
+
for row in rows:
|
|
117
|
+
lines.append(fmt_row(row, col_colors))
|
|
118
|
+
return '\n'.join(lines)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def section(title: str, color: str = _CYN, width: int = 60) -> str:
|
|
122
|
+
"""Render a section header line."""
|
|
123
|
+
term_w = shutil.get_terminal_size((80, 24)).columns
|
|
124
|
+
w = min(width, term_w - 4)
|
|
125
|
+
bar = '─' * w
|
|
126
|
+
return f"\n {color}┌{'─' * 2} {title} {'─' * max(0, w - len(title) - 4)}┐{_RST}"
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def summary_line(label: str, value: str, label_color: str = _DIM,
|
|
130
|
+
value_color: str = _RST) -> str:
|
|
131
|
+
"""Render a key-value summary line."""
|
|
132
|
+
return f" {label_color}{label:<18}{_RST} {value_color}{value}{_RST}"
|