zelzagt / gt-automator Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Why? This code is not even properly obfuscated. Base64 is not an obfuscation method. By simply removing the exec(), then printing it out, you can retrieve the original code.
And by attempting to obfuscate code, this makes people want to reverse engineer it. This code was vetted and does not seem to steal credentials, which lives up to it's title of "Free & Safe".
The original code is:
from filedialogs import save_file_dialog, open_file_dialog
import DearPyGui_DragAndDrop as dpg_dnd
import dearpygui.dearpygui as dpg
import pygetwindow as gw
import subprocess
import pyautogui
import threading
import psutil
import ctypes
import time
import sys
import io
import os
def clear():
os.system("cls" if os.name == "nt" else "clear")
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
def is_process_running(process_name):
for process in psutil.process_iter(['pid', 'name']):
if process.info['name'] == process_name:
return True
return False
def focus_window(window_title):
try:
windows = gw.getWindowsWithTitle(window_title)
if windows:
target_window = windows[0]
target_window.activate()
return True
else:
print(f"Window '{window_title}' not found")
return False
except Exception as e:
print(e)
def run_process(process_path):
process_name = process_path.split("\\")[-1] # Extract process name from path
if is_process_running(process_name):
print(f"{process_name} is already running")
return True
try:
subprocess.Popen(process_path)
time.sleep(5)
print(f"{process_path} started")
return True
except Exception as e:
print(e)
def terminate_process(process_name):
for process in psutil.process_iter(['pid', 'name']):
if process.info['name'] == process_name:
pid = process.info['pid']
try:
psutil.Process(pid).terminate()
print(f"Successfully terminated the process: {process_name}")
return True
except psutil.NoSuchProcess as e:
print(e)
return False
def get_pid_by_process_name(process_name):
for process in psutil.process_iter(['pid', 'name']):
if process.info['name'] == process_name:
return process.info['pid']
return None
def find_image(image_path):
try:
location = pyautogui.locateOnScreen(image_path)
if location is not None:
print("Image found")
return True
else:
print("Image not found")
return False
except Exception as e:
print(e)
def click_image(image_path):
try:
location = pyautogui.locateOnScreen(image_path)
if location is not None:
center_x, center_y = pyautogui.center(location)
pyautogui.click(center_x, center_y)
print("Image found and clicked")
time.sleep(1)
return True
else:
print("Image not found")
return False
except Exception as e:
print(e)
def click_image_with_offset(image_path, x_offset):
try:
location = pyautogui.locateOnScreen(image_path)
if location is not None:
center_x, center_y = pyautogui.center(location)
center_x += x_offset
pyautogui.click(center_x, center_y)
print(f"Image found and clicked with a {x_offset} offset")
time.sleep(1)
return True
else:
print("Image not found")
return False
except Exception as e:
print(e)
def show_save():
def get_data(content, name):
try:
c = content.split(name)
if len(c) > 1:
length = ord(c[1][0])
return ''.join(c[1][4 + x] for x in range(length))
else:
return
except Exception as e:
return e
def read():
try:
with io.open(save_dat_path) as file:
content = file.read()
if content:
content = content.replace("tankid_password_chk2", "")
grow_id = get_data(content, attr[0])
last_world = get_data(content, attr[2])
encoded_password = get_data(content, attr[1])
return grow_id, encoded_password, last_world
except Exception as e:
return e
attr = ["tankid_name", "tankid_password", "lastworld"]
while True:
grow_id = None
password = None
world = None
if os.path.exists(save_dat_path):
try:
save = read()
grow_id = save[0]
password = save[1]
password = len(password) * "*"
world = save[2]
except:
pass
else:
pass
dpg.set_value("save_dat_grow_id", grow_id)
dpg.set_value("save_dat_password", password)
dpg.set_value("save_dat_world", world)
time.sleep(10)
def login_save_dat():
try:
if os.path.exists(save_dat_path):
# save.dat exists
if is_process_running(growtopia_file):
# gt running
focus_window(growtopia_window)
click_image(play_online_image)
click_image(cancel_image)
if not find_image(connect_image):
click_image(x_image)
click_image(back_image)
if click_image(menu_image):
click_image(exit_world_image)
click_image(back_image)
if not find_image(connect_image):
# if not in login screen terminate & retry
terminate_process(growtopia_file)
login_save_dat()
return
else:
# gt not running
run_process(growtopia_exe_path)
time.sleep(10)
focus_window(growtopia_window)
click_image(play_online_image)
# login
click_image(no_have_grow_id_image) # If 'I have a GrowID' is not selected
click_image(connect_image)
else:
e = f"'{save_dat_path}' not found"
print(e)
dpg.set_value("popup_text", e)
dpg.show_item("popup")
except Exception as e:
print(e)
dpg.set_value("popup_text", e)
dpg.show_item("popup")
def login_custom():
try:
if is_process_running(growtopia_file):
# gt running
focus_window(growtopia_window)
click_image(play_online_image)
click_image(cancel_image)
if not find_image(connect_image):
click_image(x_image)
click_image(back_image)
if click_image(menu_image):
click_image(exit_world_image)
click_image(back_image)
if not find_image(connect_image):
# not in login screen: terminate & retry
terminate_process(growtopia_file)
login_custom()
return
else:
# gt not running
run_process(growtopia_exe_path)
time.sleep(10)
focus_window(growtopia_window)
click_image(play_online_image)
# login
grow_id = dpg.get_value("custom_grow_id")
password = dpg.get_value("custom_password")
if password:
click_image(no_have_grow_id_image) # If 'I have a GrowID' is not selected
click_image_with_offset(grow_id_image, 200)
for _ in range(24):
pyautogui.keyDown('backspace')
pyautogui.typewrite(grow_id, interval=0.1)
click_image_with_offset(password_image, 250)
for _ in range(24):
pyautogui.keyDown('backspace')
pyautogui.typewrite(password, interval=0.1)
click_image(connect_image)
else:
click_image(have_grow_id_image) # If 'I have a GrowID' is selected
click_image_with_offset(name_image, 200)
for _ in range(24):
pyautogui.keyDown('backspace')
pyautogui.typewrite(grow_id, interval=0.1)
click_image(connect_image)
except Exception as e:
print(e)
dpg.set_value("popup_text", f"Error: {e}")
dpg.show_item("popup")
def spam():
if is_process_running(growtopia_file):
focus_window(growtopia_window)
text = str(dpg.get_value("spam_text"))
delay = float(dpg.get_value("spam_delay"))
interval = float(dpg.get_value("spam_interval"))
duration = float(dpg.get_value("spam_duration"))
end_time = time.time() + duration
counter = 0
while time.time() < end_time:
try:
click_image(chat_image)
pyautogui.typewrite(text, interval=interval)
pyautogui.press("enter")
counter += 1
time.sleep(delay)
except Exception as e:
print(e)
dpg.set_value("popup_text", f"Typed {counter} times in {duration}s")
dpg.show_item("popup")
else:
dpg.set_value("popup_text", "Growtopia is not running")
dpg.show_item("popup")
def exec_code():
try:
code = dpg.get_value("code")
exec(code)
except Exception as e:
print(e)
dpg.set_value("popup_text", e)
dpg.show_item("popup")
def clear_code():
dpg.set_value("code", "")
clear()
def open_file():
try:
open_path = open_file_dialog()
if open_path:
with open(open_path, "r") as f:
content = f.read()
dpg.set_value("code", content)
except Exception as e:
print(e)
dpg.set_value("popup_text", e)
dpg.show_item("popup")
def save_file():
try:
open_path = save_file_dialog()
if open_path:
with open(open_path, "w") as f:
f.write(dpg.get_value("code"))
except Exception as e:
print(e)
dpg.set_value("popup_text", e)
dpg.show_item("popup")
def say(text):
try:
if is_process_running(growtopia_file):
focus_window(growtopia_window)
click_image(chat_image)
pyautogui.typewrite(text, interval=0.1)
pyautogui.press("enter")
print(f"Typed {text}")
except Exception as e:
print(e)
def move(direction, blocks):
try:
if is_process_running(growtopia_file):
focus_window(growtopia_window)
if find_image(menu_image) is True:
key_mapping = {"up": "up", "down": "down", "left": "left", "right": "right"}
key = key_mapping[direction]
try:
for _ in range(blocks):
pyautogui.keyDown(key)
if blocks <= 1:
time.sleep(0.07)
else:
time.sleep(0.04)
pyautogui.keyUp(key)
print(f"Moved {direction.upper()} {blocks}")
except Exception as e:
print(e)
finally:
pyautogui.keyUp(key)
except Exception as e:
print(e)
def go(world_name):
try:
if is_process_running(growtopia_file):
focus_window(growtopia_window)
click_image(menu_image)
click_image(exit_world_image)
click_image_with_offset(world_name_image, 500)
for _ in range(24):
pyautogui.keyDown('backspace')
pyautogui.keyUp('backspace')
pyautogui.typewrite(world_name, interval=0.1)
click_image(enter_world_image)
except Exception as e:
print(e)
def main():
with dpg.window(tag="Primary Window"):
dpg.bind_font("ttf-font")
with dpg.tab_bar():
with dpg.tab(label="Login"):
dpg.add_spacer(indent=1)
with dpg.group(pos=(96, 48)):
dpg.add_spacing(count=11)
dpg.add_input_text(tag="custom_grow_id", hint="<GrowID>")
dpg.add_spacer(indent=1)
dpg.add_input_text(password=False, tag="custom_password", hint="<password>")
with dpg.tooltip("custom_password"):
dpg.add_text("Special characters aren't supported\nLeave empty if u want to use Guest Account")
dpg.add_spacer(indent=1)
with dpg.group(horizontal=True):
dpg.add_button(label="Login Save", width=185, callback=login_save_dat)
dpg.add_button(label="Login Custom", width=185, callback=login_custom)
with dpg.tab(label="Executor"):
dpg.add_spacer(indent=1)
commands = """say('text')
move('up/right/left')
go('world_name')
find_image('image_path')
click_image('image_path')
click_image_with_offset('image_path', x_offset)
run_process(growtopia_file)
focus_window(growtopia_window)
is_process_running(growtopia_file)"""
dpg.add_input_text(multiline=True, tag="code", width=568, height=177, default_value=commands)
with dpg.group(horizontal=True, xoffset=143):
dpg.add_button(label="EXECUTE", width=140, callback=exec_code)
dpg.add_button(label="CLEAR", width=140, callback=clear_code)
dpg.add_button(label="OPEN", width=140, callback=open_file)
dpg.add_button(label="SAVE", width=140, callback=save_file)
with dpg.tab(label="Spammer"):
dpg.add_spacer(indent=1)
dpg.add_input_text(label="Text", tag="spam_text")
dpg.add_input_int(label="Delay", default_value=20, tag="spam_delay")
with dpg.tooltip("spam_delay"):
dpg.add_text("Waiting time per message")
dpg.add_input_float(label="Interval", default_value=0.2, tag="spam_interval")
with dpg.tooltip("spam_interval"):
dpg.add_text("Typing speed")
dpg.add_input_int(label="Duration", tag="spam_duration", default_value=45)
with dpg.tooltip("spam_duration"):
dpg.add_text("Spam time")
dpg.add_button(label="START", width=378, callback=spam)
with dpg.window(modal=True, pos=(100, 100), show=False, tag="popup", label="Popup"):
dpg.add_text(tag="popup_text")
with dpg.window(no_scrollbar=True, no_close=True, no_resize=True, collapsed=True, label="Status", pos=(379, 4), no_move=True):
with dpg.child_window(width=182, height=104, no_scrollbar=True):
with dpg.texture_registry(show=False):
dpg.add_static_texture(width=account_width, height=account_height, default_value=account_data,
tag="account_texture")
with dpg.texture_registry(show=False):
dpg.add_static_texture(width=password_width, height=password_height,
default_value=password_data,
tag="password_texture")
with dpg.texture_registry(show=False):
dpg.add_static_texture(width=world_width, height=world_height, default_value=world_data,
tag="world_texture")
dpg.add_image("account_texture", pos=(6, 10))
dpg.add_image("password_texture", pos=(6, 40))
dpg.add_image("world_texture", pos=(6, 70))
dpg.add_text("GrowID", pos=(40, 8), tag="save_dat_grow_id")
dpg.add_text("Password", pos=(40, 38), tag="save_dat_password")
dpg.add_text("World", pos=(40, 69), tag="save_dat_world")
def set_global_theme():
with dpg.font_registry():
dpg.add_font("fonts\\Roboto-Medium.ttf", 16, tag="ttf-font")
with dpg.theme() as global_theme:
with dpg.theme_component(dpg.mvAll):
dpg.add_theme_style(dpg.mvStyleVar_WindowRounding, 3)
dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, 3)
dpg.add_theme_style(dpg.mvStyleVar_GrabRounding, 3)
dpg.add_theme_style(dpg.mvStyleVar_TabRounding, 3)
dpg.add_theme_style(dpg.mvStyleVar_ChildRounding, 3)
dpg.add_theme_style(dpg.mvStyleVar_PopupRounding, 3)
dpg.add_theme_style(dpg.mvStyleVar_ScrollbarRounding, 3)
dpg.add_theme_style(dpg.mvStyleVar_FramePadding, 6, 6)
dpg.add_theme_color(dpg.mvThemeCol_TabActive, (51, 105, 173))
dpg.add_theme_color(dpg.mvThemeCol_Tab, (43, 80, 131))
dpg.add_theme_color(dpg.mvThemeCol_WindowBg, (21, 22, 23))
dpg.add_theme_color(dpg.mvThemeCol_FrameBg, (32, 50, 77))
dpg.add_theme_color(dpg.mvThemeCol_Button, (39, 73, 114))
dpg.bind_theme(global_theme)
def drop(data, keys):
if isinstance(data, list):
data = data[0]
with open(data, "r") as file:
content = file.read()
dpg.set_value("code", content)
if __name__ == "__main__":
clear()
os.chdir(os.getcwd())
admin_required = False
if admin_required is True:
if not is_admin():
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
sys.exit()
growtopia_file = "Growtopia.exe"
growtopia_window = "Growtopia"
growtopia_path = os.path.join(os.path.expanduser("~"), "AppData", "Local", "Growtopia")
growtopia_exe_path = os.path.join(growtopia_path, "Growtopia.exe")
save_dat_path = os.path.join(growtopia_path, "save.dat")
# Images
menu_image = f"{os.getcwd()}\\images\\gt\\Menu.png"
exit_world_image = f"{os.getcwd()}\\images\\gt\\Exit World.png"
back_image = f"{os.getcwd()}\\images\\gt\\Back.png"
no_have_grow_id_image = f"{os.getcwd()}\\images\\gt\\I don't have a GrowID.png"
have_grow_id_image = f"{os.getcwd()}\\images\\gt\\I have a GrowID.png"
play_online_image = f"{os.getcwd()}\\images\\gt\\Play Online.png"
connect_image = f"{os.getcwd()}\\images\\gt\\Connect.png"
grow_id_image = f"{os.getcwd()}\\images\\gt\\GrowID.png"
password_image = f"{os.getcwd()}\\images\\gt\\Password.png"
name_image = f"{os.getcwd()}\\images\\gt\\Name.png"
x_image = f"{os.getcwd()}\\images\\gt\\x.png"
cancel_image = f"{os.getcwd()}\\images\\gt\\Cancel.png"
chat_image = f"{os.getcwd()}\\images\\gt\\Chat.png"
enter_world_image = f"{os.getcwd()}\\images\\gt\\Enter World.png"
world_name_image = f"{os.getcwd()}\\images\\gt\\World Name.png"
# 0_0 #
account_width, account_height, account_channels, account_data = dpg.load_image("images\\icons\\account.png")
password_width, password_height, password_channels, password_data = dpg.load_image("images\\icons\\password.png")
world_width, world_height, world_channels, world_data = dpg.load_image("images\\icons\\world.png")
dpg.create_context()
dpg_dnd.initialize()
dpg_dnd.set_drop(drop)
width = 600
height = 300
set_global_theme()
main()
thread = threading.Thread(target=show_save)
thread.start()
# demo.show_demo()
dpg.create_viewport(title='GrowPY', width=width, max_width=width, min_width=width, height=height, max_height=height, min_height=height, clear_color=(115, 140, 152))
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_primary_window("Primary Window", True)
dpg.start_dearpygui()
dpg.destroy_context()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.