sync: auto-sync from HOWARD-HOME at 2026-06-21 19:32:30
Author: Howard Enos Machine: HOWARD-HOME Timestamp: 2026-06-21 19:32:30
This commit is contained in:
@@ -119,6 +119,18 @@ def cmd_session(client, args):
|
||||
return 0
|
||||
|
||||
|
||||
def cmd_build_installer(client, args):
|
||||
url = client.build_installer_url(
|
||||
platform=args.platform, name=args.name,
|
||||
company=args.company, site=args.site, tag=args.tag,
|
||||
)
|
||||
if args.json:
|
||||
_emit({"installer_url": url, "platform": args.platform}, True)
|
||||
return 0
|
||||
print(url)
|
||||
return 0
|
||||
|
||||
|
||||
def cmd_send_command(client, args):
|
||||
if not _gated(f"run command on session {args.session} : {args.run_command!r}", args.confirm):
|
||||
return 3
|
||||
@@ -183,9 +195,19 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
sp = sub.add_parser("sessions", help="List sessions by Name (verified).", parents=[common])
|
||||
sp.add_argument("--name", default="", help="Session Name filter (blank = unattended).")
|
||||
|
||||
sp = sub.add_parser("session", help="Session detail (pending unlock).", parents=[common])
|
||||
sp = sub.add_parser("session", help="Session detail.", parents=[common])
|
||||
sp.add_argument("session_id")
|
||||
|
||||
sp = sub.add_parser("build-installer",
|
||||
help="Build a parameterized Access installer URL.",
|
||||
parents=[common])
|
||||
sp.add_argument("--platform", default="msi",
|
||||
help="msi | exe | pkg | deb | rpm | sh (default msi).")
|
||||
sp.add_argument("--name", help="Session name (defaults to machine name if omitted).")
|
||||
sp.add_argument("--company", help="CP1 = Company.")
|
||||
sp.add_argument("--site", help="CP2 = Site.")
|
||||
sp.add_argument("--tag", help="CP3 = Tag.")
|
||||
|
||||
sp = sub.add_parser("send-command", help="Run a backstage command (gated; pending unlock).",
|
||||
parents=[common])
|
||||
sp.add_argument("--session", required=True)
|
||||
@@ -219,6 +241,7 @@ HANDLERS = {
|
||||
"status": cmd_status,
|
||||
"sessions": cmd_sessions,
|
||||
"session": cmd_session,
|
||||
"build-installer": cmd_build_installer,
|
||||
"send-command": cmd_send_command,
|
||||
"send-message": cmd_send_message,
|
||||
"set-properties": cmd_set_properties,
|
||||
|
||||
@@ -33,6 +33,7 @@ import urllib.error
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
from urllib.parse import quote
|
||||
|
||||
try:
|
||||
import httpx # type: ignore
|
||||
@@ -234,6 +235,42 @@ class ScreenConnectClient:
|
||||
"""Call any RESTful API Manager method directly (power use / probing)."""
|
||||
return self.call(method, body, http_method=http_method)
|
||||
|
||||
# ======================================================================
|
||||
# INSTALLER BUILDER (no API call — constructs the parameterized access
|
||||
# installer URL so a device self-tags into the right Company/Site/Tag).
|
||||
# ======================================================================
|
||||
def build_installer_url(
|
||||
self,
|
||||
platform: str = "msi",
|
||||
name: Optional[str] = None,
|
||||
company: Optional[str] = None,
|
||||
site: Optional[str] = None,
|
||||
tag: Optional[str] = None,
|
||||
extra_props: Optional[list] = None,
|
||||
) -> str:
|
||||
"""Build a parameterized ScreenConnect ACCESS installer URL.
|
||||
|
||||
VERIFIED LIVE 2026-06-22: the cloud instance serves a pre-keyed installer at
|
||||
/Bin/ScreenConnect.ClientSetup.<platform>?e=Access&y=Guest ; append `t=`
|
||||
(session name) and repeated `c=` for the custom properties (order =
|
||||
CP1=Company, CP2=Site, CP3=Tag, ... up to 8). The installed agent self-tags
|
||||
with these, so it lands under the matching session-group filters.
|
||||
|
||||
platform: msi | exe | pkg | deb | rpm | sh
|
||||
"""
|
||||
props = [company or "", site or "", tag or ""]
|
||||
if extra_props:
|
||||
props.extend(extra_props)
|
||||
params = ["e=Access", "y=Guest"]
|
||||
if name:
|
||||
params.append("t=" + quote(name, safe=""))
|
||||
for p in props:
|
||||
params.append("c=" + quote(p, safe=""))
|
||||
return (
|
||||
f"{self.base_url}/Bin/ScreenConnect.ClientSetup.{platform}?"
|
||||
+ "&".join(params)
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
"""Minimal self-check: load secret (no network call)."""
|
||||
|
||||
Reference in New Issue
Block a user