Kodun geliştirilmiş hali;
import threading
import time
import random
import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from fake_useragent import UserAgent
# Fare hareketi simülasyonu
def simulate_mouse_move(driver, element):
driver.execute_script("""
const el = arguments[0];
const rect = el.getBoundingClientRect();
const mouseMove = new MouseEvent('mousemove', {
clientX: rect.left + rect.width/2,
clientY: rect.top + rect.height/2,
bubbles: true
});
el.dispatchEvent(mouseMove);
""", element)
# Form doldurma
def form_doldur(driver, bot_id):
try:
inputs = driver.find_elements(By.TAG_NAME, "input")
textareas = driver.find_elements(By.TAG_NAME, "textarea")
all_fields = inputs + textareas
sahte_veri = {
"name": "Ahmet Bot",
"email": f"bot{random.randint(1000,9999)}@mail.com",
"text": "Bu bir test mesajıdır

"
}
for field in all_fields:
try:
name_attr = (field.get_attribute("name") or "").lower()
field_type = field.get_attribute("type") or "text"
simulate_mouse_move(driver, field)
time.sleep(1)
if "name" in name_attr:
field.send_keys(sahte_veri["name"])
elif "mail" in name_attr:
field.send_keys(sahte_veri["email"])
elif "message" in name_attr or "yorum" in name_attr or "text" in name_attr:
field.send_keys(sahte_veri["text"])
elif field_type == "text":
field.send_keys("Bot verisi")
time.sleep(1)
except:
continue
buttons = driver.find_elements(By.TAG_NAME, "button")
for btn in buttons:
btn_text = btn.text.lower()
if "gönder" in btn_text or "submit" in btn_text or "send" in btn_text:
simulate_mouse_move(driver, btn)
btn.click()
print(f"📩 {bot_id}. bot form gönderdi.")
break
except Exception as e:
print(f"⚠️ {bot_id}. bot form doldururken hata:", e)
# Tüm bot işlemi
def tam_bir_bot(bot_id):
driver = None
try:
print(f"🟢 {bot_id}. bot başlatıldı.")
options = uc.ChromeOptions()
ua = UserAgent().random
options.add_argument(f"--user-agent={ua}")
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--start-maximized")
options.add_argument("--incognito")
driver = uc.Chrome(options=options)
driver.get("https://practicetestautomation.com/practice-test-login/")
time.sleep(2)
# Giriş
driver.find_element(By.ID, "username").send_keys("student")
driver.find_element(By.ID, "password").send_keys("Password123")
driver.find_element(By.ID, "submit").click()
print(f"🔐 {bot_id}. bot giriş yaptı.")
time.sleep(3)
if "Logged In Successfully" in driver.page_source:
print(f"✅ {bot_id}. giriş başarılı.")
# Scroll
for _ in range(3):
scroll_px = random.randint(300, 700)
driver.execute_script(f"window.scrollBy(0, {scroll_px})")
print(f"🖱️ {bot_id}. scroll {scroll_px}px")
time.sleep(random.uniform(1.2, 2.5))
# Rastgele linke tıkla
links = driver.find_elements(By.TAG_NAME, "a")
if links:
link = random.choice(links)
try:
driver.execute_script("arguments[0].scrollIntoView(true);", link)
simulate_mouse_move(driver, link)
time.sleep(1)
link.click()
print(f"👆 {bot_id}. linke tıkladı.")
time.sleep(3)
# Form doldur
form_doldur(driver, bot_id)
except Exception as e:
print(f"⚠️ {bot_id}. link hatası: {e}")
else:
print(f"❌ {bot_id}. giriş başarısız.")
time.sleep(3)
except Exception as e:
print(f"❗ {bot_id}. bot hatası:", e)
finally:
if driver:
driver.quit()
print(f"🔴 {bot_id}. bot kapandı.")
# Ana fonksiyon (1 bot örneği)
if __name__ == "__main__":
tam_bir_bot(bot_id=1)