aboutsummaryrefslogtreecommitdiffstats
path: root/arthur
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2025-04-15 22:36:11 +0100
committerGravatar Chris Lovering <[email protected]>2025-04-15 22:39:36 +0100
commit368246d2626e0f1f47f84a64ab3203f090609b4a (patch)
treead7a8511738cd831f52af4fe20d2689dfd1111e4 /arthur
parentCleaner number move (#320) (diff)
Add helper function to RCE on the netcup server
Diffstat (limited to 'arthur')
-rw-r--r--arthur/apis/netcup/__init__.py0
-rw-r--r--arthur/apis/netcup/ssh.py13
-rw-r--r--arthur/config.py4
3 files changed, 17 insertions, 0 deletions
diff --git a/arthur/apis/netcup/__init__.py b/arthur/apis/netcup/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/arthur/apis/netcup/__init__.py
diff --git a/arthur/apis/netcup/ssh.py b/arthur/apis/netcup/ssh.py
new file mode 100644
index 0000000..6245f8f
--- /dev/null
+++ b/arthur/apis/netcup/ssh.py
@@ -0,0 +1,13 @@
+import asyncssh
+
+from arthur.config import CONFIG
+
+
+async def rce_as_a_service(command: str) -> asyncssh.SSHCompletedProcess:
+ """Run the given command on the configured server."""
+ async with asyncssh.connect(
+ username=CONFIG.ssh_username,
+ host=CONFIG.ssh_host,
+ ) as conn:
+ result = await conn.run(command)
+ return result
diff --git a/arthur/config.py b/arthur/config.py
index b47a77e..0edf30e 100644
--- a/arthur/config.py
+++ b/arthur/config.py
@@ -32,6 +32,10 @@ class Config(
sentry_dsn: str = ""
numbers_url: str = "https://pydis.wtf/numbers"
+ # RCE as a service
+ ssh_username: str = "kingarthur"
+ ssh_host: str = "lovelace.box.pydis.wtf"
+
# LDAP & Directory
#
# FreeIPA accesses are generated off this information