import os import time def enable_lag(): os.system("iptables -A INPUT -s 0/0 -j DROP") os.system("iptables -A OUTPUT -d 0/0 -j DROP") def disable_lag(): os.system("iptables -D INPUT -s 0/0 -j DROP") os.system("iptables -D OUTPUT -d 0/0 -j DROP") try: while True: user_input = input("Press 'l' to lag, 'u' to unlag, 'q' to quit: ").lower() if user_input == 'l': enable_lag() print("Lag enabled") elif user_input == 'u': disable_lag() print("Lag disabled") elif user_input == 'q': break else: print("Invalid input") except KeyboardInterrupt: disable_lag() print("\nLag disabled due to keyboard interrupt")