Untitled
unknown
python
2 years ago
1.6 kB
13
Indexable
import random
import time
import threading
import pyautogui
def parse_duration(duration_str):
unit = duration_str[-1].lower()
duration = int(duration_str[:-1])
if unit == 'h':
return duration * 60 * 60
elif unit == 'm':
return duration * 60
elif unit == 's':
return duration
else:
return duration * 60 # Default to hours
def alt_tab():
while running:
time.sleep(random.randint(30, 75))
pyautogui.hotkey('alt', 'tab')
def move_mouse():
while running:
time.sleep(random.randint(30, 60))
pyautogui.moveTo(random.randint(0, 1920), random.randint(0, 1080))
def kill_switch():
global running
while running:
if pyautogui.keyDown('esc'): # Replace 'esc' with your desired kill switch key
running = False
break
time.sleep(0.1)
def main():
if len(sys.argv) != 2:
print("Usage: python script.py <duration>")
return
duration = parse_duration(sys.argv[1])
global running
running = True
# Create and start threads
alt_tab_thread = threading.Thread(target=alt_tab)
mouse_move_thread = threading.Thread(target=move_mouse)
kill_switch_thread = threading.Thread(target=kill_switch)
alt_tab_thread.start()
mouse_move_thread.start()
kill_switch_thread.start()
# Wait for the duration to elapse (main thread sleeps)
time.sleep(duration)
# Stop the threads (optional)
running = False
alt_tab_thread.join()
mouse_move_thread.join()
kill_switch_thread.join()
if __name__ == "__main__":
import sys
main()
Editor is loading...
Leave a Comment