Code:
import time
import win32api, win32gui
import win32con
import ctypes
import threading
import tkinter as tk
from tkinter import messagebox
from pymem import Pymem
class AutoBot:
def __init__(self):
# Memory addresses and offsets
self.pointer = 0x03891DB0
self.offsets_CurHP = [0x38, 0x18, 0x40, 0x20, 0x208, 0x30]
self.offsets_MaxHP = [0x38, 0x18, 0x40, 0x20, 0x208, 0x2c]
self.offsets_CurMP = [0x38, 0x18, 0x40, 0x20, 0x208, 0x80]
self.offsets_MaxMP = [0x38, 0x18, 0x40, 0x20, 0x208, 0x7c]
# Default settings
self.running = False
self.process_name = "PathOfExile.exe"
self.heal_hp = 70
self.heal_mp = 25
self.create_gui()
def find_dma_addy(self, hProc, base, offsets, arch=64):
kernel32 = ctypes.windll.kernel32
size = 8 if arch == 64 else 4
address = ctypes.c_uint64(base)
for offset in offsets:
kernel32.ReadProcessMemory(hProc, address, ctypes.byref(address), size, 0)
address = ctypes.c_uint64(address.value + offset)
return address.value
def connect_to_process(self):
try:
self.pm = Pymem(self.process_name)
print(f"Connected to process: {self.process_name}")
self.hProc = self.pm.process_handle
self.base_pointer = self.pm.base_address + self.pointer
except Exception as e:
messagebox.showerror("Error", f"Process connection error: {e}")
return False
return True
def loop(self):
while self.running:
try:
maxhp_address = self.find_dma_addy(self.hProc, self.base_pointer, self.offsets_MaxHP, 64)
curhp_address = self.find_dma_addy(self.hProc, self.base_pointer, self.offsets_CurHP, 64)
maxmana_address = self.find_dma_addy(self.hProc, self.base_pointer, self.offsets_MaxMP, 64)
curmana_address = self.find_dma_addy(self.hProc, self.base_pointer, self.offsets_CurMP, 64)
current_hp = self.pm.read_int(curhp_address)
max_hp = self.pm.read_int(maxhp_address)
current_mp = self.pm.read_int(curmana_address)
max_mp = self.pm.read_int(maxmana_address)
hp_percent = (current_hp / max_hp) * 100 if max_hp != 0 else 0
mp_percent = (current_mp / max_mp) * 100 if max_mp != 0 else 0
if hp_percent <= self.heal_hp:
time.sleep(0.2)
win32api.PostMessage(self.game_window, win32con.WM_KEYDOWN, ord('1'), 0)
win32api.PostMessage(self.game_window, win32con.WM_KEYUP, ord('1'), 0)
if mp_percent <= self.heal_mp:
time.sleep(0.2)
win32api.PostMessage(self.game_window, win32con.WM_KEYDOWN, ord('2'), 0)
win32api.PostMessage(self.game_window, win32con.WM_KEYUP, ord('2'), 0)
except Exception as e:
print(f"Memory access error: {e}")
time.sleep(0.5)
def start(self):
try:
self.heal_hp = int(self.heal_hp_entry.get())
self.heal_mp = int(self.heal_mp_entry.get())
self.game_window = win32gui.FindWindow(None, "Path of Exile 2")
if not self.game_window:
messagebox.showerror("Error", "Game window not found")
return
if not self.connect_to_process():
return
self.running = True
self.start_button.config(state='disabled')
self.stop_button.config(state='normal')
healbot_thread = threading.Thread(target=self.loop)
healbot_thread.daemon = True
healbot_thread.start()
except ValueError:
messagebox.showerror("Error", "Please enter valid values for HP and MP")
def stop(self):
self.running = False
self.start_button.config(state='normal')
self.stop_button.config(state='disabled')
def aob_scan(self, pm, module_name, signature):
module = next((m for m in pm.list_modules() if m.name == module_name), None)
if not module:
raise ValueError(f"Модуль {module_name} не найден")
pattern = signature.split()
pattern_bytes = []
mask = []
for byte in pattern:
if byte == "??":
pattern_bytes.append(0x00)
mask.append("?")
else:
pattern_bytes.append(int(byte, 16))
mask.append("x")
memory = pm.read_bytes(module.lpBaseOfDll, module.SizeOfImage)
for i in range(len(memory) - len(pattern_bytes)):
match = True
for j in range(len(pattern_bytes)):
if mask[j] == "x" and memory[i + j] != pattern_bytes[j]:
match = False
break
if match:
return module.lpBaseOfDll + i
return None
def patch_memory(self, pm, address, bytes_to_write):
pm.write_bytes(address, bytes_to_write, len(bytes_to_write))
def enable_zoom(self):
try:
signature = "F3 0F 5D 0D ?? ?? ?? 02 F3 0F 11 8F"
address = self.aob_scan(self.pm, self.process_name, signature)
if not address:
messagebox.showerror("Error", "Сигнатура не найдена")
return
self.patch_memory(self.pm, address, b"\x90\x90\x90\x90\x90\x90\x90\x90")
self.enable_zoom_button.config(state='disabled')
self.disable_zoom_button.config(state='normal')
except Exception as e:
messagebox.showerror("Error", f"Ошибка при включении zoom hack: {e}")
def disable_zoom(self):
try:
signature = "F3 0F 5D 0D ?? ?? ?? 02 F3 0F 11 8F"
address = self.aob_scan(self.pm, self.process_name, signature)
if not address:
messagebox.showerror("Error", "Сигнатура не найдена")
return
self.patch_memory(self.pm, address, b"\x74")
self.disable_zoom_button.config(state='disabled')
self.enable_zoom_button.config(state='normal')
except Exception as e:
messagebox.showerror("Error", f"Ошибка при отключении zoom hack: {e}")
def enable_visibility(self):
try:
signature = "41 ?? ?? ?? ?? 74 ?? 0f ?? ?? eb ?? 41 ?? ?? ?? ba ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? e8 ?? ?? ?? ?? 8b ?? 49 ?? ?? e8 ?? ?? ?? ?? 48 ?? ?? 74 ?? 4C ?? ?? EB ?? 4C ?? ?? 41 ?? ?? ?? ?? 74 ??"
address = self.aob_scan(self.pm, self.process_name, signature)
if not address:
messagebox.showerror("Error", "Сигнатура не найдена")
return
self.patch_memory(self.pm, address + 5, b"\x75") # visibility_fully_revealed+5
self.patch_memory(self.pm, address + 0x3D, b"\x75") # visibility_fully_revealed+3D
self.enable_visibility_button.config(state='disabled')
self.disable_visibility_button.config(state='normal')
except Exception as e:
messagebox.showerror("Error", f"Ошибка при включении visibility hack: {e}")
def disable_visibility(self):
try:
signature = "41 ?? ?? ?? ?? 74 ?? 0f ?? ?? eb ?? 41 ?? ?? ?? ba ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? e8 ?? ?? ?? ?? 8b ?? 49 ?? ?? e8 ?? ?? ???"
address = self.aob_scan(self.pm, self.process_name, signature)
if not address:
messagebox.showerror("Error", "Сигнатура не найдена")
return
self.patch_memory(self.pm, address + 5, b"\x74") # visibility_fully_revealed+5
self.patch_memory(self.pm, address + 0x3D, b"\x74") # visibility_fully_revealed+3D
self.disable_visibility_button.config(state='disabled')
self.enable_visibility_button.config(state='normal')
except Exception as e:
messagebox.showerror("Error", f"Ошибка при отключении visibility hack: {e}")
def create_gui(self):
self.root = tk.Tk()
self.root.title("Settings")
frame = tk.Frame(self.root)
frame.pack(pady=10, padx=10)
# HP settings
tk.Label(frame, text="HP (%)").grid(row=1, column=0, padx=5, pady=5)
self.heal_hp_entry = tk.Entry(frame)
self.heal_hp_entry.grid(row=1, column=1, padx=5, pady=5)
self.heal_hp_entry.insert(0, str(self.heal_hp))
# MP settings
tk.Label(frame, text="MP (%)").grid(row=2, column=0, padx=5, pady=5)
self.heal_mp_entry = tk.Entry(frame)
self.heal_mp_entry.grid(row=2, column=1, padx=5, pady=5)
self.heal_mp_entry.insert(0, str(self.heal_mp))
# Control buttons
button_frame = tk.Frame(frame)
button_frame.grid(row=3, column=0, columnspan=2, pady=10)
self.start_button = tk.Button(button_frame, text="Start", command=self.start)
self.start_button.pack(side=tk.LEFT, padx=5)
self.stop_button = tk.Button(button_frame, text="Stop", command=self.stop, state='disabled')
self.stop_button.pack(side=tk.LEFT, padx=5)
# Zoom Hack Buttons
zoom_frame = tk.Frame(frame)
zoom_frame.grid(row=4, column=0, columnspan=2, pady=10)
self.enable_zoom_button = tk.Button(zoom_frame, text="Enable Zoom Hack", command=self.enable_zoom)
self.enable_zoom_button.pack(side=tk.LEFT, padx=5)
self.disable_zoom_button = tk.Button(zoom_frame, text="Disable Zoom Hack", command=self.disable_zoom,
state='disabled')
self.disable_zoom_button.pack(side=tk.LEFT, padx=5)
# Visibility Hack Buttons
visibility_frame = tk.Frame(frame)
visibility_frame.grid(row=5, column=0, columnspan=2, pady=10)
self.enable_visibility_button = tk.Button(visibility_frame, text="Enable Map Hack",
command=self.enable_visibility)
self.enable_visibility_button.pack(side=tk.LEFT, padx=5)
self.disable_visibility_button = tk.Button(visibility_frame, text="Disable Map Hack",
command=self.disable_visibility, state='disabled')
self.disable_visibility_button.pack(side=tk.LEFT, padx=5)
def run(self):
self.root.mainloop()
if __name__ == "__main__":
bot = AutoBot()
bot.run()