aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/apis/netcup/ssh.py
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/apis/netcup/ssh.py
parentCleaner number move (#320) (diff)
Add helper function to RCE on the netcup server
Diffstat (limited to 'arthur/apis/netcup/ssh.py')
-rw-r--r--arthur/apis/netcup/ssh.py13
1 files changed, 13 insertions, 0 deletions
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