59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
import subprocess
|
|
import time
|
|
flags = subprocess.CREATE_NO_WINDOW
|
|
|
|
def cut_wifi(seconds):
|
|
print("Cutting WiFi for " + str(seconds) + " seconds...", end = " ")
|
|
start_time = time.time()
|
|
end_time = start_time + seconds
|
|
while time.time() < end_time:
|
|
subprocess.run(
|
|
"netsh wlan disconnect interface=\"Wi-Fi\"",
|
|
check=True,
|
|
creationflags=flags
|
|
)
|
|
print("Cut duration ended. Success.")
|
|
print("Reconnecting WiFi...", end = " ")
|
|
subprocess.run(
|
|
"netsh wlan connect ssid=\"NHRHS_WiFi\" name=\"NHRHS_WiFi\"", # Switch to your WiFi name
|
|
check=True,
|
|
creationflags=flags
|
|
)
|
|
print("Success.\n")
|
|
|
|
def main():
|
|
while True:
|
|
print("=" * 80)
|
|
print("TiFiCut WDS (WiFi Disconnection System) A-1")
|
|
print("-" * 80)
|
|
print("Choose a duration to cut wifi:")
|
|
print("[1] 5 seconds")
|
|
print("[2] 10 seconds")
|
|
print("[3] 30 seconds")
|
|
print("[4] 1 minute")
|
|
print("[5] 2 minutes")
|
|
print("[6] 5 minutes")
|
|
print("[7] Specify amount of seconds")
|
|
second_choice = input("Duration > ")
|
|
|
|
if second_choice == "1":
|
|
cut_wifi(5)
|
|
elif second_choice == "2":
|
|
cut_wifi(10)
|
|
elif second_choice == "3":
|
|
cut_wifi(30)
|
|
elif second_choice == "4":
|
|
cut_wifi(60)
|
|
elif second_choice == "5":
|
|
cut_wifi(120)
|
|
elif second_choice == "6":
|
|
cut_wifi(300)
|
|
elif second_choice == "7":
|
|
second_choice = input("Specify amount of seconds > ")
|
|
cut_wifi(int(second_choice))
|
|
else:
|
|
print("Invalid Choice.")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|