import time import usb_hid import board import digitalio import random from adafruit_hid.mouse import Mouse from adafruit_hid.keyboard import Keyboard from adafruit_hid.keycode import Keycode from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS citations = ("Carpe diem","Veni, vidi, vici","Tempus fugit","Alea iacta est","Dum spiro, spero","Non ducor, duco","Amor vincit omnia","Per aspera ad astra","In vino veritas","Dum vita est, spes est","O tempora, o mores!","Cogito, ergo sum","Si vis pacem, para bellum","Alea jacta est","De gustibus non est disputandum","E pluribus unum","Audaces fortuna iuvat","Memento mori","Nunc est bibendum","Salus populi suprema lex esto") mouse = Mouse(usb_hid.devices) kbd = Keyboard(usb_hid.devices) layout = KeyboardLayoutUS(kbd) led = digitalio.DigitalInOut(board.GP25) led.direction = digitalio.Direction.OUTPUT # Démarrer le chronomètre led.value = False time.sleep(10) # # # Liste pour enregistrer les temps intermédiaires (laps) # laps = [] # # # Fonction pour démarrer le chronomètre # def start_chronometre(): # laps.clear() # Effacer les laps précédents # laps.append(time.time()) # Enregistrer le temps de départ # return laps[0] # # # Fonction pour enregistrer un temps intermédiaire (lap) # def lap_chronometre(): # laps.append(time.time()) # temps_ecoule_s = laps[-1] - laps[-2] # return temps_ecoule_s # # # Fonction pour arrêter le chronomètre et afficher le temps total # def stop_chronometre(debut_chrono): # laps.append(time.time()) # Enregistrer le temps de fin # temps_ecoule_s = laps[-1] - debut_chrono # return temps_ecoule_s # # # Fonction pour calculer le temps total # def calculer_temps_total(): # return laps[-1] - laps[0] # # # Fonction pour afficher le temps formaté (minutes:secondes) # def format_temps(temps_s): # minutes = int(temps_s / 60) # secondes = int(temps_s % 60) # return f"{minutes:02}:{secondes:02}" # def start_software(soft): kbd.send(Keycode.GUI) time.sleep(random.randint(1,3)*0.40) if soft == "notepad": layout.write('execute\n') time.sleep(1) layout.write('notepad\n') elif soft == "word": layout.write('Microsoft Word') time.sleep(2) layout.write('\n') time.sleep(2) layout.write('\n') elif soft == "outlook": layout.write('Microsoft Outlook\n') time.sleep(1) layout.write('\n') elif soft == "excel": layout.write('Microsoft Excel') time.sleep(2) layout.write('\n') time.sleep(2) layout.write('\n') time.sleep(1) return def activite_citations(): start_software("notepad") time.sleep(1) phrase = citations[random.randint(0, 19)] for caractere in phrase: layout.write(caractere) led.value = True time.sleep(random.randint(0,5)*0.1) led.value = False time.sleep(3) kbd.press(Keycode.ALT) time.sleep(.09) kbd.send(Keycode.F4) kbd.release_all() time.sleep(1) kbd.send(Keycode.R) #lap_chronometre() return def print_float(param): str1 = str(param) for caractere in str1: if caractere == ".": layout.write(",") else: layout.write(caractere) return def activite_word(): start_software("word") with open("./textecon.txt", 'r') as fichier: lignes = fichier.readlines() for ligne in lignes: for caractere in ligne: if caractere == " ": time.sleep(random.randint(1,3)*0.05) if caractere == "\r": layout.write("\n") time.sleep(random.randint(1,10)) else: layout.write(caractere) time.sleep(random.randint(1,2)*0.02) time.sleep(3) kbd.press(Keycode.ALT) time.sleep(.09) kbd.send(Keycode.F4) kbd.release_all() time.sleep(1) kbd.press(Keycode.ALT) time.sleep(.09) kbd.send(Keycode.N) kbd.release_all() #lap_chronometre() return def activite_outlook(): start_software("outlook") lap_chronometre() return def activite_excel(): sigma = 10.0 rho = 28.0 beta = 8.0 / 3.0 dt = 0.01 nb_iterations = 400 x, y = 0.1, 0.0 # Conditions initiales x_points = [] y_points = [] for _ in range(nb_iterations): x_points.append(x) y_points.append(y) dx = sigma * (y - x) * dt dy = (x * (rho - 1) - y) * dt x += dx y += dy start_software("excel") layout.write("Sigma") kbd.send(Keycode.RIGHT_ARROW) print_float(sigma) kbd.send(Keycode.DOWN_ARROW) kbd.send(Keycode.LEFT_ARROW) layout.write("Rho") kbd.send(Keycode.RIGHT_ARROW) print_float(rho) kbd.send(Keycode.DOWN_ARROW) kbd.send(Keycode.LEFT_ARROW) layout.write("beta") kbd.send(Keycode.RIGHT_ARROW) print_float(beta) kbd.send(Keycode.DOWN_ARROW) kbd.send(Keycode.LEFT_ARROW) layout.write("dt") kbd.send(Keycode.RIGHT_ARROW) print_float(dt) kbd.send(Keycode.DOWN_ARROW) kbd.send(Keycode.LEFT_ARROW) layout.write("Iterations") kbd.send(Keycode.RIGHT_ARROW) print_float(nb_iterations) kbd.send(Keycode.DOWN_ARROW) kbd.send(Keycode.LEFT_ARROW) kbd.send(Keycode.DOWN_ARROW) kbd.send(Keycode.DOWN_ARROW) for x, y in zip(x_points, y_points): print_float(nb_iterations) time.sleep(random.randint(1,2)*0.01) kbd.send(Keycode.RIGHT_ARROW) print_float(x) time.sleep(random.randint(1,2)*0.01) kbd.send(Keycode.RIGHT_ARROW) print_float(y) time.sleep(random.randint(1,2)*0.01) kbd.send(Keycode.DOWN_ARROW) kbd.send(Keycode.LEFT_ARROW) kbd.send(Keycode.LEFT_ARROW) time.sleep(3) kbd.press(Keycode.ALT) time.sleep(.09) kbd.send(Keycode.F4) kbd.release_all() time.sleep(1) kbd.press(Keycode.ALT) time.sleep(.09) kbd.send(Keycode.N) kbd.release_all() lap_chronometre() return def wanking_human(): #temps_ecoule = stop_chronometre(debut_chrono) while True: #temps_ecoule = stop_chronometre(debut_chrono) act = random.randint(1,3) if act == 1: activite_citations() elif act == 2: activite_word() elif act == 3: activite_excel() #Pause 1 #temps_ecoule = stop_chronometre(debut_chrono) # if temps_ecoule > 7200 and temps_ecoule < 7600: # time.sleep(random.randint(60*10,60*15)) # #lap_chronometre() # #Déjeuner # if temps_ecoule > 14400 and temps_ecoule < 15000: # time.sleep(random.randint(60*55,60*62)) # #lap_chronometre() # #Pause 1 # temps_ecoule = stop_chronometre(debut_chrono) # if temps_ecoule > 7200 and temps_ecoule < 7600: # time.sleep(random.randint(60*10,60*15)) #lap_chronometre() #temps_formate = format_temps(temps_ecoule) #print("Temps écoulé:", temps_formate) return wanking_human() # # # Calculer le temps total et l'afficher # temps_total = calculer_temps_total() # temps_total_formate = format_temps(temps_total) # print("Temps total:", temps_total_formate) #