Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import random
- import time
- import logging
- import threading
- from urllib.parse import urljoin
- from colorama import Fore, init
- import pystyle
- from seleniumwire import webdriver
- import undetected_chromedriver as uc
- from selenium.webdriver.common.by import By
- from selenium.webdriver.common.action_chains import ActionChains
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException, InvalidSessionIdException, WebDriverException, MoveTargetOutOfBoundsException, ElementNotInteractableException
- init(autoreset=True)
- # ====================== LOGGING ======================
- logging.basicConfig(
- level=logging.INFO,
- format='%(asctime)s | %(levelname)s | %(message)s',
- handlers=[
- logging.FileHandler('mega_bot.log', encoding='utf-8'),
- logging.StreamHandler()
- ]
- )
- # ====================== CONFIG YÜKLE ======================
- try:
- with open('config.json', 'r', encoding='utf-8') as f:
- config = json.load(f)
- except FileNotFoundError:
- logging.critical("config.json bulunamadı!")
- exit(1)
- # ====================== GLOBAL ======================
- proxy_pool = config.get("proxy_list", [])
- domains = config.get("domains", [config.get("domain", "")]) # domains yoksa domain'ı liste yap
- ga_code = config["ga4_code"]
- proxy_lock = threading.Lock()
- current_proxy_index = 0
- banned_proxies = set() # Başarısız proxy'leri geçici olarak banla
- min_wait_success = config.get("min_wait_success", 60)
- max_wait_success = config.get("max_wait_success", 300)
- # ====================== BANNER ======================
- def banner():
- print(pystyle.Colorate.Vertical(pystyle.Colors.blue_to_cyan, f"""
- ╔═══════════════════════════════════════════════════════════════╗
- ║ MEGA ORGANİK BOT v20.9 – 5-15 DK | 16+ DAVRANIŞ ║
- ║ Siteler: {', '.join(domains[:3])}... | {len(domains)} Domain ║
- ║ SCROLL | HOVER | CLICK | BACK | TAB | FORM | VIDEO | IMG ║
- ║ ZOOM | COPY | RIGHT-CLICK | REFRESH | SEARCH | GA4 ║
- ║ + 404/403 TESPİT | SITEMAP FİLTRE | RETRY | SAFE-FILT ║
- ║ + MOBILE SWIPE | MOUSE MOVE | TEXT SELECT | PINCH ZOOM║
- ║ | DOUBLE CLICK | WHEEL SCROLL | SAFE QUIT ║
- ║ | TÜRK USER AGENT | %100 TR TRAFİK ║
- ║ | KEYBOARD INPUT | BOTTOM SCROLL | EXTRA HOVER ║
- ║ | SAFE OFFSET | INTERACT CHECK | EXTRA RETRY ║
- ║ | MOBILE %90 | BACKOFF SLEEP ║
- ╚═══════════════════════════════════════════════════════════════╝
- """))
- print(f"{Fore.GREEN}Bot başlatılıyor... [{config.get('threads', 1)} thread]{Fore.RESET}\n")
- # ====================== PROXY ROTASYONU ======================
- def get_next_proxy():
- global current_proxy_index
- with proxy_lock:
- if not proxy_pool:
- logging.warning("Proxy yok → Direkt bağlantı")
- return None, None
- available_proxies = [p for i, p in enumerate(proxy_pool) if i not in banned_proxies]
- if not available_proxies:
- banned_proxies.clear() # Tümünü sıfırla eğer hepsi banlandıysa
- available_proxies = proxy_pool
- proxy = available_proxies[current_proxy_index % len(available_proxies)]
- current_proxy_index += 1
- user = proxy["user"]
- password = proxy["pass"]
- host = proxy["host"]
- port = proxy["port"]
- proxy_url = f"http://{user}:{password}@{host}:{port}"
- logging.info(f"{Fore.CYAN}Yeni Proxy → {host}:{port}{Fore.RESET}")
- return proxy_url, proxy
- # ====================== USER AGENT GENERATOR ======================
- def generate_user_agent():
- is_mobile = random.random() < 0.9 # Mobil yoğunluğu %90'a çıkarıldı
- if is_mobile:
- screen_res = random.choice(["360x740", "375x812", "414x896", "390x844", "412x915", "480x853", "320x568", "411x823", "360x640", "768x1024"])
- platform = random.choice(["Android", "iOS"])
- browser = random.choice(["Chrome Mobile", "Mobile Safari", "Samsung Internet", "Opera Mini", "UC Browser", "QQ Browser",
- "Baidu Browser", "Firefox Mobile", "Edge Mobile", "DuckDuckGo Browser", "Puffin Browser",
- "Vivaldi Mobile", "Brave Mobile", "Yandex Browser Mobile", "Naver Whale"])
- else:
- screen_res = random.choice(["1920x1080", "1366x768", "1536x864", "2560x1440", "3840x2160", "1440x900", "1280x720"])
- platform = random.choice(["Windows", "MacOS", "Linux", "ChromeOS", "FreeBSD", "OpenBSD", "Solaris", "Haiku"])
- browser = random.choice(["Chrome", "Firefox", "Safari", "Edge", "Opera", "Brave", "Vivaldi", "Tor Browser", "Waterfox",
- "Pale Moon", "SeaMonkey", "Samsung Internet Browser", "UC Browser", "Yandex Browser",
- "Epic Privacy Browser", "Maxthon", "SlimBrowser", "Avant Browser", "K-Meleon", "Lunascape"])
- # Türk odaklı user agent oluştur
- if platform == "Android":
- ua = f"Mozilla/5.0 (Linux; Android {random.randint(10, 15)}; {random.choice(['SM-G', 'Pixel', 'Redmi', 'Pocophone', 'Huawei', 'Oppo'])} Build/{random.choice(['QP1A', 'RKQ1', 'SKQ1'])}) AppleWebKit/537.36 (KHTML, like Gecko) {browser}/{random.randint(100, 120)}.0 Mobile Safari/537.36"
- elif platform == "iOS":
- ua = f"Mozilla/5.0 (iPhone; CPU iPhone OS {random.randint(15, 18)}_{random.randint(0, 5)} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/{random.randint(15, 18)}.0 Mobile/15E148 Safari/604.1"
- elif platform == "Windows":
- ua = f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) {browser}/{random.randint(100, 120)}.0 Safari/537.36"
- elif platform == "MacOS":
- ua = f"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_{random.randint(13, 15)}_{random.randint(0, 6)}) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/{random.randint(13, 15)}.1.15 Safari/605.1.15"
- else:
- ua = f"Mozilla/5.0 (X11; {platform}; x86_64) AppleWebKit/537.36 (KHTML, like Gecko) {browser}/{random.randint(100, 120)}.0 Safari/537.36"
- logging.info(f"{Fore.CYAN}User Agent: {ua}{Fore.RESET}")
- return ua
- # ====================== DRIVER ======================
- def create_stealth_driver(proxy_url=None):
- options = uc.ChromeOptions()
- options.add_argument('--no-sandbox')
- options.add_argument('--disable-dev-shm-usage')
- options.add_argument('--lang=tr-TR,tr')
- options.add_argument('--window-size=390,844')
- options.add_argument('--disable-blink-features=AutomationControlled')
- options.add_argument('--disable-gpu')
- options.add_argument('--ignore-certificate-errors')
- options.add_argument('--disable-extensions')
- options.add_argument('--disable-plugins')
- options.add_argument('--disable-images')
- seleniumwire_options = {}
- if proxy_url:
- seleniumwire_options = {
- 'proxy': {
- 'http': proxy_url,
- 'https': proxy_url,
- 'no_proxy': 'localhost,127.0.0.1'
- }
- }
- prefs = {
- "profile.default_content_setting_values.notifications": 2,
- "profile.managed_default_content_settings.images": 2
- }
- options.add_experimental_option("prefs", prefs)
- for attempt in range(1):
- try:
- driver = uc.Chrome(
- options=options,
- seleniumwire_options=seleniumwire_options if proxy_url else None,
- headless=config.get("headless", True),
- version_main=config.get("chrome_version", 141)
- )
- driver.implicitly_wait(15)
- ua = generate_user_agent() # Rastgele Türk user agent
- driver.execute_cdp_cmd("Network.setUserAgentOverride", {"userAgent": ua})
- driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
- driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
- "source": """
- Object.defineProperty(navigator, 'webdriver', {get: () => undefined});
- Object.defineProperty(navigator, 'hardwareConcurrency', {get: () => Math.floor(Math.random() * 8) + 2});
- Object.defineProperty(navigator, 'maxTouchPoints', {get: () => Math.floor(Math.random() * 3) + 1});
- Object.defineProperty(navigator, 'languages', {get: () => ['tr-TR', 'tr', 'en-US', 'en']});
- """
- })
- return driver
- except Exception as e:
- logging.error(f"Driver hatası: {e}")
- time.sleep(5)
- return None
- # ====================== GERÇEK CAPTCHA TESPİT ======================
- def is_real_captcha(driver):
- try:
- if driver.find_elements(By.CSS_SELECTOR, "iframe[title='reCAPTCHA'], iframe[src*='recaptcha'], .g-recaptcha, #cf-wrapper"):
- return True
- url = driver.current_url.lower()
- if any(x in url for x in ["consent.google.com", "challenges.cloudflare.com", "captcha", "verify", "interstitial"]):
- return True
- if driver.execute_script("""
- return (
- document.querySelector('div.g-recaptcha') !== null ||
- document.querySelector('#recaptcha') !== null ||
- document.querySelector('.cf-challenge-form') !== null ||
- document.querySelector('#challenge-form') !== null
- );
- """):
- return True
- except: pass
- return False
- def handle_captcha_and_rotate(driver, proxy=None):
- if "checking your browser" in driver.page_source.lower() or "yönlendiriliyorsunuz" in driver.page_source.lower() or "cloudflare" in driver.page_source.lower():
- logging.info(f"{Fore.YELLOW}Kontrol ediliyor... 30s bekleniyor{Fore.RESET}")
- time.sleep(30)
- return False
- if is_real_captcha(driver):
- logging.warning(f"{Fore.RED}GERÇEK CAPTCHA → PROXY BANLANIYOR{Fore.RESET}")
- if proxy:
- proxy_index = proxy_pool.index(proxy)
- banned_proxies.add(proxy_index)
- try: driver.quit()
- except: pass
- time.sleep(10) # Ban sonrası ekstra gecikme
- return True
- return False
- # ====================== GA4 KONTROL ======================
- def is_ga4_tracked(driver):
- try:
- time.sleep(3) # Daha uzun bekle
- logs = driver.get_log('performance')
- for log in logs:
- msg = str(log['message'])
- if 'google-analytics.com/g/collect' in msg and ga_code in msg:
- logging.info(f"{Fore.GREEN}GA4 HİT GÖRÜLDÜ!{Fore.RESET}")
- return True
- except: pass
- return False
- # ====================== STATUS CODE KONTROL ======================
- def check_page_status(driver):
- try:
- requests = [req for req in driver.requests if req.url == driver.current_url and req.response]
- if requests:
- status = requests[-1].response.status_code
- if status in [403, 404]:
- logging.warning(f"{Fore.RED}{status} HATASI TESPİT EDİLDİ → Ana sayfaya dönülüyor{Fore.RESET}")
- return True
- # Alternatif: Sayfa içeriği kontrol
- if "404" in driver.title or "Not Found" in driver.title or "404" in driver.page_source:
- logging.warning(f"{Fore.RED}404 İÇERİK TESPİT EDİLDİ → Ana sayfaya dönülüyor{Fore.RESET}")
- return True
- except:
- pass
- return False
- # ====================== RETRY WRAPPER ======================
- def find_elements_with_retry(driver, by, value, retries=3):
- for _ in range(retries):
- try:
- return driver.find_elements(by, value)
- except (StaleElementReferenceException, InvalidSessionIdException, WebDriverException):
- logging.debug("Stale/Invalid/WebDriver element, retrying...")
- time.sleep(1)
- return []
- def perform_action_with_retry(action_func, retries=3):
- for _ in range(retries):
- try:
- action_func()
- return True
- except (StaleElementReferenceException, NoSuchElementException, InvalidSessionIdException, WebDriverException, MoveTargetOutOfBoundsException, ElementNotInteractableException):
- logging.debug("Stale/NoSuch/Invalid/WebDriver/MoveOutOfBounds/NotInteractable element, retrying...")
- time.sleep(1)
- return False
- # ====================== SAFE ELEMENT COLLECTOR ======================
- def safe_collect_elements(driver, by, value, filter_func=None):
- elements = find_elements_with_retry(driver, by, value)
- safe_elements = []
- for elem in elements:
- try:
- if filter_func and not filter_func(elem):
- continue
- # Ekstra check: Element interactable mı?
- if elem.size['width'] > 0 and elem.size['height'] > 0 and elem.is_enabled():
- safe_elements.append(elem)
- except StaleElementReferenceException:
- continue
- return safe_elements
- # ====================== ULTRA İNSAN DAVRANIŞI (5-15 DK DÖNGÜ) ======================
- def ultra_human_loop(driver, selected_domain):
- start_time = time.time()
- max_duration = random.randint(300, 900) # 5-15 dakika
- visited_urls = set()
- current_url = driver.current_url
- while time.time() - start_time < max_duration:
- try:
- remaining = int(max_duration - (time.time() - start_time))
- logging.info(f"{Fore.CYAN}Kalan: {remaining}s | Sayfa: {current_url[:60]}...{Fore.RESET}")
- # Sayfa status kontrolü
- if check_page_status(driver):
- driver.get(f"https://{selected_domain}")
- time.sleep(random.uniform(5, 10))
- current_url = driver.current_url
- del driver.requests # Requestleri temizle
- continue
- # 1. SCROLL (Daha doğal, yavaş hızlar ekle)
- for _ in range(random.randint(5, 12)):
- scroll_amount = random.randint(150, 800)
- driver.execute_script(f"window.scrollBy(0, {scroll_amount});")
- time.sleep(random.uniform(1.2, 4.5))
- if random.random() < 0.35:
- driver.execute_script(f"window.scrollBy(0, -{scroll_amount // 2});")
- time.sleep(random.uniform(0.8, 2.5))
- # Sayfa sonuna scroll (Yeni)
- if random.random() < 0.3:
- driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
- time.sleep(random.uniform(3, 6))
- # 2. HOVER + CLICK (Daha fazla iç link, derin gezinme, sitemap filtre)
- def link_filter(a):
- href = a.get_attribute("href")
- return (
- href and
- selected_domain in href and
- a.is_displayed() and
- href not in visited_urls and
- not any(x in href.lower() for x in ["javascript", "tel", "whatsapp", "mailto", "login", "logout", "sitemap", ".xml"]) and
- not href.lower().endswith('.xml')
- )
- internal_links = safe_collect_elements(driver, By.TAG_NAME, "a", link_filter)
- if internal_links:
- # Ekstra hover (Rastgele 2-4 link hover, süre varyasyonlu)
- for _ in range(random.randint(2, 4)):
- link_hover = random.choice(internal_links)
- ActionChains(driver).move_to_element(link_hover).pause(random.uniform(0.5, 2.5)).perform()
- time.sleep(random.uniform(0.3, 1.0))
- link = random.choice(internal_links)
- def click_action():
- ActionChains(driver).move_to_element(link).pause(random.uniform(1.0, 3.0)).perform()
- time.sleep(random.uniform(1.5, 4.0))
- link.click()
- if perform_action_with_retry(click_action):
- time.sleep(random.uniform(10, 20))
- new_url = driver.current_url
- if new_url != current_url:
- visited_urls.add(new_url)
- current_url = new_url
- is_ga4_tracked(driver)
- # İç sayfada ekstra scroll ve gezinme
- for _ in range(random.randint(4, 8)):
- driver.execute_script(f"window.scrollBy(0, {random.randint(200, 700)});")
- time.sleep(random.uniform(2.0, 5.5))
- # %25 geri dön
- if random.random() < 0.25:
- driver.back()
- time.sleep(random.uniform(5, 10))
- current_url = driver.current_url
- else:
- # Link yoksa rastgele bir iç sayfa seç (config'e ekleyebilirsiniz, yoksa ana sayfaya dön)
- logging.info(f"{Fore.YELLOW}Link yok → Rastgele iç sayfaya dönülüyor{Fore.RESET}")
- possible_paths = ["/blog", "/hakkinda", "/iletisim", "/urunler", "/hizmetler"] # Örnek iç yollar, config'e ekleyin
- random_path = random.choice(possible_paths)
- driver.get(urljoin(f"https://{selected_domain}", random_path))
- time.sleep(8)
- current_url = driver.current_url
- # 3. FORM ETKİLEŞİMİ (Daha doğal typing, copy-paste ekle)
- def input_filter(inp):
- return inp.is_displayed() and inp.is_enabled() and inp.size['width'] > 0 and inp.size['height'] > 0
- inputs = safe_collect_elements(driver, By.CSS_SELECTOR, "input[type='text'], input[type='search'], textarea", input_filter)
- if inputs and random.random() < 0.45:
- inp = random.choice(inputs)
- def form_action():
- inp.click()
- inp.clear()
- text = "Örnek metin veya anahtar kelime" # Rastgele metin, config'den çekebilirsiniz
- # Copy-paste simülasyonu
- if random.random() < 0.3:
- inp.send_keys(text)
- else:
- for char in text: # Harf harf yaz
- inp.send_keys(char)
- time.sleep(random.uniform(0.08, 0.25))
- time.sleep(random.uniform(2.5, 5))
- if random.random() < 0.6:
- inp.send_keys(Keys.ENTER) # Ara veya gönder
- else:
- inp.clear()
- perform_action_with_retry(form_action)
- # 4. VİDEO İZLEME (Play/pause, seek ekle)
- def video_filter(vid):
- src = vid.get_attribute("src").lower()
- return "youtube" in src or "vimeo" in src
- videos = safe_collect_elements(driver, By.TAG_NAME, "iframe", video_filter)
- if not videos:
- logging.debug(f"{Fore.YELLOW}Video içeriği yok, atlanıyor.{Fore.RESET}")
- for vid in videos:
- if random.random() < 0.4:
- driver.execute_script("arguments[0].scrollIntoView();", vid)
- time.sleep(random.uniform(15, 40)) # Daha uzun izle
- # Simüle play/pause ve seek
- if random.random() < 0.6:
- def video_action():
- ActionChains(driver).move_to_element(vid).click().perform()
- time.sleep(random.uniform(10, 20))
- # Seek simülasyonu (ileri sar)
- ActionChains(driver).move_to_element(vid).key_down(Keys.ARROW_RIGHT).key_up(Keys.ARROW_RIGHT).perform()
- time.sleep(random.uniform(5, 15))
- ActionChains(driver).move_to_element(vid).click().perform()
- perform_action_with_retry(video_action)
- # 5. YENİ SEKME AÇ (Daha sık, birden fazla sekme)
- if random.random() < 0.3 and internal_links:
- for _ in range(random.randint(1, 2)): # 1-2 sekme
- link = random.choice(internal_links)
- driver.execute_script("window.open(arguments[0].href, '_blank');", link)
- driver.switch_to.window(driver.window_handles[-1])
- time.sleep(random.uniform(12, 25))
- is_ga4_tracked(driver)
- driver.close()
- driver.switch_to.window(driver.window_handles[0])
- # 6. SAYFA YENİLE (Daha doğal aralıklar)
- if random.random() < 0.2:
- driver.refresh()
- time.sleep(random.uniform(7, 12))
- # 7. RESİM/BUTON ETKİLEŞİMİ (Right-click, zoom ekle)
- def image_filter(i):
- return i.is_displayed() and i.size['width'] > 0 and i.size['height'] > 0
- images = safe_collect_elements(driver, By.TAG_NAME, "img", image_filter)
- if images and random.random() < 0.35:
- img = random.choice(images)
- actions = ActionChains(driver)
- actions.move_to_element(img).pause(random.uniform(1.2, 3.5))
- if random.random() < 0.4:
- actions.context_click().perform() # Right-click
- if random.random() < 0.3:
- driver.execute_script("arguments[0].style.zoom = '150%';", img) # Zoom in
- time.sleep(2)
- driver.execute_script("arguments[0].style.zoom = '100%';", img) # Zoom out
- actions.perform()
- def button_filter(b):
- return b.is_displayed() and "submit" not in b.get_attribute("type").lower() and b.size['width'] > 0 and b.size['height'] > 0
- buttons = safe_collect_elements(driver, By.CSS_SELECTOR, "button, input[type='button'], input[type='submit']", button_filter)
- if buttons and random.random() < 0.25:
- btn = random.choice(buttons)
- def button_action():
- ActionChains(driver).move_to_element(btn).click().perform()
- perform_action_with_retry(button_action)
- time.sleep(random.uniform(4, 8))
- # 8. SAYFA İÇİ ARAMA (Daha sık)
- if random.random() < 0.15:
- # Ctrl+F simülasyonu
- ActionChains(driver).key_down(Keys.CONTROL).send_keys('f').key_up(Keys.CONTROL).perform()
- time.sleep(1)
- search_box = driver.switch_to.active_element
- search_box.send_keys(random.choice(["anahtar", "kelime", "arama"])) # Rastgele kelime
- time.sleep(random.uniform(3, 6))
- search_box.send_keys(Keys.ESCAPE) # Kapat
- # 9. MOBILE SWIPE (Yeni, mobil trafik için mobil dokunuş simülasyonu)
- if random.random() < 0.5:
- logging.info(f"{Fore.CYAN}Mobil swipe simüle ediliyor...{Fore.RESET}")
- actions = ActionChains(driver)
- # Rastgele swipe yukarı/aşağı
- swipe_direction = random.choice(["up", "down"])
- offset = random.randint(200, 600) if swipe_direction == "up" else -random.randint(200, 600)
- actions.click_and_hold().pause(random.uniform(0.2, 0.5)).move_by_offset(0, offset).pause(random.uniform(0.3, 0.7)).release().perform()
- time.sleep(random.uniform(1.5, 4.0))
- # 10. MOUSE HAREKETLERİ (Rastgele gezinme, bounds güvenli)
- if random.random() < 0.4:
- logging.info(f"{Fore.CYAN}Rastgele mouse hareketi simüle ediliyor...{Fore.RESET}")
- body = driver.find_element(By.TAG_NAME, "body")
- viewport = driver.execute_script("return [window.innerWidth, window.innerHeight];")
- width, height = viewport[0], viewport[1]
- actions = ActionChains(driver)
- for _ in range(random.randint(3, 7)):
- offset_x = random.randint(-width // 2, width // 2) # Göreli offset sınırlı
- offset_y = random.randint(-height // 2, height // 2)
- actions.move_to_element_with_offset(body, offset_x, offset_y).pause(random.uniform(0.5, 1.5)).perform()
- # 11. TEXT SEÇİMİ (Rastgele metin seçimi)
- if random.random() < 0.25:
- paragraphs = safe_collect_elements(driver, By.TAG_NAME, "p")
- if paragraphs:
- p = random.choice(paragraphs)
- actions = ActionChains(driver)
- actions.move_to_element(p).click_and_hold().move_by_offset(random.randint(50, 150), 0).release().perform()
- time.sleep(random.uniform(2, 5))
- # 12. PINCH ZOOM (Mobil zoom simülasyonu)
- if random.random() < 0.2:
- logging.info(f"{Fore.CYAN}Pinch zoom simüle ediliyor...{Fore.RESET}")
- driver.execute_script("document.body.style.zoom = '{}%';".format(random.randint(80, 120)))
- time.sleep(random.uniform(3, 6))
- driver.execute_script("document.body.style.zoom = '100%';")
- # 13. ÇİFT TIKLAMA (Rastgele elemente)
- if random.random() < 0.15:
- elements = safe_collect_elements(driver, By.CSS_SELECTOR, "p, div, span")
- if elements:
- elem = random.choice(elements)
- ActionChains(driver).double_click(elem).perform()
- time.sleep(random.uniform(1, 3))
- # 14. FARE TEKERLEĞİ SCROLL (Wheel simülasyonu)
- if random.random() < 0.3:
- driver.execute_script("window.scrollBy(0, {});".format(random.randint(-300, 300)))
- time.sleep(random.uniform(0.5, 2))
- # 15. RASTGELE KLAVYE GİRİŞİ (Yeni, harf harf doğal)
- if random.random() < 0.1:
- logging.info(f"{Fore.CYAN}Rastgele klavye girişi simüle ediliyor...{Fore.RESET}")
- actions = ActionChains(driver)
- keys = random.choice([Keys.ARROW_DOWN, Keys.ARROW_UP, Keys.PAGE_DOWN, Keys.PAGE_UP])
- for _ in range(random.randint(1, 3)):
- actions.send_keys(keys)
- time.sleep(random.uniform(0.1, 0.3))
- actions.perform()
- time.sleep(random.uniform(1, 3))
- # 16. RASTGELE BEKLEME (Daha uzun pasiflik simüle, varyasyonlu)
- time.sleep(random.uniform(15, 30) + random.uniform(-5, 5))
- except InvalidSessionIdException as e:
- logging.error(f"Invalid session id hatası: {e} → Driver yenileniyor")
- try: driver.quit()
- except: pass
- return # Loop kır ve oturumu bitir, run_session retry yapacak
- except Exception as e:
- logging.error(f"Loop hatası: {e}")
- time.sleep(2) # Kısa gecikme ekle spam önlemek için
- continue
- total_time = int(time.time() - start_time)
- logging.info(f"{Fore.GREEN}OTURUM BİTTİ → {len(visited_urls)} sayfa, {total_time}s{Fore.RESET}")
- # ====================== ANA BOT ======================
- def run_session():
- for attempt in range(10): # Retry sayısı arttırıldı
- proxy_url, proxy = get_next_proxy()
- driver = create_stealth_driver(proxy_url)
- if not driver:
- time.sleep(45)
- continue
- selected_domain = random.choice(domains) # Rastgele domain seç
- start_url = f"https://{selected_domain}"
- try:
- logging.info(f"{Fore.MAGENTA}Deneme {attempt+1}/10 | Domain: {selected_domain}{Fore.RESET}")
- driver.get(start_url)
- time.sleep(random.uniform(20, 30))
- if handle_captcha_and_rotate(driver, proxy):
- continue
- # ULTRA İNSAN DAVRANIŞI BAŞLAT
- ultra_human_loop(driver, selected_domain)
- except InvalidSessionIdException as e:
- logging.error(f"Session hatası: {e} → Retry yapılıyor")
- try: driver.quit()
- except: pass
- time.sleep(2 ** attempt) # Exponential backoff
- continue
- except WebDriverException as e:
- logging.error(f"WebDriver hatası: {e} → Driver yenileniyor")
- try: driver.quit()
- except: pass
- time.sleep(2 ** attempt) # Exponential backoff
- continue
- except Exception as e:
- logging.error(f"Deneme {attempt+1}/10 hatası: {e}")
- try: driver.quit()
- except: pass
- time.sleep(20)
- continue
- try: driver.quit()
- except: pass
- return
- logging.error(f"{Fore.RED}10 deneme başarısız → 90s bekleme{Fore.RESET}")
- time.sleep(90)
- # ====================== THREAD ======================
- def worker():
- while True:
- try:
- run_session()
- time.sleep(random.randint(min_wait_success, max_wait_success))
- except:
- time.sleep(90)
- # ====================== BAŞLAT ======================
- if __name__ == "__main__":
- banner()
- if not domains:
- logging.critical("Domain yok!")
- exit(1)
- for i in range(config.get("threads", 1)):
- t = threading.Thread(target=worker, daemon=True)
- t.start()
- time.sleep(4)
- print(f"{Fore.CYAN}MEGA BOT v20.9 ÇALIŞIYOR | 5-15 DK | 16+ DAVRANIŞ | ÇOKLU DOMAIN | Log: mega_bot.log{Fore.RESET}")
- try:
- while True: time.sleep(1)
- except KeyboardInterrupt:
- print(f"\n{Fore.RED}BOT DURDURULDU.{Fore.RESET}")
Advertisement
Add Comment
Please, Sign In to add comment