#!/usr/bin/env python3
"""Terminal UI helpers for the PHP2Shell toolkit."""
from __future__ import annotations
import os
import shlex
import sys
import time
RESET = "\033[0m"
BOLD = "\033[1m"
DIM = "\033[2m"
RED = "\033[91m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
CYAN = "\033[96m"
MAGENTA = "\033[95m"
BANNER = r"""
"""
class UI:
def __init__(self, color: bool = True):
self.color = bool(color) and os.environ.get("NO_COLOR") is None and sys.stdout.isatty()
self.t0 = time.monotonic()
# -- primitives ---------------------------------------------------------
def c(self, code: str, text: str) -> str:
return f"{code}{text}{RESET}" if self.color else text
def elapsed(self) -> str:
total = time.monotonic() - self.t0
return f"{int(total) // 60:02d}:{total % 60:05.2f}"
def banner(self) -> None:
print(self.c(CYAN + BOLD, BANNER))
print(self.c(MAGENTA + BOLD, " exploit by devploit CVE-2026-109618 / CVE-2026-109619"))
print(self.c(DIM, " automatic target detection, build profile dispatch and command execution"))
print(self.c(DIM, " authorized testing only\n"))
def chain(self, index: str, text: str) -> None:
print(self.c(BOLD + CYAN, f"[*] CHAIN {index} ") + self.c(DIM, text))
def stage(self, name: str, message: str = "") -> None:
label = self.c(CYAN, f"{name: