|
You last visited: Today at 10:48
Advertisement
[RELEASE] Python Makro
Discussion on [RELEASE] Python Makro within the Metin2 Hacks, Bots, Cheats, Exploits & Macros forum part of the Metin2 category.
08/15/2024, 19:50
|
#1
|
elite*gold: 0
Join Date: Jan 2022
Posts: 53
Received Thanks: 15
|
[RELEASE] Python Makro
Ich habe dieses Skript zusammen mit meiner virtuellen Maschine verwendet,
um auf dem P-Server Lucerna automatisch in den Extreme-Dungeons als filler mit meinen Twinks Mobs anzulocken,
anzugreifen und Items aufzusammeln. Dabei musste ich nicht aktiv am Spiel teilnehmen und konnte nebenbei
auf meinem Main-Account farmen. Es ist wahrscheinlich nicht perfekt, aber jeder fängt mal irgendwo an.
Wenn ihr Verbesserungsvorschläge habt, lasst es mich gerne wissen. Ich teile die Datei hier sowie den kompletten Code.
Funktionen des Skripts:
Auswahl eines Prozesses durch eine benutzerfreundliche Oberfläche.
Automatisches dauerhaftes Drücken der Leertaste (Auch nach dem Stop drücken schlägt der Char weiter bis wieder ins Fenster gewechselt wird da die taste als gehalten gesendet wird), Wiederholtes drücken der Taste '4' für Umhänge und der Taste 'Y' zum aufheben von Drops.
Möglichkeit, jede dieser Tasten zu aktivieren oder zu deaktivieren via checkbox.
Anpassung des UI an die Systemeinstellungen (dunkler oder heller Modus).
Direktes Senden der Tastenschläge an den ausgewählten Prozess, sodass ihr euren PC nebenbei für andere Aufgaben nutzen könnt, ohne aktiv im Spiel zu sein.
Änderungen
Wrapper hinzugefügt dies bearbeitet das Haupt script und erzeugt ein Temporäres Macro,
und führt dieses aus mit einem zufällig generiertem Anwendungstitel und dem passendem Prozess.
Das Temporär erstellte Makro wird nach dem beenden automatisch vom Wrapper gelöscht.
Wrapper wurde umbenannt zu StartMacro.
Prozess Macro wurde umbenannt zu Macro.
Macro kann nun nicht mehr gestartet werden Fehlermeldung erscheint das nur mit StartMacro gestartet werden kann.
Temporäres Macro wird im Ordner tempM erstellt und nach Beendigung dort wieder gelöscht.
Code StartMacro
Code:
import os
import random
import string
import subprocess
import shutil
def generate_random_name(min_length=5, max_length=20):
length = random.randint(min_length, max_length)
return ''.join(random.choices(string.ascii_letters + string.digits, k=length))
def create_temp_dir(base_path):
temp_dir = os.path.join(base_path, "tempM")
if not os.path.exists(temp_dir):
os.makedirs(temp_dir)
return temp_dir
def create_and_run_exe(original_exe_path):
base_path = os.path.dirname(original_exe_path)
temp_dir = create_temp_dir(base_path)
random_name = generate_random_name()
new_exe_path = os.path.join(temp_dir, random_name + ".exe")
shutil.copy(original_exe_path, new_exe_path)
try:
process = subprocess.Popen([new_exe_path, random_name, "valid_start"])
process.wait()
finally:
if os.path.exists(new_exe_path):
os.remove(new_exe_path)
if __name__ == "__main__":
original_exe_path = "Macro.exe"
create_and_run_exe(original_exe_path)
Code Macro
Code:
import sys
import win32api
import win32con
import win32gui
import win32process
import psutil
import time
import threading
import tkinter as tk
from tkinter import messagebox
import darkdetect
class KeyPresser:
def __init__(self, process_id, send_space, send_4, send_y):
self.process_id = process_id
self.send_space = send_space
self.send_4 = send_4
self.send_y = send_y
self.hwnd = self.find_window()
self.running = False
self.threads = []
def find_window(self):
def enum_callback(hwnd, process_id_list):
_, pid = win32process.GetWindowThreadProcessId(hwnd)
if pid == self.process_id:
process_id_list.append(hwnd)
process_id_list = []
win32gui.EnumWindows(enum_callback, process_id_list)
if not process_id_list:
raise Exception(f"Fenster für Prozess-ID '{self.process_id}' nicht gefunden.")
return process_id_list[0]
def send_keystroke(self, key, hold=False):
if hold:
win32api.SendMessage(self.hwnd, win32con.WM_KEYDOWN, key, 0)
else:
win32api.SendMessage(self.hwnd, win32con.WM_KEYDOWN, key, 0)
win32api.SendMessage(self.hwnd, win32con.WM_KEYUP, key, 0)
def hold_key(self, key):
while self.running:
self.send_keystroke(key, hold=True)
time.sleep(0.01)
def repeat_key(self, key, interval=0.1):
while self.running:
self.send_keystroke(key)
time.sleep(interval)
def start(self):
self.running = True
if self.send_space:
self.threads.append(threading.Thread(target=self.hold_key, args=(win32con.VK_SPACE,)))
if self.send_4:
self.threads.append(threading.Thread(target=self.repeat_key, args=(ord('4'),)))
if self.send_y:
self.threads.append(threading.Thread(target=self.repeat_key, args=(ord('Y'), 0.05)))
for thread in self.threads:
thread.daemon = True
thread.start()
def stop(self):
self.running = False
for thread in self.threads:
thread.join()
class App:
def __init__(self, root, window_title):
self.key_presser = None
root.title(window_title)
if darkdetect.isDark():
self.bg_color = "#333333"
self.fg_color = "#FFFFFF"
else:
self.bg_color = "#FFFFFF"
self.fg_color = "#000000"
root.configure(bg=self.bg_color)
self.process_frame = tk.Frame(root, bg=self.bg_color)
self.process_frame.grid(row=0, column=0, columnspan=2, pady=5)
self.select_process_button = tk.Button(self.process_frame, text="Prozess auswählen", command=self.open_process_selection, bg=self.bg_color, fg=self.fg_color)
self.select_process_button.pack(pady=5)
self.selected_process_label = tk.Label(self.process_frame, text="Kein Prozess ausgewählt", bg=self.bg_color, fg=self.fg_color)
self.selected_process_label.pack(pady=5)
self.checkbox_frame = tk.Frame(root, bg=self.bg_color)
self.checkbox_frame.grid(row=1, column=0, columnspan=2, pady=5)
self.space_var = tk.BooleanVar()
self.space_checkbox = tk.Checkbutton(self.checkbox_frame, text="Leertaste", variable=self.space_var, bg=self.bg_color, fg=self.fg_color, selectcolor=self.bg_color)
self.space_checkbox.pack(side=tk.LEFT, padx=10)
self.key4_var = tk.BooleanVar()
self.key4_checkbox = tk.Checkbutton(self.checkbox_frame, text="Taste 4", variable=self.key4_var, bg=self.bg_color, fg=self.fg_color, selectcolor=self.bg_color)
self.key4_checkbox.pack(side=tk.LEFT, padx=10)
self.keyy_var = tk.BooleanVar()
self.keyy_checkbox = tk.Checkbutton(self.checkbox_frame, text="Taste Y", variable=self.keyy_var, bg=self.bg_color, fg=self.fg_color, selectcolor=self.bg_color)
self.keyy_checkbox.pack(side=tk.LEFT, padx=10)
self.button_frame = tk.Frame(root, bg=self.bg_color)
self.button_frame.grid(row=2, column=0, columnspan=2, pady=10)
self.start_button = tk.Button(self.button_frame, text="Start", command=self.start, bg=self.bg_color, fg=self.fg_color)
self.start_button.pack(side=tk.LEFT, padx=10)
self.stop_button = tk.Button(self.button_frame, text="Stop", command=self.stop, bg=self.bg_color, fg=self.fg_color)
self.stop_button.pack(side=tk.LEFT, padx=10)
def open_process_selection(self):
self.process_window = tk.Toplevel()
self.process_window.title("Prozess auswählen")
process_listbox = tk.Listbox(self.process_window, selectmode=tk.SINGLE)
process_listbox.pack(fill=tk.BOTH, expand=True)
processes = []
for p in psutil.process_iter(['pid', 'name']):
try:
for hwnd in self.get_hwnds_for_pid(p.pid):
if win32gui.IsWindowVisible(hwnd):
processes.append((p.pid, p.name()))
break
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
continue
for pid, name in processes:
process_listbox.insert(tk.END, f"{pid} - {name}")
select_button = tk.Button(self.process_window, text="Auswählen", command=lambda: self.select_process(process_listbox))
select_button.pack(pady=5)
def get_hwnds_for_pid(self, pid):
def callback(hwnd, hwnds):
if win32gui.IsWindowVisible(hwnd) and win32gui.GetWindowText(hwnd):
_, found_pid = win32process.GetWindowThreadProcessId(hwnd)
if found_pid == pid:
hwnds.append(hwnd)
return True
hwnds = []
win32gui.EnumWindows(callback, hwnds)
return hwnds
def select_process(self, listbox):
selection = listbox.curselection()
if selection:
process_info = listbox.get(selection[0])
self.selected_process_label.config(text=f"Ausgewählt: {process_info}")
self.process_id = int(process_info.split(' - ')[0])
self.process_window.destroy()
else:
messagebox.showwarning("Warnung", "Bitte wählen Sie einen Prozess aus.")
def start(self):
if hasattr(self, 'process_id'):
send_space = self.space_var.get()
send_4 = self.key4_var.get()
send_y = self.keyy_var.get()
self.key_presser = KeyPresser(self.process_id, send_space, send_4, send_y)
self.key_presser.start()
else:
messagebox.showerror("Fehler", "Bitte wählen Sie einen Prozess aus.")
def stop(self):
if self.key_presser:
self.key_presser.stop()
else:
messagebox.showwarning("Warnung", "Kein laufender Prozess zum Stoppen.")
if __name__ == "__main__":
if len(sys.argv) < 3 or sys.argv[2] != "valid_start":
tk.messagebox.showerror("Fehler", "Dieses Macro muss über StartMacro gestartet werden.")
sys.exit(1)
root = tk.Tk()
window_title = sys.argv[1] if len(sys.argv) > 1 else " "
app = App(root, window_title)
root.mainloop()
VirusTotal StartMacro
VirusTotal Macro
Download
|
|
|
08/15/2024, 20:05
|
#2
|
elite*gold: 0
Join Date: Jan 2022
Posts: 48
Received Thanks: 13
|
It doesn't work, keydown or keyup not work for metin2. I tried and it don't do nothing
|
|
|
08/15/2024, 20:10
|
#3
|
elite*gold: 0
Join Date: Jan 2022
Posts: 53
Received Thanks: 15
|
Quote:
Originally Posted by Merdone10
It doesn't work, keydown or keyup not work for metin2. I tried and it don't do nothing
|
I can't guarantee that the script will work everywhere.
I used it exclusively for the Lucerna server.
Please try not to start your metin via the patcher if possible someone else had the same problem when starting metin with the patcher. and after he started it via the client exe it worked
Just let me know when you've tried it
|
|
|
08/16/2024, 14:47
|
#4
|
elite*gold: 0
Join Date: Jan 2022
Posts: 48
Received Thanks: 13
|
Quote:
Originally Posted by .Shi
I can't guarantee that the script will work everywhere.
I used it exclusively for the Lucerna server.
Please try not to start your metin via the patcher if possible someone else had the same problem when starting metin with the patcher. and after he started it via the client exe it worked
Just let me know when you've tried it
|
Not work, tested in 5 server. This can't work since keydown not work in metin2, you sure this work on lucerna?
|
|
|
08/16/2024, 15:14
|
#5
|
elite*gold: 0
Join Date: Jan 2022
Posts: 53
Received Thanks: 15
|
Quote:
Originally Posted by Merdone10
Not work, tested in 5 server. This can't work since keydown not work in metin2, you sure this work on lucerna?
|
yes it works perfectly on lucerna. me and a few others use it there
Quote:
Originally Posted by Merdone10
Not work, tested in 5 server. This can't work since keydown not work in metin2, you sure this work on lucerna?
|
Here is a short video where you can see that everything works. And you can clearly see that my program is also running in the background without being directly in the client
video clip will be automatically deleted after two days. a new video will be attached to the above post in the next few days with hopefully a few more functions
#Updates wurden hinzugefügt siehe Anfangspost
|
|
|
08/18/2024, 15:23
|
#6
|
elite*gold: 0
Join Date: Aug 2012
Posts: 3
Received Thanks: 0
|
The download doesn't work anymore, could you please fix it?
|
|
|
08/18/2024, 15:46
|
#7
|
elite*gold: 0
Join Date: Jan 2022
Posts: 53
Received Thanks: 15
|
Quote:
Originally Posted by Baran Alexandru
The download doesn't work anymore, could you please fix it?
|
the problem is with file upload I will upload it somewhere else thanks for the info
#new download link
|
|
|
08/18/2024, 17:16
|
#8
|
elite*gold: 0
Join Date: Aug 2012
Posts: 3
Received Thanks: 0
|
Quote:
Originally Posted by .Shi
the problem is with file upload I will upload it somewhere else thanks for the info
#new download link
|
Thank you for your fast response, sadly, the new link does not work for me.
|
|
|
08/18/2024, 18:53
|
#9
|
elite*gold: 0
Join Date: Jan 2022
Posts: 53
Received Thanks: 15
|
Quote:
Originally Posted by Baran Alexandru
Thank you for your fast response, sadly, the new link does not work for me.
|
I'll just upload it to mega then we shouldn't have this problem anymore download link should be updated in 5 minutes
#new download link via mega
|
|
|
08/18/2024, 21:30
|
#10
|
elite*gold: 0
Join Date: Oct 2014
Posts: 3
Received Thanks: 0
|
Does uriel anti cheat work on the server?
|
|
|
08/26/2024, 21:02
|
#11
|
elite*gold: 0
Join Date: Dec 2017
Posts: 4
Received Thanks: 0
|
How did you managed to run metin on VM?
|
|
|
08/26/2024, 21:28
|
#12
|
elite*gold: 0
Join Date: Jan 2022
Posts: 53
Received Thanks: 15
|
Quote:
Originally Posted by buxA123
How did you managed to run metin on VM?
|
I only run the p server lucerna in a vm
|
|
|
08/27/2024, 14:07
|
#13
|
elite*gold: 0
Join Date: Jul 2017
Posts: 16
Received Thanks: 1
|
awesome mate works just fine!!!
i was wondering if its possible to add a function that mines or click the veins to mine
|
|
|
08/27/2024, 16:52
|
#14
|
elite*gold: 0
Join Date: Jan 2022
Posts: 53
Received Thanks: 15
|
Quote:
Originally Posted by braveheartpt
awesome mate works just fine!!!
i was wondering if its possible to add a function that mines or click the veins to mine
|
I am currently working on another program that can do this and more
|
|
|
08/28/2024, 13:34
|
#15
|
elite*gold: 0
Join Date: Apr 2022
Posts: 3
Received Thanks: 0
|
Quote:
Originally Posted by .Shi
I am currently working on another program that can do this and more
|
Moin, hast du zufällig Discord, finde es selber sehr interessant und wollt gern wissen womit du alle sachen scriptest und würde gern mit dir darüber mal sprechen
|
|
|
 |
|
Similar Threads
|
[Python-Modul]EXP-Donator (kompatibel mit Python Loader)
11/23/2013 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 27 Replies
Moin,
da man mich danach gefragt hat und ich sowieso mal ein Beispiel für die Benutzung meines Python Loaders veröffentlichen wollte, habe ich die Gelegenheit genutzt und euch eben einen EXP-Spendebot geschrieben.
Man kann ihn einfach mit dem oben verlinkten Python Module Loader laden und ihn mit F5 aktivieren/deaktivieren.
Sobald ihr mehr als 99 Erfahrungspunkte habt (man kann nur in 100er Schritten spenden), werden alle Erfahrungspunkte an eure Gilde gespendet.
Wer Lust hat und...
|
Metin2 - Python - Wie Python Hacks verschlüsseln und Server überprüfen (GF/PServe)
09/23/2012 - Metin2 - 2 Replies
Ich wollte fragen,
wie man Python Hacks am besten Verschlüsselt ?
und wie man feststellen kann ob man auf einem GF / Pserver spielt. ?
|
Python + Eric Python IDE installieren ?!
07/05/2011 - General Coding - 0 Replies
hat sich erledigt.
|
[Makro]Suche Tastatur+Maus Makro
12/09/2009 - Metin2 Private Server - 6 Replies
Hallo zusammen
Ich suche ein Makro wo ich etwas z.B in der DB
schnell nacheinander löschen kann immer das gleiche.
z.B
1. dmg 340 - 3400
hier z.B wenn alle sowären immer das von 3400 das --->0 wegnehmen.
|
makro durch makro auslösen
05/21/2007 - World of Warcraft - 3 Replies
also das problem ist folgendes ein makro kann max 255 zeichen haben ich brauche jedoch eines mit 350 stellen und jetzt wolt ich fragen ob es möglich ist in dem eersten makro, makro1 /cast makro2 oder so ähnlich zu machen oder ob es möglich ist auf eine taste 2 casts zu lgen oder so etwas ähnliches so das sich beide makros gleichzeitig auslösen
|
All times are GMT +1. The time now is 10:49.
|
|