I'm running a python script that prints out commands on the terminal (kali linux) to ultimately disconnect my own device from my wifi after x amount of minutes/seconds etc. I can get the commands part down but an issue I'm having is stopping the commands that are running and you have to press a hotkey or a certain keyboard shortcut to exit the search or whatever. I tried keyboard.press()
with from pynput.keyboard import Key
but that doesn't work. Is there any way to halt the ongoing command so that the code can execute the rest of the remaining code? I'll just post what I have:
import subprocess
import time
from pynput.keyboard import Key
command1= "ifconfig"
command3 = "airodump-ng wlan0"
time.sleep(10)
subprocess.call(command1, shell=True)
subprocess.call(command3, shell=True)
keyboard.press(Key.ctrl)
keyboard.press('c')