import tkinter as tk
from tkinter import messagebox, Scale
import threading
import time
import random
import os
import sys
# HARİCİ MANAGER YOK (Performans Modu)
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# --- Global Değişkenler ---
driver_instance = None
bot_thread = None
is_bot_running_event = threading.Event()
# --- HAFIZA DEĞİŞKENLERİ ---
current_char_index = 0
last_text_content = ""
# ===================================================================
# YARDIMCI FONKSİYON
# ===================================================================
def update_status(message, color):
try:
root.after(0, lambda: status_label.config(text=f"Durum: {message}", fg=color))
except NameError:
print(f"Durum: {message}")
# ===================================================================
# GÖREV 1: TARAYICI AÇ
# ===================================================================
def open_browser_task():
global driver_instance
try:
update_status("Sürücü hazırlanıyor...", "orange")
s = Service()
options = webdriver.ChromeOptions()
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_experimental_option('useAutomationExtension', False)
options.add_experimental_option('excludeSwitches', ['enable-automation'])
driver_instance = webdriver.Chrome(service=s, options=options)
driver_instance.set_window_size(1200, 800)
driver_instance.get("
Linkleri görebilmek için kayıt olmanız gerekmektedir
")
update_status("Tarayıcı hazır. Giriş yap.

", "green")
root.after(0, lambda: open_browser_button.config(state=tk.DISABLED))
root.after(0, lambda: start_typing_button.config(state=tk.NORMAL))
root.after(0, lambda: stop_all_button.config(state=tk.NORMAL))
root.after(0, lambda: restart_button.config(state=tk.NORMAL))
except Exception as e:
update_status(f"Hata: {e}", "red")
root.after(0, lambda: messagebox.showerror("Hata", str(e)))
# ===================================================================
# GÖREV 2: KESİNTİSİZ AKIŞ (TIKLAMA YOK, SİLME YOK)
# ===================================================================
def selenium_typing_task():
global bot_thread, current_char_index, last_text_content
is_bot_running_event.set()
root.after(0, lambda: start_typing_button.config(state=tk.DISABLED))
root.after(0, lambda: reset_task_button.config(state=tk.NORMAL))
try:
if not driver_instance: raise Exception("Tarayıcı yok!")
# --- HAZIRLIK AŞAMASI ---
read_box_xpath = '''//div[contains(@class, "modal") and contains(@class, "show")]//*[contains(@class, "yazilacak-metin")]'''
write_box_xpath = '''//div[contains(@class, "modal") and contains(@class, "show")]//*[contains(@class, "yazilan-metin")]'''
update_status("Elementler aranıyor...", "orange")
try:
yazilacak_metin_elementi = WebDriverWait(driver_instance, 5).until(EC.visibility_of_element_located((By.XPATH, read_box_xpath)))
yazma_elementi = WebDriverWait(driver_instance, 5).until(EC.element_to_be_clickable((By.XPATH, write_box_xpath)))
except:
raise Exception("Yazı kutusu bulunamadı!")
# Metni al
hedef_metin = yazilacak_metin_elementi.get_attribute("value")
if not hedef_metin: hedef_metin = yazilacak_metin_elementi.get_attribute("textContent")
hedef_metin = hedef_metin.strip()
if not hedef_metin:
raise Exception("Metin boş!")
# --- İLK VE TEK TIKLAMA ---
# Sadece başlangıçta bir kere tıklarız. Döngü içinde ASLA tıklamayız.
yazma_elementi.click()
update_status("Odaklandı. Seri yazma başlıyor...

", "green")
total_len = len(hedef_metin)
# --- ANA SONSUZ DÖNGÜ ---
while is_bot_running_event.is_set():
delay_ms = delay_scale.get()
delay_sec = delay_ms / 1000.0
# Eğer durdur butonuna basıldıysa hemen çık
if not is_bot_running_event.is_set():
update_status(f"DURAKLATILDI ({current_char_index}/{total_len})", "orange")
break
# Harfi al ve bas
char = hedef_metin[current_char_index]
try:
yazma_elementi.send_keys(char)
except:
break # Element kaybolduysa (oyun kapandıysa) çık
# Index artır
current_char_index += 1
# --- KRİTİK NOKTA: BAŞA SARMA ---
# Eğer metnin sonuna geldiysek, Enter'a basmadan,
# tıklamadan, silmeden direkt index'i 0 yapıyoruz.
if current_char_index >= total_len:
current_char_index = 0
# İstersen kelimeler arası boşluk bırakması için buraya bir boşluk ekleyebilirsin:
# yazma_elementi.send_keys(" ")
# Hız ayarı
time.sleep(delay_sec * random.uniform(0.9, 1.1))
except Exception as e:
update_status(f"Hata: {e}", "red")
finally:
# Durdurulduğunda veya hata olduğunda butonları aç
root.after(0, lambda: start_typing_button.config(state=tk.NORMAL))
root.after(0, lambda: reset_task_button.config(state=tk.DISABLED))
# ===================================================================
# GUI KONTROL
# ===================================================================
def on_start_typing_click_wrapper():
global bot_thread
if bot_thread and bot_thread.is_alive():
return
bot_thread = threading.Thread(target=selenium_typing_task)
bot_thread.start()
def on_reset_task_click_wrapper():
global bot_thread
is_bot_running_event.clear()
start_typing_button.config(state=tk.NORMAL)
reset_task_button.config(state=tk.DISABLED)
update_status("Durduruluyor...", "orange")
def on_full_reset_click():
global current_char_index, last_text_content
is_bot_running_event.clear()
current_char_index = 0
last_text_content = ""
update_status("Hafıza Silindi.

", "blue")
start_typing_button.config(state=tk.NORMAL)
reset_task_button.config(state=tk.DISABLED)
def on_stop_all_click_wrapper():
global driver_instance
is_bot_running_event.clear()
if driver_instance:
try: driver_instance.quit()
except: pass
root.destroy()
# ===================================================================
# GUI
# ===================================================================
root = tk.Tk()
root.title("Katip V47 (KESİNTİSİZ AKIŞ - NO CLICK)

")
root.geometry("850x300")
tk.Label(root, text="KATİP GRIND BOT (KESİNTİSİZ - NO ENTER)", font=("Arial", 14, "bold")).pack(pady=10)
# Hız
speed_frame = tk.Frame(root)
speed_frame.pack()
tk.Label(speed_frame, text="Hız (ms):").pack(side=tk.LEFT)
delay_scale = Scale(speed_frame, from_=1, to=200, orient=tk.HORIZONTAL, length=300)
delay_scale.set(6)
delay_scale.pack(side=tk.LEFT)
btn_frame = tk.Frame(root)
btn_frame.pack(pady=10)
open_browser_button = tk.Button(btn_frame, text="1. Tarayıcıyı Aç", command=lambda: threading.Thread(target=open_browser_task).start(), bg="#007bff", fg="white", width=15, height=2)
open_browser_button.pack(side=tk.LEFT, padx=5)
start_typing_button = tk.Button(btn_frame, text="2. AKIŞI BAŞLAT", command=on_start_typing_click_wrapper, bg="#28a745", fg="white", width=20, height=2, state=tk.DISABLED)
start_typing_button.pack(side=tk.LEFT, padx=5)
reset_task_button = tk.Button(btn_frame, text="DURDUR", command=on_reset_task_click_wrapper, bg="#ffc107", width=12, height=2, state=tk.DISABLED)
reset_task_button.pack(side=tk.LEFT, padx=5)
restart_button = tk.Button(btn_frame, text="Hafızayı Sıfırla", command=on_full_reset_click, bg="#17a2b8", fg="white", width=15, height=2, state=tk.NORMAL)
restart_button.pack(side=tk.LEFT, padx=5)
stop_all_button = tk.Button(btn_frame, text="Kapat", command=on_stop_all_click_wrapper, bg="#dc3545", fg="white", width=10, height=2)
stop_all_button.pack(side=tk.LEFT, padx=5)
status_label = tk.Label(root, text="Hazır.", fg="gray", font=("Arial", 10))
status_label.pack(pady=5)
root.protocol("WM_DELETE_WINDOW", on_stop_all_click_wrapper)
root.mainloop() al src çocuk adam neresinde virüs var aq selenium kullanıyor