rdp-kit-server 20261128.1__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.
- rdp_kit_server/RELEASE_NOTES.md +30 -0
- rdp_kit_server/__init__.py +15 -0
- rdp_kit_server/__main__.py +5 -0
- rdp_kit_server/bundle.py +45 -0
- rdp_kit_server/checks.py +15 -0
- rdp_kit_server/cli.py +300 -0
- rdp_kit_server/linux.py +371 -0
- rdp_kit_server/macos.py +165 -0
- rdp_kit_server/record.py +130 -0
- rdp_kit_server/util.py +171 -0
- rdp_kit_server/windows.py +225 -0
- rdp_kit_server-20261128.1.dist-info/METADATA +251 -0
- rdp_kit_server-20261128.1.dist-info/RECORD +16 -0
- rdp_kit_server-20261128.1.dist-info/WHEEL +4 -0
- rdp_kit_server-20261128.1.dist-info/entry_points.txt +2 -0
- rdp_kit_server-20261128.1.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# rdp-kit-server release notes
|
|
2
|
+
|
|
3
|
+
Each release tag (yyyymmdd.N) needs its own section here, `## <tag>`: release.yml publishes
|
|
4
|
+
only a tag that has one, and that section becomes the GitHub release.
|
|
5
|
+
|
|
6
|
+
## 20261128.1
|
|
7
|
+
|
|
8
|
+
The first release: share this computer's desktop over RDP in one command, on Windows, Linux and macOS.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
uvx rdp-kit-server install
|
|
12
|
+
uvx rdp-kit-server doctor
|
|
13
|
+
uvx rdp-kit-server uninstall
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- Carries the FreeRDP shadow server 20261128.6 from rdp-release-kit 20261128.4, one wheel per platform:
|
|
17
|
+
Windows x64 and arm64, Linux x86_64 and aarch64, macOS arm64.
|
|
18
|
+
- **install** sets the server up the way each system expects: a Windows service, a systemd unit on Linux
|
|
19
|
+
(the session manager on GNOME, your own desktop elsewhere; `--mode` chooses), a LaunchDaemon and its agent
|
|
20
|
+
on macOS. It asks for administrator rights once and says why, and keeps a record of what it added.
|
|
21
|
+
- **uninstall** removes exactly what that record lists.
|
|
22
|
+
- **doctor** checks it, read-only, one line per check with the fix.
|
|
23
|
+
- The server listens on 127.0.0.1:3388 only; clients come in over SSH (`ssh -L 13388:127.0.0.1:3388 ...`) and
|
|
24
|
+
open 127.0.0.1:13388, for example in `uvx freerdp-tk`.
|
|
25
|
+
- Tested on every platform in CI: install, doctor, a login with the kit's own client, an update, uninstall, and
|
|
26
|
+
nothing left behind.
|
|
27
|
+
|
|
28
|
+
Known: on macOS allow FreeRDP Shadow once in Screen & System Audio Recording and Accessibility (this build is
|
|
29
|
+
not signed with a Developer ID yet, so each update asks again), and uninstall leaves one "allowed" line in
|
|
30
|
+
launchd's own list that starts nothing.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""rdp-kit-server: install, check and remove rdp-release-kit's FreeRDP shadow server."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
__version__ = version("rdp-kit-server")
|
|
7
|
+
except PackageNotFoundError: # a source checkout
|
|
8
|
+
__version__ = "0.0.0"
|
|
9
|
+
|
|
10
|
+
# The kit's shadow port on every OS: 3389 stays free for the system's own RDP servers.
|
|
11
|
+
DEFAULT_PORT = 3388
|
|
12
|
+
|
|
13
|
+
# The client the connect hint names: freerdp-tk until its rename to rdp-kit-client ships (B4b);
|
|
14
|
+
# then this and the README change together (tests/test_record_and_cli.py guards that).
|
|
15
|
+
CLIENT_HINT = "uvx freerdp-tk"
|
rdp_kit_server/bundle.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""The server this wheel carries (scripts/bundle_server.py put it in server/)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
# RDP_KIT_SERVER_BUNDLE: an unpacked kit host archive to use instead (tests, development)
|
|
11
|
+
SERVER = Path(os.environ.get("RDP_KIT_SERVER_BUNDLE") or Path(__file__).parent / "server")
|
|
12
|
+
VERSION = re.compile(r"\b(\d{8}\.\d+)\b")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class Server:
|
|
17
|
+
path: Path
|
|
18
|
+
version: str # FreeRDP's, from MANIFEST's first line: 20261128.2
|
|
19
|
+
kit_release: str # the kit release that shipped it: 20261128.1
|
|
20
|
+
archive: str # the kit's file name
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def manifest_version(folder: Path) -> str | None:
|
|
24
|
+
"""The server version in MANIFEST's first line, None without one."""
|
|
25
|
+
try:
|
|
26
|
+
first = (folder / "MANIFEST").read_text(encoding="utf-8", errors="replace").splitlines()[0]
|
|
27
|
+
except (OSError, IndexError):
|
|
28
|
+
return None
|
|
29
|
+
match = VERSION.search(first)
|
|
30
|
+
return match[1] if match else None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _read(path: Path) -> str:
|
|
34
|
+
try:
|
|
35
|
+
return path.read_text(encoding="utf-8").strip()
|
|
36
|
+
except OSError:
|
|
37
|
+
return ""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def bundled() -> Server | None:
|
|
41
|
+
"""The bundled server, None when this is the plain wheel (no server for this platform)."""
|
|
42
|
+
version = manifest_version(SERVER)
|
|
43
|
+
if not version:
|
|
44
|
+
return None
|
|
45
|
+
return Server(SERVER, version, _read(SERVER / "KIT_RELEASE") or "?", _read(SERVER / "ARCHIVE"))
|
rdp_kit_server/checks.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""A doctor line: what was checked, how it is, and what to do about it."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
OK, FIX, INFO, OFF = "ok", "fix", "info", "off"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class Check:
|
|
12
|
+
id: str # stable, for --json and the tests: installed, running, port...
|
|
13
|
+
status: str # OK | FIX | INFO | OFF (not installed, not applicable)
|
|
14
|
+
text: str
|
|
15
|
+
fix: str = ""
|
rdp_kit_server/cli.py
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"""rdp-kit-server install | uninstall | doctor."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import getpass
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
import platform
|
|
10
|
+
import shutil
|
|
11
|
+
import sys
|
|
12
|
+
from dataclasses import asdict
|
|
13
|
+
|
|
14
|
+
from rdp_kit_server import DEFAULT_PORT, __version__, bundle
|
|
15
|
+
from rdp_kit_server import record as rec
|
|
16
|
+
from rdp_kit_server.checks import FIX, INFO, OFF, OK, Check
|
|
17
|
+
from rdp_kit_server.util import Stop, is_admin, listens, run_as_admin, say
|
|
18
|
+
|
|
19
|
+
KIT_PLATFORMS = ("Windows x64 and arm64, Linux x86_64 and aarch64 (glibc 2.34 or newer), "
|
|
20
|
+
"macOS on Apple Silicon (13 or newer)")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def plat():
|
|
24
|
+
if sys.platform == "win32":
|
|
25
|
+
from rdp_kit_server import windows as p
|
|
26
|
+
elif sys.platform == "darwin":
|
|
27
|
+
from rdp_kit_server import macos as p
|
|
28
|
+
elif sys.platform.startswith("linux"):
|
|
29
|
+
from rdp_kit_server import linux as p
|
|
30
|
+
else:
|
|
31
|
+
raise Stop(f"no server for {sys.platform}: the kit builds it for {KIT_PLATFORMS}")
|
|
32
|
+
return p
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def pick_mode(asked: str | None) -> tuple[str, bool, str]:
|
|
36
|
+
"""(mode, headless, why): Windows and macOS have one way; Linux picks by the desktop
|
|
37
|
+
(the PO's decision, 2026-11-28: beginners never choose), --mode overrides."""
|
|
38
|
+
if sys.platform == "win32":
|
|
39
|
+
return "service", False, ""
|
|
40
|
+
if sys.platform == "darwin":
|
|
41
|
+
return "daemon", False, ""
|
|
42
|
+
if asked == "headless":
|
|
43
|
+
return "sesman", True, "mode: session manager, with a headless GNOME of your own (--mode headless)"
|
|
44
|
+
if asked == "sesman":
|
|
45
|
+
return "sesman", False, "mode: session manager (--mode sesman)"
|
|
46
|
+
if asked == "user-unit":
|
|
47
|
+
return "user-unit", False, "mode: your own desktop (--mode user-unit)"
|
|
48
|
+
desktop = _desktop()
|
|
49
|
+
if "GNOME" in desktop.upper() or (not desktop and shutil.which("gnome-shell")):
|
|
50
|
+
return "sesman", False, "mode: session manager (GNOME sessions, also before anyone logs in)"
|
|
51
|
+
if desktop:
|
|
52
|
+
return "user-unit", False, (f"mode: your own desktop (this desktop is {desktop}; "
|
|
53
|
+
"the session manager serves GNOME only)")
|
|
54
|
+
return "user-unit", False, ("mode: your own desktop (no desktop session here now and no GNOME: "
|
|
55
|
+
"it starts with your desktop)")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def need_server() -> bundle.Server:
|
|
59
|
+
server = bundle.bundled()
|
|
60
|
+
if not server:
|
|
61
|
+
raise Stop(f"this rdp-kit-server carries no server for {platform.system()} "
|
|
62
|
+
f"{platform.machine()}: the kit builds it for {KIT_PLATFORMS}")
|
|
63
|
+
return server
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# --- install -----------------------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def cmd_install(args) -> int:
|
|
70
|
+
p = plat()
|
|
71
|
+
server = need_server()
|
|
72
|
+
if args.port == 3389 or not 1 <= args.port <= 65535:
|
|
73
|
+
raise Stop("--port: 3389 stays free for the system's own RDP servers; choose another (3388 is the kit's)")
|
|
74
|
+
if args.mode and sys.platform != "linux":
|
|
75
|
+
raise Stop("--mode is for Linux")
|
|
76
|
+
mode, headless, why = pick_mode(args.mode)
|
|
77
|
+
headless_user = getpass.getuser() if headless else None
|
|
78
|
+
say(f"rdp-kit-server {__version__}: the FreeRDP shadow server {server.version} "
|
|
79
|
+
f"(rdp-release-kit {server.kit_release})")
|
|
80
|
+
if why:
|
|
81
|
+
say(why)
|
|
82
|
+
inner = ["_do", "install", "--mode", mode, "--port", str(args.port), "--bundle", str(server.path),
|
|
83
|
+
"--for-user", getpass.getuser()]
|
|
84
|
+
if headless_user:
|
|
85
|
+
inner += ["--headless-user", headless_user]
|
|
86
|
+
if p.needs_admin(mode) and not is_admin():
|
|
87
|
+
code = run_as_admin(inner, p.why_admin(mode, args.port, headless_user))
|
|
88
|
+
else:
|
|
89
|
+
code = _do(_inner_parser().parse_args(inner[1:]))
|
|
90
|
+
if code != 0:
|
|
91
|
+
return code
|
|
92
|
+
record = rec.load(p.record_dir(mode))
|
|
93
|
+
say()
|
|
94
|
+
say(f"Installed: the FreeRDP shadow server {server.version} ({mode}), listening on 127.0.0.1:{args.port}.")
|
|
95
|
+
if record:
|
|
96
|
+
for line in p.connect_lines(record):
|
|
97
|
+
say(line)
|
|
98
|
+
say("Check it any time: rdp-kit-server doctor")
|
|
99
|
+
return 0
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _desktop() -> str:
|
|
103
|
+
return os.environ.get("XDG_CURRENT_DESKTOP", "")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# --- uninstall ---------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def cmd_uninstall(args) -> int:
|
|
110
|
+
p = plat()
|
|
111
|
+
records = rec.find()
|
|
112
|
+
if not records:
|
|
113
|
+
say("rdp-kit-server installed nothing here: nothing to remove.")
|
|
114
|
+
return 0
|
|
115
|
+
worst = 0
|
|
116
|
+
for record in records:
|
|
117
|
+
system = record.path and record.path.parent == rec.system_dir()
|
|
118
|
+
inner = ["_do", "uninstall", "--mode", record.mode]
|
|
119
|
+
if args.end_sessions:
|
|
120
|
+
inner.append("--end-sessions")
|
|
121
|
+
if p.needs_admin(record.mode) and system and not is_admin():
|
|
122
|
+
why = [f"remove what its install put here ({record.mode}): "
|
|
123
|
+
+ ", ".join(_item_text(i) for i in record.items)]
|
|
124
|
+
code = run_as_admin(inner, why)
|
|
125
|
+
else:
|
|
126
|
+
code = _do(_inner_parser().parse_args(inner[1:]))
|
|
127
|
+
worst = max(worst, code)
|
|
128
|
+
return worst
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _item_text(item: dict) -> str:
|
|
132
|
+
if item["kind"] == "member":
|
|
133
|
+
return f"{item['user']} in the group {item['group']}"
|
|
134
|
+
if item["kind"] == "group":
|
|
135
|
+
return f"the group {item['name']}"
|
|
136
|
+
if item["kind"] == "emptydir":
|
|
137
|
+
return f"{item['path']} (if empty)"
|
|
138
|
+
return item.get("path") or item.get("name") or item.get("app") or item["kind"]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# --- the part that runs with the rights ----------------------------------------------------
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _do(args) -> int:
|
|
145
|
+
if args.log_to: # Windows' elevated process: its output goes back through this file
|
|
146
|
+
out = open(args.log_to, "a", encoding="utf-8", buffering=1) # noqa: SIM115
|
|
147
|
+
sys.stdout = sys.stderr = out
|
|
148
|
+
if args.bundle:
|
|
149
|
+
from pathlib import Path
|
|
150
|
+
bundle.SERVER = Path(args.bundle)
|
|
151
|
+
p = plat()
|
|
152
|
+
try:
|
|
153
|
+
if args.action == "install":
|
|
154
|
+
server = need_server()
|
|
155
|
+
p.install(args.mode, args.port, server, args.headless_user, args.for_user)
|
|
156
|
+
return 0
|
|
157
|
+
record = rec.load(p.record_dir(args.mode))
|
|
158
|
+
if not record:
|
|
159
|
+
say("rdp-kit-server installed nothing here: nothing to remove.")
|
|
160
|
+
return 0
|
|
161
|
+
failed = []
|
|
162
|
+
for item in reversed(record.items):
|
|
163
|
+
try:
|
|
164
|
+
p.undo(item, record, args.end_sessions)
|
|
165
|
+
except Exception as e: # one item that fails keeps its place in the record
|
|
166
|
+
failed.append(item)
|
|
167
|
+
say(f" could not undo {_item_text(item)}: {e}")
|
|
168
|
+
if failed:
|
|
169
|
+
record.items = [i for i in record.items if i in failed]
|
|
170
|
+
record.save()
|
|
171
|
+
say(f"rdp-kit-server: {len(failed)} of its items are still here; its record "
|
|
172
|
+
f"{record.path} keeps them: run rdp-kit-server uninstall again")
|
|
173
|
+
return 1
|
|
174
|
+
rec.remove(record)
|
|
175
|
+
say(f"Removed: everything rdp-kit-server installed ({record.mode}).")
|
|
176
|
+
return 0
|
|
177
|
+
except Stop as e:
|
|
178
|
+
say(f"rdp-kit-server: {e}")
|
|
179
|
+
if args.action == "install":
|
|
180
|
+
left = rec.load(p.record_dir(args.mode))
|
|
181
|
+
if left and left.items:
|
|
182
|
+
say("What it did put here is in its record: rdp-kit-server uninstall removes it.")
|
|
183
|
+
elif left:
|
|
184
|
+
rec.remove(left)
|
|
185
|
+
return 2
|
|
186
|
+
finally:
|
|
187
|
+
if args.log_to:
|
|
188
|
+
sys.stdout.flush()
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def _inner_parser() -> argparse.ArgumentParser:
|
|
192
|
+
inner = argparse.ArgumentParser(prog="rdp-kit-server _do")
|
|
193
|
+
inner.add_argument("action", choices=["install", "uninstall"])
|
|
194
|
+
inner.add_argument("--mode", required=True)
|
|
195
|
+
inner.add_argument("--port", type=int, default=DEFAULT_PORT)
|
|
196
|
+
inner.add_argument("--bundle")
|
|
197
|
+
inner.add_argument("--headless-user")
|
|
198
|
+
inner.add_argument("--for-user")
|
|
199
|
+
inner.add_argument("--end-sessions", action="store_true")
|
|
200
|
+
inner.add_argument("--log-to")
|
|
201
|
+
return inner
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# --- doctor ------------------------------------------------------------------------------
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def doctor_checks() -> tuple[list[Check], bundle.Server | None]:
|
|
208
|
+
p = plat()
|
|
209
|
+
server = bundle.bundled()
|
|
210
|
+
records = rec.find()
|
|
211
|
+
checks: list[Check] = []
|
|
212
|
+
if not records:
|
|
213
|
+
checks.append(Check("installed", OFF, "not installed", "rdp-kit-server install"))
|
|
214
|
+
return checks, server
|
|
215
|
+
for record in records:
|
|
216
|
+
checks.append(Check("installed", OK, f"installed ({record.mode}): server {record.server_version} "
|
|
217
|
+
f"from kit {record.kit_release}, by rdp-kit-server {record.tool_version}, "
|
|
218
|
+
f"{record.installed}"))
|
|
219
|
+
if listens(record.port):
|
|
220
|
+
checks.append(Check("port", OK, f"listening on 127.0.0.1:{record.port}"))
|
|
221
|
+
else:
|
|
222
|
+
checks.append(Check("port", FIX, f"nothing listens on 127.0.0.1:{record.port}",
|
|
223
|
+
"see the line on it running"))
|
|
224
|
+
checks.extend(p.doctor(record, server))
|
|
225
|
+
checks.append(Check("firewall", OK, "firewall: nothing to open (the server listens on 127.0.0.1 "
|
|
226
|
+
"only; clients come in over SSH)"))
|
|
227
|
+
return checks, server
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
MARK = {OK: "ok ", FIX: "FIX ", INFO: "info", OFF: "-- "}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def cmd_doctor(args) -> int:
|
|
234
|
+
checks, server = doctor_checks()
|
|
235
|
+
installed = not any(c.id == "installed" and c.status == OFF for c in checks)
|
|
236
|
+
code = 2 if not installed else (1 if any(c.status == FIX for c in checks) else 0)
|
|
237
|
+
if args.json:
|
|
238
|
+
print(json.dumps({"tool": __version__,
|
|
239
|
+
"bundled": asdict(server) | {"path": str(server.path)} if server else None,
|
|
240
|
+
"installed": installed, "checks": [asdict(c) for c in checks]},
|
|
241
|
+
indent=2, ensure_ascii=False))
|
|
242
|
+
return code
|
|
243
|
+
carries = (f"carries the server {server.version} (kit {server.kit_release})" if server
|
|
244
|
+
else "carries no server for this platform")
|
|
245
|
+
say(f"rdp-kit-server {__version__} doctor ({carries}); read-only, no administrator rights")
|
|
246
|
+
for c in checks:
|
|
247
|
+
say(f" {MARK[c.status]} {c.text}")
|
|
248
|
+
if c.fix and c.status != OK:
|
|
249
|
+
say(f" -> {c.fix}")
|
|
250
|
+
return code
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# --- main --------------------------------------------------------------------------------
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def parser() -> argparse.ArgumentParser:
|
|
257
|
+
top = argparse.ArgumentParser(
|
|
258
|
+
prog="rdp-kit-server",
|
|
259
|
+
description="Install, check and remove rdp-release-kit's FreeRDP shadow server: "
|
|
260
|
+
"this computer's own screen over RDP, on 127.0.0.1:3388.")
|
|
261
|
+
top.add_argument("--version", action="version", version=f"rdp-kit-server {__version__}")
|
|
262
|
+
sub = top.add_subparsers(dest="command", required=True)
|
|
263
|
+
i = sub.add_parser("install", help="install the server the platform's way (asks for admin rights once)")
|
|
264
|
+
i.add_argument("--port", type=int, default=DEFAULT_PORT, help="its port on 127.0.0.1 (3388)")
|
|
265
|
+
i.add_argument("--mode", choices=["sesman", "user-unit", "headless"],
|
|
266
|
+
help="Linux only; install picks it by your desktop: sesman (the session manager: GNOME, "
|
|
267
|
+
"every user), user-unit (your own desktop session, no root: any X11 desktop or "
|
|
268
|
+
"GNOME), headless (the session manager, and you get a headless GNOME)")
|
|
269
|
+
i.set_defaults(run=cmd_install)
|
|
270
|
+
u = sub.add_parser("uninstall", help="remove exactly what install put here")
|
|
271
|
+
u.add_argument("--end-sessions", action="store_true",
|
|
272
|
+
help="Linux session manager: also end the headless GNOME sessions it started")
|
|
273
|
+
u.set_defaults(run=cmd_uninstall)
|
|
274
|
+
d = sub.add_parser("doctor", help="check it, read-only, with a fix for each problem")
|
|
275
|
+
d.add_argument("--json", action="store_true")
|
|
276
|
+
d.set_defaults(run=cmd_doctor)
|
|
277
|
+
return top
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def main(argv: list[str] | None = None) -> int:
|
|
281
|
+
for stream in (sys.stdout, sys.stderr):
|
|
282
|
+
try:
|
|
283
|
+
stream.reconfigure(errors="replace")
|
|
284
|
+
except (AttributeError, ValueError):
|
|
285
|
+
pass
|
|
286
|
+
argv = sys.argv[1:] if argv is None else argv
|
|
287
|
+
try:
|
|
288
|
+
if argv[:1] == ["_do"]:
|
|
289
|
+
return _do(_inner_parser().parse_args(argv[1:]))
|
|
290
|
+
args = parser().parse_args(argv)
|
|
291
|
+
return args.run(args)
|
|
292
|
+
except Stop as e:
|
|
293
|
+
say(f"rdp-kit-server: {e}")
|
|
294
|
+
return 2
|
|
295
|
+
except KeyboardInterrupt:
|
|
296
|
+
return 130
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
if __name__ == "__main__":
|
|
300
|
+
sys.exit(main())
|