The page contains a few decompiled code examples
To see another example you need to refresh the page
import time
import threading
import random
from pynput.mouse import Controller, Button, Listener
import keyboard
import mouse
import ctypes
import sys
import win32api
import win32gui
import win32con
import win32process
import psutil
import os
from colorama import init, Fore, Style
init()
MOUSEEVENTF_LEFTDOWN = 2
MOUSEEVENTF_LEFTUP = 4
DCPS = 12.2
CI = 0.1
WS_EX_LAYERED = win32con.WS_EX_LAYERED
LWA_ALPHA = win32con.LWA_ALPHA
OPACITY = 235
ASCII_ART = f'''{Fore.CYAN}
___ ___
/ /\\ ___ / /\\
/ /::\\ /__/\\ / /::\\
/ /:/\\:\\ \\__\\:\\ / /:/\\:\\
/ /:/ \\:\\ / /::\\ / /::\\ \\:\\
/__/:/ \\ \\:\\ __/ /:/\\/ /__/:/\\:\\_\\:\\
\\ \\:\\ \\__\\/ /__/\\/:/ \\__\\/ \\:\\/:/
\\ \\:\\ \\ \\::/ \\__\\::/
\\ \\:\\ \\ \\:\\ / /:/
\\ \\:\\ \\__\\/ /__/:/
\\__\\/ \\__\\/ v1.0
{Style.RESET_ALL}'''
def animate_ascii_art(ascii_art,duration=1):
lines = ascii_art.split('\n')
total_chars = sum((len(line) for line in lines))
chars_per_second = total_chars/duration
for i in range(len(lines)):
for j in range(len(lines[i])):
print(lines[i][j],end='',flush=True)
time.sleep(1/chars_per_second)
continue
print()
continue
return None
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
pass
return False
def run_as_admin():
if is_admin():
ctypes.windll.shell32.ShellExecuteW(None,'runas',sys.executable,' '.join(sys.argv),None,1)
sys.exit()
return None
else:
return None
def set_window_opacity():
try:
hwnd = win32gui.GetForegroundWindow()
if hwnd:
style = win32gui.GetWindowLong(hwnd,win32con.GWL_EXSTYLE)
win32gui.SetWindowLong(hwnd,win32con.GWL_EXSTYLE,style|WS_EX_LAYERED)
win32gui.SetLayeredWindowAttributes(hwnd,0,OPACITY,LWA_ALPHA)
return None
else:
return None
except Exception as e:
print(f'''Erreur lors de la configuration de l\'opacité: {e}''')
return None
class PortableClicker:
def __init__(self):
self.mouse = Controller()
self.clicking = False
self.is_auto_clicking = False
self.user_pressing = False
self.enabled = False
self.cps = DCPS
self.auto_click_on_press = True
self.running = True
self.last_toggle_time = 0
self.toggle_cooldown = 0.3
self.az_launcher_active = False
self.mouse_detector = MouseClickDetector(self)
self.background_thread = threading.Thread(target=self.background_task,daemon=True)
self.az_check_thread = threading.Thread(target=self.check_az_launcher,daemon=True)
self.background_thread.start()
self.az_check_thread.start()
return None
def check_az_launcher(self):
if self.running:
try:
hwnd = win32gui.GetForegroundWindow()
_,pid = win32process.GetWindowThreadProcessId(hwnd)
process = psutil.Process(pid)
process_name = process.name().lower()
window_title = win32gui.GetWindowText(hwnd).lower()
self.az_launcher_active = any(['azlauncher' in process_name,'azlauncher' in window_title,'minecraft' in process_name,'minecraft' in window_title,'java' in process_name])
except Exception as e:
self.az_launcher_active = False
time.sleep(CI)
return None
else:
return None
def _perform_click(self):
if self.running:
return None
else:
methods = [lambda : win32api.mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0),lambda : self.mouse.press(Button.left),lambda : mouse.press(button='left')]
for i,method in enumerate(methods):
try:
method()
except Exception as e:
method_names = ['win32api','pynput','mouse']
print(f'''Error with {method_names[i]}: {e}''')
if i == len(methods)-1:
print('Critical click error')
continue
break
def _blatant_delay(self,cps):
average_delay = 1/cps
return random.uniform(average_delay*0.9,average_delay*1.1)
def auto_click(self):
if self.running:
return 0.01
else:
delay = self._blatant_delay(self.cps)
self._perform_click()
return delay
def background_task(self):
if self.running:
should_click = (self.az_launcher_active and self.clicking and (self.enabled or (self.auto_click_on_press and self.enabled and self.mouse_detector.is_pressed)))
if should_click:
if self.running:
delay = self.auto_click()
time.sleep(delay)
else:
time.sleep(0.01)
return None
def clear_console(self):
if os.name == 'nt':
pass
else:
pass
'cls'.os.system('clear')
return None
def toggle_enabled(self):
current_time = time.time()
if current_time-self.last_toggle_time < self.toggle_cooldown:
return None
else:
self.last_toggle_time = current_time
self.enabled = not(self.enabled)
self.clear_console()
print(ASCII_ART)
state_color = Fore.CYAN if self.enabled else Fore.RED
print(f'''{state_color}Binds [w] [F4] - State: {'Enabled' if self.enabled else 'Disabled'}{Style.RESET_ALL}''')
if self.enabled:
self.clicking = False
self.mouse_detector.is_pressed = False
return None
else:
return None
def start(self):
try:
self.clear_console()
set_window_opacity()
animate_ascii_art(ASCII_ART)
print(f'''{Fore.CYAN}Binds [w] [F4] - State: Disabled{Style.RESET_ALL}''')
def on_key_event(event):
if (event.name == 'w' or 'f4'):
if event.event_type == keyboard.KEY_UP:
self.toggle_enabled()
return None
else:
return None
else:
return None
keyboard.hook(on_key_event)
if self.running:
time.sleep(0.1)
return None
else:
return None
except Exception as e:
print(f'''Une erreur est survenue: {e}''')
self.stop()
return None
except KeyboardInterrupt:
self.stop()
return None
def stop(self):
self.running = False
self.enabled = False
self.clicking = False
self.mouse_detector.is_pressed = False
if self.background_thread.is_alive():
self.background_thread.join(timeout=1)
self.mouse_detector.stop()
keyboard.unhook_all()
mouse.unhook_all()
sys.exit()
return None
class MouseClickDetector:
def __init__(self,app):
self.app = app
self.is_pressed = False
self.listener = Listener(on_click=self.on_click)
self.thread = threading.Thread(target=self.execute,daemon=True)
self.thread.start()
return None
def on_click(self,x,y,button,pressed):
if self.app.running:
return None
else:
if button != Button.left:
return None
else:
if pressed:
self.is_pressed = True
self.app.clicking = True
return None
else:
self.is_pressed = False
self.app.clicking = False
return None
def execute(self):
self.listener.start()
self.listener.join()
return None
def stop(self):
self.listener.stop()
if self.thread.is_alive():
self.thread.join(timeout=1)
return None
else:
return None
if __name__ == '__main__':
run_as_admin()
app = PortableClicker()
try:
app.start()
except KeyboardInterrupt:
app.stop()
print('Program stopped')