예제 #1
0
 def __init__(self):
     global main_client
     print("server has started")
     user32 = ctypes.windll.user32
     user32.SetProcessDPIAware()
     self.WIDTH = user32.GetSystemMetrics(0)
     self.HEIGHT = user32.GetSystemMetrics(1)
     self.max_bytes = max_bytes
     self.mouse = MouseController()
     self.keyboard = KeyboardController()
     self.client_ip = "0.0.0.0"
     self.port = secondary_port
     self.control = True
     self.stop_running = False
     self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     self.client_socket.bind((self.client_ip, self.port))
     data, self.address = self.client_socket.recvfrom(self.max_bytes)
     if data.decode() == "close_connection":
         self.client_socket.close()
         print("server closed")
         return
     main_client.stop_waitingpage()
     main_client.close_main_page()
     main_client.add_conn(data.decode())
     self.client_socket.sendto(main_client.name.encode(), self.address)
     thread = threading.Thread(target=self.send_screen)
     control_thread = threading.Thread(target=self.main_control)
     stop_thread = threading.Thread(target=self.stop)
     thread.start()
     control_thread.start()
     stop_thread.start()
예제 #2
0
def stopTurretActivity():
    print("Stopping miner activity")
    keyboard = KeyboardController()
    keyboard.press(Key.f1)
    time.sleep(0.3)
    keyboard.release(Key.f1)
    time.sleep(0.5)
    keyboard.press(Key.f2)
    time.sleep(0.3)
    keyboard.release(Key.f2)
    time.sleep(0.5)
    keyboard.press(Key.f3)
    time.sleep(0.3)
    keyboard.release(Key.f3)
    time.sleep(0.5)
    keyboard.press(Key.f4)
    time.sleep(0.3)
    keyboard.release(Key.f4)
    time.sleep(0.5)
    keyboard.press(Key.f5)
    time.sleep(0.3)
    keyboard.release(Key.f5)
    time.sleep(0.5)
    keyboard.press(Key.f6)
    time.sleep(0.3)
    keyboard.release(Key.f6)
    time.sleep(0.5)
    keyboard.press(Key.f7)
    time.sleep(0.3)
    keyboard.release(Key.f7)
    time.sleep(0.5)
    keyboard.press(Key.f8)
    time.sleep(0.3)
    keyboard.release(Key.f8)
    time.sleep(0.5)
예제 #3
0
 def __init__(self, client_ip):
     global main_client
     print("connecting to server")
     user32 = ctypes.windll.user32
     user32.SetProcessDPIAware()
     self.width = -1
     self.height = -1
     self.SetCursorPos = ctypes.windll.user32.SetCursorPos
     self.mouse_event = ctypes.windll.user32.mouse_event
     self.WIDTH = user32.GetSystemMetrics(0)
     self.HEIGHT = user32.GetSystemMetrics(1)
     self.max_bytes = max_bytes
     self.client_ip = client_ip
     self.port = secondary_port
     self.control = True
     self.stop_all = False
     self.watching = True
     self.main_client = main_client
     self.mouse_listener = ""
     self.keyboard_listener = ""
     self.keyboard = KeyboardController()
     self.dont_send = False
     self.w_dont_send = False
     self.client_socket = socket.socket(family=socket.AF_INET,
                                        type=socket.SOCK_DGRAM)
     self.window_thread = threading.Thread(target=self.open_window)
     self.listeners_thread = threading.Thread(target=self.send_listeners)
     self.window_thread.start()
     self.listeners_thread.start()
예제 #4
0
    def __init__(self):
        # Collect events until released
        self.keyboard = KeyboardController()
        self.ori_x = 0
        self.ori_y = 0
        self.t1 = time.time()

        self.src = ''
        self.last_append = ''
        self.result = ''

        self.is_word = False
        self.config = Config(self)
        self.config.load()
        self.lang = LanguageManager(self.config['language'])
        self.taskbar = TaskBarIcon(self)
        self.mainFrame = MainFrame(self)
        self.subFrame = FocusFrame(self)
        self.writingFrame = WritingFrame(self)
        self.stored_source = self.source
        self.config.initialize()

        self.mainFrame.Centre()
        # self.mainFrame.Show()
        self.patterns = [
            re.compile(r'([?!.])[ ]?\n'),
            re.compile(r'([?!。])[ \n]')
        ]  # 前面一个处理英语语系的,后面一个可以处理汉语系。
        self.pattern2 = re.compile(r'\$([??!!.。])\$')

        UpdateThread(self).start()
예제 #5
0
def queryOnce(driver, driver2, p1, p2, p3, p4, p5, p6, p7):
    while True:
        try:
            #mouse object
            mouse = Controller()
            keyboard = KeyboardController()
            driver.get(
                'https://footprints12.uakron.edu/footprints/servicedesk/login.html'
            )

            login_Function(mouse, driver, p1, p2)
            ticketing(mouse, driver, p3, p4, p5)

            while True:
                #click the current ticket
                serial = ticket_auto(mouse, driver, p6)
                #get the date
                #amount of time to wait for the page to load (in seconds)
                timeout = 5
                date = warranty_search(timeout, keyboard, serial, driver2)
                #submit the information
                ticket_fill(date, driver, mouse, p7)
        except:
            pass
        else:
            break
예제 #6
0
def retrieveDrones():

    print("Retrieving drones to drone bay")
    keyboard = KeyboardController()
    with keyboard.pressed(Key.shift_l):
        keyboard.press('r')
        time.sleep(0.3)
        keyboard.release('r')
        time.sleep(10)
예제 #7
0
    def __init__(self):
        self._listener_keyboard = None
        self._listener_mouse = None

        self.ctl_keyboard = KeyboardController()
        self.ctl_mouse = None

        self.control_thread_mouse = Thread(target=click_left_button)
        self.control_thread_mouse.start()
예제 #8
0
def activateAutoPilot():

    print("Activating Auto-Pilot")
    keyboard = KeyboardController()

    with keyboard.pressed(Key.ctrl_l):
        keyboard.press('s')
        time.sleep(0.2)
        keyboard.release('s')
예제 #9
0
 def __init__(self,PixelConversion=1):
     """Init a MovementController instance.
     
     Keyword Arguments:
     PixelConversion -- 1 for PC, 2 for Retina Display
     """
     self.pixelConversion = PixelConversion
     self.keyboard = KeyboardController()
     self.mouse = MouseController()
예제 #10
0
    def __init__(self):
        self.replay_file = self.LOG_FILE_NAME
        self.keyboard = KeyboardController()
        self.mouse = MouseController()

        self.INPUT_LIST = [
            self.KEY_PRESS,
            self.KEY_RELEASE,
            self.MOUSE_CLICK,
            self.MOUSE_SCROLL,
        ]
예제 #11
0
def stopMinerActivity():
    print("Stopping miner activity")
    keyboard = KeyboardController()
    keyboard.press(Key.f1)
    time.sleep(0.3)
    keyboard.release(Key.f1)
    time.sleep(1)
    keyboard.press(Key.f2)
    time.sleep(0.3)
    keyboard.release(Key.f2)
    time.sleep(1)
예제 #12
0
def replayEdit(file_name):
    global APP
    screen_width = APP.winfo_screenwidth()
    screen_height = APP.winfo_screenheight()
    different_screen = False
    instruction_list = []
    df = pandas.read_csv(file_name)
    df = df[df['Mouse Drag'] != 'place']
    df_screen_width = df['X_loc'].iloc[0]
    df_screen_height = df['Y_loc'].iloc[0]
    df_screen_width = typeToInt(df_screen_width)
    df_screen_height = typeToInt(df_screen_height)
    width_ratio = float(screen_width) / float(df_screen_width)
    height_ratio = float(screen_height) / float(df_screen_height)
    if width_ratio != 1.0 or height_ratio != 1.0:
        different_screen = True
        print('Calculating different screen dimensions')
    instruction_list = df['INSTRUCTION'].to_list()
    mouse = Controller()
    keyboard = KeyboardController()
    for row in instruction_list[2:]:
        row = literal_eval(row)
        print(row)
        try:
            if different_screen == True:
                mouse.position = int(round(width_ratio * float(row[0]))), int(
                    round(height_ratio * float(row[1])))
            else:
                mouse.position = int(row[0]), int(row[1])
        except:
            pass
        if row[3] == 'True':
            try:
                print(eval(row[2]))
                mouse.press(eval(row[2]))
            except:
                print(row[2])
                keyboard.press(checkBut(row[2]))
        if row[3] == 'False':
            try:
                print(eval(row[2]))
                mouse.release(eval(row[2]))
            except:
                print(row[2])
                keyboard.release(checkBut(row[2]))
        try:
            dy = int(row[3])
            mouse.scroll(
                0, dy
            )  ##the scrolling part could be tested in an automated script. Get the scroll right until on a wikipedia page you get the same word copied and pasted twice
        except:
            pass

        time.sleep(row[-1])
예제 #13
0
def inp_handler(name):
    from pynput.keyboard import Key, Controller as KeyboardController

    keyboard = KeyboardController()
    time.sleep(0.1)
    choices = ['w', 'a', 's', 'd', 'j', 'k', Key.left, Key.right, Key.up, Key.down]
    NUM_TESTS = 50
    for x in range(NUM_TESTS):
        i = random.choice(choices) if x != NUM_TESTS - 1 else Key.esc
        keyboard.press(i)
        time.sleep(0.1)
        keyboard.release(i)
예제 #14
0
def keystroke_action(inject):
  keyboard = KeyboardController()
  mouse = MouseController()

  for command in inject:
    command = command.split(' ')
    c_type, c_data = command[0], command[1]

    if c_type == 'press': 
      try:
        c_data = eval(f'Key.{c_data}')
      except:
        pass
      finally:
        keyboard.press(c_data)
        keyboard.release(c_data)
    elif c_type == 'hold':
      try:
        c_data = eval(f'Key.{c_data}')
      except:
        pass
      finally:
        keyboard.press(c_data)
    elif c_type == 'release':
      try:
        c_data = eval(f'Key.{c_data}')
      except:
        pass
      finally:
        keyboard.release(c_data)
    elif c_type == 'type':
      keyboard.type(' '.join(command[1:]))
    elif c_type == 'position':
      mouse.position = [int(position) for position in c_data.split(',')]
    elif c_type == 'move':
      move_positions = [int(position) for position in c_data.split(',')]
      mouse.move(move_positions[0], move_positions[1])
    elif c_type == 'mhold':
      mouse.press(eval(f'Button.{c_data}'))
    elif c_type == 'mrelease':
      mouse.release(eval(f'Button.{c_data}'))
    elif c_type == 'click':
      mouse.press(eval(f'Button.{c_data}'))
      mouse.release(eval(f'Button.{c_data}'))
    elif c_type == 'dclick':
      mouse.click(eval(f'Button.{c_data}'), 2)
    elif c_type == 'scroll':
      scroll_positions = [int(position) for position in c_data.split(',')]
      mouse.scroll(scroll_positions[0], scroll_positions[1])
    elif c_type == 'sleep':
      time.sleep(float(c_data))
    else:
      raise Exception('Invalid keystroke command')
def replayEdit(file_name):
	global APP
	screen_width = APP.winfo_screenwidth()
	screen_height = APP.winfo_screenheight()
	different_screen = False
	instruction_list = []
	df = pandas.read_csv(file_name)
	df = df[df['Mouse Drag'] != 'place'] #this is the key line here. We're essentially eliminating all non eventful rows. The idea is to automatically speed up your recordings
	df_screen_width = df['X_loc'].iloc[0] #while this is a simple way of doing that, refer to the askForScreenshot() and getCorners() functions for a more complex speedup
	df_screen_height = df['Y_loc'].iloc[0]
	df_screen_width = typeToInt(df_screen_width)
	df_screen_height = typeToInt(df_screen_height)
	width_ratio = float(screen_width)/float(df_screen_width)
	height_ratio = float(screen_height)/float(df_screen_height)
	if width_ratio != 1.0 or height_ratio != 1.0:
		different_screen = True
		print('Calculating different screen dimensions')
	instruction_list = df['INSTRUCTION'].to_list()  
	mouse = Controller()
	keyboard = KeyboardController()
	for row in instruction_list[2:]:
		row = literal_eval(row)
		print(row)
		try:
			if different_screen == True: #refer to replay and safeReplay() functions
				mouse.position = int(round(width_ratio * float(row[0]))),int(round(height_ratio * float(row[1]))) #this way is very slow if you have a different screen
			else:
				mouse.position = int(row[0]),int(row[1])
		except:
			pass
		if row[3] == 'True': #this will be True on any press
			try:
				print(eval(row[2]))
				mouse.press(eval(row[2])) #so we try mouse, for the button in row[2]
			except:
				print(row[2])
				keyboard.press(checkBut(row[2])) #if not mouse it must have been a keyboard press
		if row[3] == 'False': #row[3] will be 'False' on any release
			try:
				print(eval(row[2]))  
				mouse.release(eval(row[2])) #so first, we try the button on mouse. Eval is essential here because we need a class object, not a string as the parameter
			except:
				print(row[2])
				keyboard.release(checkBut(row[2])) #if the mouse release doesn't work, it must be a button release. This actually shouldn't work but it does because when you save to a csv
                                           #your pynput button objects get converted to strings
		try:
			dy = int(row[3])
			mouse.scroll(0,dy)  #scrolling is pretty broken. It'll work if you scroll all the way to a buffer or page limit. But it's not accurate enough to scroll wikipedia and copy and paste words
		except: #I used try and excepts because they're fast and readable
			pass
				
		time.sleep(row[-1]) #pages load at different rates, apps too. This sleeps for as long as you did during recording
 def move_key(direcao, keyboard=KeyboardController()):
     if direcao == 'up':
         keyboard.press(Key.up)
         keyboard.release(Key.up)
     elif direcao == 'down':
         keyboard.press(Key.down)
         keyboard.release(Key.down)
     elif direcao == 'left':
         keyboard.press(Key.left)
         keyboard.release(Key.left)
     elif direcao == 'right':
         keyboard.press(Key.right)
         keyboard.release(Key.right)
예제 #17
0
def run_keyboard():
    """
    Performs a random key stroke based on random.choice which is a Uniform distribution
    :return: None
    """
    keyboard = KeyboardController()
    choices = [
        Key.shift, Key.up, Key.down, Key.left, Key.right, Key.caps_lock,
        Key.ctrl
    ]

    key_stroke = choice(choices)

    keyboard.press(key_stroke)
    keyboard.release(key_stroke)
    logging.info(f'Pressed {str(key_stroke).split(".")[1]}')
예제 #18
0
 def __init__(self, parent_ui=None, config=Config()):
     super(AutoClickerThread, self).__init__()
     self.ui = parent_ui
     self.config = config
     self.thread = None
     self._stop_event = Event()
     self.mouse_button = None
     self.current_keys = set()
     self.accepted_keys = set()
     self.reload_config()
     self.activated = False
     self.mouse_controller = MouseController()
     self.keyboard_controller = KeyboardController()
     self.last_state = False
     self.sequence_index = 0
     self.sequence_length = len(self.config.output_sequence)
예제 #19
0
파일: autotank.py 프로젝트: 7aske/utils-py
class KeyPresser(Thread):
    gcd = 1
    kc = KeyboardController()
    mc = MouseController()
    c = RGB(255, 0, 0)
    dc = GetDC(0)
    macro = ""

    def __init__(self, m):
        print(macros[m])
        self.macro = m
        Thread.__init__(self)
        self.daemon = True
        self.start()

    def indicator(self):
        width = int(GetSystemMetrics(0) / 2)
        for i in range(width - 12, width + 12):
            for j in range(24):
                SetPixel(self.dc, i, j, self.c)

    def run(self):
        while True:
            global run, pause, macros

            if running:
                self.indicator()

                if not pause:
                    for macro in macros[self.macro]:
                        if isinstance(macro, tuple):
                            self.mc.scroll(macro[0], macro[1])

                        else:
                            self.kc.press(macro)
                            self.kc.release(macro)

                        sleep(0.1)
                sleep(self.gcd)
            else:
                sleep(2)
예제 #20
0
    def inicio_turno(self):
        """
        Con este método se inicia el turno que consiste en:
            - Creación de otro hilo para recoger las palabras
            - Filtrado de palabras duplicadas
            - Return de la lista de palabras
        """
        palabras = []
        self.__recogiendo = True
        thread = threading.Thread(target=self.recoger_palabras,
                                  args=(palabras, ))
        thread.start()

        time.sleep(self.__turno)
        self.__recogiendo = False

        kbCtrl = KeyboardController()
        kbCtrl.press(Key.enter)
        kbCtrl.release(Key.enter)
        print()

        return list(set(palabras))
예제 #21
0
def safeReplay1(file_name):
    global APP
    global CONTINUE_CHECK
    screen_width = APP.winfo_screenwidth()
    screen_height = APP.winfo_screenheight()
    different_screen = False
    instruction_list = []
    df = pandas.read_csv(file_name)
    df_screen_width = df['X_loc'].iloc[0]
    df_screen_height = df['Y_loc'].iloc[0]
    df_screen_width = typeToInt(df_screen_width)
    df_screen_height = typeToInt(
        df_screen_height
    )  #up here i should process instruction list, and adjust values if neccessary, and make sure there's always a mouse position
    width_ratio = float(screen_width) / float(df_screen_width)
    height_ratio = float(screen_height) / float(df_screen_height)
    if width_ratio != 1.0 or height_ratio != 1.0:
        different_screen = True
        print('Calculating different screen dimensions')
    instruction_list = df['INSTRUCTION'].to_list()
    mouse = Controller()
    keyboard = KeyboardController()
    for row in instruction_list[2:]:

        try:
            next_row = eval(instruction_list[instruction_list.index(row) + 1])
        except:
            next_row = ['k', 'k', 'k', 'False']

        if next_row[3] == 'True':
            continuePrompt(next_row[2])
            decision = checkDecision(next_row[2])
            if not decision:
                return None

        row = literal_eval(row)
        print(row)
        try:
            if different_screen == True:
                mouse.position = int(round(width_ratio * float(row[0]))), int(
                    round(height_ratio * float(row[1])))
            else:
                mouse.position = int(row[0]), int(row[1])
        except:
            pass
        if row[3] == 'True':
            try:
                print(eval(row[2]))
                mouse.press(eval(row[2]))
            except:
                print(row[2])
                keyboard.press(checkBut(row[2]))
        if row[3] == 'False':
            try:
                print(eval(row[2]))
                mouse.release(eval(row[2]))
            except:
                print(row[2])
                keyboard.release(checkBut(row[2]))
        try:
            dy = int(row[3])
            mouse.scroll(
                0, dy
            )  ##the scrolling part could be tested in an automated script. Get the scroll right until on a wikipedia page you get the same word copied and pasted twice
        except:
            pass

        time.sleep(row[-1])
예제 #22
0
def safeReplay(file_name):
    screen_width = APP.winfo_screenwidth()
    screen_height = APP.winfo_screenheight()
    different_screen = False
    instruction_list = []
    df = pandas.read_csv(file_name)
    df_screen_width = df['X_loc'].iloc[0]
    df_screen_height = df['Y_loc'].iloc[0]
    df_screen_width = typeToInt(df_screen_width)
    df_screen_height = typeToInt(df_screen_height)
    width_ratio = float(screen_width) / float(df_screen_width)
    height_ratio = float(screen_height) / float(df_screen_height)
    if width_ratio != 1.0 or height_ratio != 1.0:
        different_screen = True
        print('Calculating different screen dimensions')
    instruction_list = df['INSTRUCTION'].to_list()
    mouse = Controller()
    keyboard = KeyboardController()
    safe_instruction_list = []
    for row in instruction_list[2:-2]:
        literal_row = literal_eval(row)
        x = literal_row[0]
        y = literal_row[1]
        if different_screen == True:
            try:
                x = int(round(width_ratio * float(row[0])))
                y = int(round(height_ratio * float(row[1])))
            except:
                pass
        else:
            try:
                x = int(x)
                y = int(y)
            except:
                pass
        btn = literal_row[2]
        boolean = literal_row[3]
        time_sleep = literal_row[4]
        safe_instruction_list.append([x, y, btn, boolean, time_sleep])
    prompts = []
    for row in safe_instruction_list:
        info_list = safer(row, safe_instruction_list)
        prompts.append(info_list)
    for row in prompts:
        if row != ('no prompt') and (prompts[prompts.index(row) - 1]
                                     == 'no prompt'):
            index = safe_instruction_list.index(row[0])
            safe_instruction_list.insert(index, row[1])
        else:
            pass
    for row in safe_instruction_list:
        print(row)
    for row in safe_instruction_list:
        if row[0] == 'continue prompt':
            decision = listenForCommand(row[1])
            if decision == True:
                pass
            elif decision == False:
                homeReset()
                print('Exiting')
                return None

        print('Proceeding to the next row')

        if row[0] != 'continue prompt':
            try:
                mouse.position = row[0], row[1]
            except:
                pass
            if row[3] == 'True':
                try:
                    mouse.press(eval(row[2]))
                except:
                    keyboard.press(checkBut(row[2]))
            if row[3] == 'False':
                try:
                    mouse.release(eval(row[2]))
                except:
                    keyboard.release(checkBut(row[2]))
            try:
                dy = int(row[3])
                mouse.scroll(0, dy)
            except:
                pass
            time.sleep(row[-1])
        else:
            pass  #go back to line 326
예제 #23
0
import os
import subprocess

from motee.net import get_address, get_mac, hostname, PORT
from motee.scope import ScopeHandler
from pynput.mouse import Button, Controller as MouseController
from pynput.keyboard import Key, Controller as KeyboardController
from Xlib import X
from Xlib.display import Display
from Xlib.ext.xtest import fake_input
import Xlib.XK

KEYBOARD = KeyboardController()
MOUSE = MouseController()

DISPLAY = Display()
Xlib.XK.load_keysym_group("xf86")


def _keycode(name):
    keysym_num = Xlib.XK.string_to_keysym(name)
    if keysym_num == Xlib.XK.NoSymbol:
        raise ValueError(name)
    keycode = DISPLAY.keysym_to_keycode(keysym_num)
    if not keycode:
        raise RuntimeError(f'Unable to map key "{name}" to a keycode')
    return keycode


VOLUME_UP = _keycode("XF86_AudioRaiseVolume")
VOLUME_DOWN = _keycode("XF86_AudioLowerVolume")
예제 #24
0
파일: main.py 프로젝트: Henri-1/BaseBuilder
import pynput, time, random
from pynput.keyboard import Key, Controller as KeyboardController, Listener
from pynput.mouse import Button, Controller as MouseController

keyboard = KeyboardController()  # Create the controller
mouse = MouseController()

time.sleep(5)


def press_key(string, wait_time):
    keyboard.press(string)
    time.sleep(wait_time)
    keyboard.release(string)
    #for character in string:  # Loop over each character in the string
    #   keyboard.type(character)  # Type the character
    #  delay = random.uniform(0, 0.1)  # Generate a random number between 0 and 10
    # time.sleep(delay)  # Sleep for the amount of seconds generated


def mouse_click_left():
    mouse.press(Button.left)
    mouse.release(Button.left)


def select_building(part):
    print(0)


mouse_click_left()
예제 #25
0
def read_tablet(args):
    """Loop forever and map evdev events to mouse"""

    last_x = last_y = None
    start_x = start_y = x = y = 0
    moves = 0

    monitor = get_monitors()[0]
    log.debug('Chose monitor: {}'.format(monitor))

    stdout = open_remote_device(args, file='/dev/input/event1')

    mouse = MouseController()
    keyboard = KeyboardController()
    # table of image coordinates and actions
    mapping = KeyboardMapping(mouse, keyboard)

    while True:
        _, _, e_type, e_code, e_value = struct.unpack('2IHHi', stdout.read(16))

        if e_type == e_type_abs:

            # handle x direction (rotated)
            if e_code == e_code_finger_ypos:
                log.debug(e_value)
                x = e_value
                monitor_x, monitor_y = map_finger(x, y, finger_width,
                                                  finger_height, monitor.width,
                                                  monitor.height)
                # use relative movement instead of absolute position
                # (like a trackpad)
                if last_x is not None:
                    mouse.move(monitor_x - last_x, 0)
                    moves += 1
                else:
                    start_x = x
                last_x = monitor_x

            # handle y direction (rotated)
            elif e_code == e_code_finger_xpos:
                log.debug('\t{}'.format(e_value))
                y = e_value
                monitor_x, monitor_y = map_finger(x, y, finger_width,
                                                  finger_height, monitor.width,
                                                  monitor.height)
                # use relative movement instead of absolute position
                # (like a trackpad)
                if last_y is not None:
                    mouse.move(0, monitor_y - last_y)
                    moves += 1
                else:
                    start_y = y
                last_y = monitor_y

            # handle pressure
            elif e_code == e_code_finger_pressure:
                log.debug('\t\t{}'.format(e_value))
                pass

            # handle finger lift
            elif e_code == e_code_finger_touch:
                if e_value == e_value_finger_up:
                    log.debug('\t\t\tfinger up')
                    last_x = None
                    last_y = None
                    log.debug('start position:{}  {}'.format(start_x, start_y))
                    # FIXME: I have no freaking idea why, but the keyboard lags slightly unless
                    # we print something to console here
                    print(' \r', end='')
                    # if the mouse hasn't moved much since the last finger lift, assume it was a touch
                    if moves < 8:
                        log.debug('touch, moves:{}'.format(moves))
                        image_x, image_y = map_finger(start_x, start_y,
                                                      finger_width,
                                                      finger_height,
                                                      image_width,
                                                      image_height)
                        mapping.call_action(image_x, image_y)
                    else:
                        log.debug('drag, moves:{}'.format(moves))

                    moves = 0
예제 #26
0
import os
import time


#os.system("title U校园答案获取器")
#os.system('echo -e "--U校园biss----\n----Made by r0----"')
#os.system("color 0a")
headers = {
    'User-Agent': 'unknown',
    'X-ANNOTATOR-AUTH-TOKEN':'unknown'
	# 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0',
	# 'X-ANNOTATOR-AUTH-TOKEN':'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcGVuX2lkIjoiYzI1YzJkNjJhYjBjNDE1MTgxZTRkZjY1NjljMGQyM2EiLCJuYW1lIjoiIiwiZW1haWwiOiIiLCJhZG1pbmlzdHJhdG9yIjpmYWxzZSwiZXhwIjoxNjE3MDkyODE4MjYyLCJpc3MiOiJjNGY3NzIwNjNkY2ZhOThlOWM1MCIsImF1ZCI6ImVkeC51bmlwdXMuY24ifQ.G8J9KaXuc5tNfaaZ8f-zBqcZ3bIQm2oGA16SoV_zrRw'
    # # #请从自己的浏览器中获取
}

keyboard_c  = KeyboardController()
timestamp_win = 0

r=Tk()
r.title("Uniqus killer")
r.geometry('300x140')

###-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-###
def update_agent():
    headers['User-Agent']=user_agent.get()
    headers['X-ANNOTATOR-AUTH-TOKEN']=x_token.get()



def start_answer_1():
    update_agent()
 def keypress(msg, keyboard=KeyboardController()):
     keyboard.type(msg)
 def pageDown(keyboard=KeyboardController()):
     keyboard.press(Key.page_down)
     keyboard.release(Key.page_down)
예제 #29
0
import argparse
import time
from datetime import datetime
from pynput.mouse import Controller as MouseController
from pynput.keyboard import Key, Controller as KeyboardController

mouse = MouseController()
keyboard = KeyboardController()

MOVE_MOUSE = False
PRESS_SHIFT_KEY = False
PIXELS_TO_MOVE = 1

move_mouse_every_seconds = 300


def define_custom_seconds():
    global move_mouse_every_seconds, PIXELS_TO_MOVE, PRESS_SHIFT_KEY, MOVE_MOUSE

    parser = argparse.ArgumentParser(
        description=
        "This program moves the mouse or press a key when it detects that you are away. "
        "It won't do anything if you are using your computer. "
        "Useful to trick your machine to think you are still working with it.")

    parser.add_argument(
        "-s",
        "--seconds",
        type=int,
        help=
        "Define in seconds how long to wait after a user is considered idle. Default 300."
예제 #30
0
    def __init__(self):
        self.keyboard = KeyboardController()
        self.cursor = MouseController()

        self.loadedTemplates = {}
        self.currentPressedButtons = []