commit 32517873b32c3399c6f173351dd0514684c67923 Author: pythonkoft Date: Fri Aug 15 20:10:29 2025 +0000 Upload files to "/" new data diff --git a/README.md b/README.md new file mode 100644 index 0000000..83cb7e9 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +ایجاد یک مخزن جدید در خط فرمان +touch README.md +git init +git checkout -b main +git add README.md +git commit -m "first commit" +git remote add origin ssh://git@codeberg.org/Alibig/ea_shadow.git +git push -u origin mains +درج تغییرات مخزن موجود از خط فرمان +git remote add origin ssh://git@codeberg.org/Alibig/ea_shadow.git +git push -u origin main +شسزشسززشسصضبصض1111ب11112211ewg22 \ No newline at end of file diff --git a/main.bat b/main.bat new file mode 100644 index 0000000..701a913 --- /dev/null +++ b/main.bat @@ -0,0 +1,10 @@ +@echo off +pip install -r requirements.txt +python main.py +set /p user_input=Enter something: +echo You entered: %user_input% +pause +pause +pause +pausee2 +pause1 \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..6c53829 --- /dev/null +++ b/main.py @@ -0,0 +1,3809 @@ +import pyautogui,os,time,subprocess,random,pyotp,re,pyperclip +import cv2# +import numpy as np +from pyzbar.pyzbar import decode +import os#test y +import pandas as pd +import requests +import random +import string +import random +import string +from time import * +import os,re +import shutil +import json +from seleniumbase import Driver +from selenium import webdriver +from selenium.webdriver.common.by import By +import requests +from datetime import datetime +from selenium.webdriver.common.keys import Keys +from time import sleep +import pyautogui +from selenium.webdriver.common.action_chains import ActionChains +from selenium.webdriver.common.by import By +import random +import random +import string,multiprocessing +import pyotp +import time +import os +import pytz +from datetime import datetime +import subprocess +import os +import openpyxl +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.common.action_chains import ActionChains +import pyotp +import os +import psycopg2 +from psycopg2.pool import SimpleConnectionPool +from psycopg2 import OperationalError +from typing import List, Optional +from datetime import datetime +import json +import time +import logging +from pickle import FALSE +from time import sleep +from bs4 import BeautifulSoup +import requests +tehran = pytz.timezone('Asia/Tehran') +tehran_time = datetime.now(tehran) +import json,random +import os,sys +import requests +from dotenv import load_dotenv, dotenv_values +load_dotenv() +from datetime import datetime +import pytz +import pandas as pd +import psycopg2 +import time +from typing import List, Optional +import logging +import json +from datetime import datetime +import os +from dotenv import load_dotenv + +import psycopg2 +import time +from typing import List, Optional +import logging +import json +from datetime import datetime +import os + +def get_tehran_time(): + tehran_tz = pytz.timezone('Asia/Tehran') + tehran_time = datetime.now(tehran_tz) + return tehran_time.strftime('%Y-%m-%d %H:%M:%S') + +# استفاده از تابعf +print(get_tehran_time()) + +import psutil + +def kill_tor_browser(): + # جستجو برای پروسه‌های با نام "tor" یا "firefox" (چون Tor معمولاً روی Firefox اجرا میشه) + for proc in psutil.process_iter(['pid', 'name']): + try: + # اگر نام پروسه "tor" یا "firefox" باشه، اون رو می‌بندیم + if 'tor' in proc.info['name'].lower() or 'firefox' in proc.info['name'].lower(): + print(f"پیدا شد: {proc.info['name']} (PID: {proc.info['pid']})") + proc.kill() # بستن پروسه + print(f"پروسه با PID {proc.info['pid']} بسته شد.") + else: + pass + except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): + pass # اگر دسترسی نداریم یا پروسه دیگه‌ای از بین رفته باشه، نادیده می‌گیریم + + print("تمام پروسه‌های مرتبط با تور بررسی شدند.") + +file_data={} + + + +class EmailGroupManager: + def __init__(self, db_config: dict, log_file='logs/email_service.log'): + self.db_config = db_config + + self.pool = None + self.connect() + + def connect(self): + while True: + try: + self.pool = SimpleConnectionPool(minconn=1, maxconn=10, **self.db_config) + if self.pool: + print("اتصال به دیتابیس (با Pool) برقرار شد") + break + except Exception as e: + print(f"اتصال به دیتابیس ناموفق بود: {e} – تلاش مجدد در ۵ ثانیه...") + time.sleep(5) + + def get_connection(self): + try: + conn = self.pool.getconn() + with conn.cursor() as cur: + cur.execute("SELECT 1") + return conn + except Exception as e: + print(f"[get_connection] خطا در گرفتن کانکشن اول: {e}") + self.connect() + + for i in range(3): # سه بار سعی مجدد + try: + conn = self.pool.getconn() + with conn.cursor() as cur: + cur.execute("SELECT 1") + return conn + except Exception as e: + print(f"[get_connection] تلاش مجدد #{i+1} برای گرفتن کانکشن: {e}") + time.sleep(5) + + print("[get_connection] سه بار تلاش کردیم ولی نشد. دیتابیس در دسترس نیست.") + raise Exception("اتصال به دیتابیس ممکن نیست") + + def release_connection(self, conn): + if conn: + self.pool.putconn(conn) + + def get_open_groups_111(self, server_name: str): + while True: + + conn = self.get_connection() + try: + with conn.cursor() as cur: + cur.execute(""" + SELECT * FROM ea_shadow_tactics + WHERE server_name = %s + AND (is_finished IS NULL OR is_finished IS DISTINCT FROM TRUE) + AND (login_status = TRUE OR login_status IS NULL) + AND group_id IS NOT NULL + AND taken_at IS NULL + """, (server_name,)) + return cur.fetchall() + finally: + self.release_connection(conn) + + def get_open_groups_1(self, server_name: str): + conn = self.get_connection() + try: + with conn.cursor() as cur: + cur.execute(""" + SELECT * FROM ea_shadow_tactics + WHERE server_name = %s + AND (is_finished IS NULL OR is_finished IS DISTINCT FROM TRUE) + AND (login_status = TRUE OR login_status IS NULL) + AND group_id IS NOT NULL + AND (backup_code IS NULL OR backup_code = '') + """, (server_name,)) + return cur.fetchall() + finally: + self.release_connection(conn) + + def has_open_group(self, server_name: str) -> bool: + conn = self.get_connection() + try: + with conn.cursor() as cur: + cur.execute(""" + SELECT COUNT(*) FROM ea_shadow_tactics + WHERE server_name = %s + AND (is_finished IS DISTINCT FROM TRUE AND login_status IS DISTINCT FROM FALSE) + AND group_id IS NOT NULL + """, (server_name,)) + return cur.fetchone()[0] > 0 + finally: + self.release_connection(conn) + + def get_next_group_id(self, server_name: str) -> int: + conn = self.get_connection() + try: + with conn.cursor() as cur: + cur.execute(""" + SELECT COALESCE(MAX(group_id), 0) + 1 FROM ea_shadow_tactics + WHERE server_name = %s + """, (server_name,)) + return cur.fetchone()[0] + finally: + self.release_connection(conn) + + def set_taken_at(self, email_id: int): + + + conn = self.get_connection() + + tehran_time = datetime.now(tehran) + tehran_tz = pytz.timezone('Asia/Tehran') + tehran_time = datetime.now(tehran_tz).replace(tzinfo=None) + try: + with conn.cursor() as cur: + cur.execute(""" + UPDATE ea_shadow_tactics + SET taken_at = %s + WHERE id = %s + """, (tehran_time, email_id)) + conn.commit() + print(f"taken_at ست شد برای ایمیل با id={email_id}") + finally: + self.release_connection(conn) + + def assign_new_group_old(self, server_name: str, group_id: int) -> List[dict]: + conn = self.get_connection() + try: + with conn.cursor() as cur: + cur.execute(""" + WITH next_emails AS ( + SELECT id FROM ea_shadow_tactics + WHERE + taken_at IS NULL + AND server_name IS NULL + AND (is_finished IS NULL OR is_finished IS DISTINCT FROM TRUE) + AND login_status IS DISTINCT FROM FALSE + ORDER BY id + LIMIT 5 + FOR UPDATE SKIP LOCKED + ) + UPDATE ea_shadow_tactics + SET taken_at = NOW(), + server_name = %s, + group_id = %s + WHERE id IN (SELECT id FROM next_emails) + RETURNING id, email, email_password, back_up_mail, seler_name, group_id + """, (server_name, group_id)) + rows = cur.fetchall() + conn.commit() + return [ + { + "id": row[0], + "email": row[1], + "email_password": row[2], + "back_up_mail": row[3], + "seler_name": row[4], + "group_id": row[5] + } for row in rows + ] + finally: + self.release_connection(conn) + + def assign_new_group_old_1(self, server_name: str, group_id: int) -> List[dict]: + conn = self.get_connection() + try: + with conn.cursor() as cur: + cur.execute(""" + WITH next_emails AS ( + SELECT id FROM ea_shadow_tactics + WHERE + taken_at IS NULL + AND server_name IS NULL + AND (is_finished IS NULL OR is_finished IS DISTINCT FROM TRUE) + AND login_status IS DISTINCT FROM FALSE + ORDER BY id + LIMIT 5 + FOR UPDATE SKIP LOCKED + ) + UPDATE ea_shadow_tactics + SET + server_name = %s, + group_id = %s + WHERE id IN (SELECT id FROM next_emails) + RETURNING id, email, email_password, back_up_mail, seler_name, group_id + """, (server_name, group_id)) + rows = cur.fetchall() + conn.commit() + return [ + { + "id": row[0], + "email": row[1], + "email_password": row[2], + "back_up_mail": row[3], + "seler_name": row[4], + "group_id": row[5] + } for row in rows + ] + finally: + self.release_connection(conn) + def assign_new_group(self, server_name, group_id): + while True: + try: + + conn = self.get_connection() + with conn.cursor() as cur: + cur.execute( + """ + WITH next_emails AS ( + SELECT id FROM ea_shadow_tactics + WHERE + taken_at IS NULL + AND server_name IS NULL + AND (is_finished IS NULL OR is_finished IS DISTINCT FROM TRUE) + AND login_status IS DISTINCT FROM FALSE + AND (backup_code IS NULL OR backup_code = '') + ORDER BY id + LIMIT 5 + FOR UPDATE SKIP LOCKED + ) + UPDATE ea_shadow_tactics + SET taken_at = NOW(), + server_name = %s, + group_id = %s + WHERE id IN (SELECT id FROM next_emails) + RETURNING id; + """, + (server_name, group_id), + ) + updated_ids = [row[0] for row in cur.fetchall()] + conn.commit() + return updated_ids + finally: + self.release_connection(conn) + def get_group(self, server_name: str) -> List[dict]: + try: + if self.has_open_group(server_name): + print(f"سرور {server_name} هنوز گروه قبلی را کامل نکرده است") + return [] + + group_id = self.get_next_group_id(server_name) + group = self.assign_new_group(server_name, group_id) + + if not group: + print(f"برای سرور {server_name} دیتایی برای تخصیص یافت نشد") + else: + print(f"گروه جدید برای {server_name} ثبت شد. group_id={group_id}") + + return group + + except Exception as e: + print(f"خطا در دریافت گروه برای {server_name}: {e}") + return [] + + def update_login_status(self, email_id: int, success: bool, error_message: Optional[str] = None): + conn = self.get_connection() + try: + with conn.cursor() as cur: + if success: + cur.execute(""" + UPDATE ea_shadow_tactics + SET login_status = TRUE, error_message = NULL + WHERE id = %s + """, (email_id,)) + print(f"ایمیل با id={email_id} با موفقیت لاگین شد.") + else: + cur.execute(""" + UPDATE ea_shadow_tactics + SET login_status = FALSE, error_message = %s + WHERE id = %s + """, (error_message, email_id)) + print(f"ایمیل با id={email_id} لاگین ناموفق داشت. پیام خطا: {error_message}") + conn.commit() + finally: + self.release_connection(conn) + + def append_to_history(self, email_id: int, message: str): + while True: + + + try: + conn = self.get_connection() + with conn.cursor() as cur: + timestamp = datetime.utcnow().isoformat() + cur.execute(""" + UPDATE ea_shadow_tactics + SET history = COALESCE(history, '{}'::jsonb) || %s::jsonb + WHERE id = %s + """, (json.dumps({timestamp: message}), email_id)) + conn.commit() + print(f"history آپدیت شد برای ایمیل id={email_id}") + break + finally: + self.release_connection(conn) + + def mark_email_finished(self, email_id: int, success: bool, backup_code: Optional[str] = None): + + while True: + conn = self.get_connection() + try: + + with conn.cursor() as cur: + cur.execute(""" + UPDATE ea_shadow_tactics + SET is_finished = TRUE, + finished_at = NOW(), + login_status = %s, + backup_code = %s + WHERE id = %s + """, (success, backup_code, email_id)) + conn.commit() + print(f"ایمیل با id={email_id} با وضعیت login_status={success} فینیش شد.") + break + finally: + self.release_connection(conn) + + def mark_email_finished_nime(self, email_id: int, success: bool, backup_code: Optional[str] = None): + while True: + conn = self.get_connection() + try: + + with conn.cursor() as cur: + cur.execute(""" + UPDATE ea_shadow_tactics + SET is_finished = TRUE, + finished_at = NOW(), + login_status = %s, + backup_code = %s + WHERE id = %s + """, (False, 'ea_created__app_code_nead', email_id)) + conn.commit() + print(f"ایمیل با id={email_id} با وضعیت login_status={success} فینیش شد.") + break + finally: + self.release_connection(conn) + +ip_v2ray='http://127.0.0.1:2017' +class pool(): + + def __init__(self) -> None: + self.MAX_IP=[]#['1','2','65',',64'] + self.ip='http://127.0.0.1:2017' + #self.auto=auto + url = f'{ip_v2ray}/api/login' + headers = { + 'Accept': 'application/json, text/plain, */*', + 'Accept-Language': 'fa-IR,fa;q=0.9,en-US;q=0.8,en;q=0.7,fr;q=0.6', + 'Connection': 'keep-alive', + 'Content-Type': 'application/json', + 'Origin': f'{ip_v2ray}', + 'Referer': f'{ip_v2ray}/', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36' + } + + data = { + 'username': 'zxczxc', + 'password': 'zxczxc' + } + + response = requests.post(url, headers=headers, json=data, verify=False) + + + self.heders={'Authorization':json.loads(response.text)["data"]['token']} + def dell_all(self): + while True: + try: + ret=json.loads(requests.get(f'{self.ip}/api/touch', headers=self.heders, verify=False).text)['data']['touch']['servers'] + break + except Exception as e: + print(e) + sst+=1 + if sst==20: + return False + for i in range(0,len(ret)+1): + url = f'{self.ip}/api/touch' + data = { + 'touches': [ + {'id': i, '_type': 'server'}, + + ] + } + #'{"touches":[{"id":1,"_type":"server"}]}' + requests.delete(url, headers=self.heders, json=data) + + sleep(0.5) + while True: + try: + ret=json.loads(requests.get(f'{self.ip}/api/touch', headers=self.heders, verify=False).text)['data']['touch']['servers'] + print(len(ret),'***') + if len(ret)==0: + return True + else: + self.dell_all() + + #input('-------------') + except Exception as e: + print(e) + sst+=1 + if sst==20: + return False + def dell(self): + url = f'{self.ip}/api/touch' + data = { + 'touches': [ + {'id': 1, '_type': 'server'}, + + ] + } + requests.delete(url, headers=self.heders, json=data) + def add_config(self,url): + sst=0 + while True: + try: + return requests.post(f'{self.ip}/api/import',json={"url":url},headers=self.heders).text + except Exception as e: + print(e) + sst+=1 + if sst==20: + return False + + def number_cont(self): + + while True: + try: + url = f'{self.ip}/api/touch' + response = json.loads(requests.get(url, headers=self.heders, verify=False).text)['data']['touch']['servers'] + #return response#.text + break + except Exception as e: + print(e) + pass + for i in response: + if 'ms' in i['pingLatency']: + while True: + try: + ids=i['id'] + response =json.loads(requests.get('%s/api/sharingAddress?touch={"id":%s,"_type":"server"}'%(self.ip,ids), headers=self.heders, verify=False).text)['data']['sharingAddress'] + print(response) + self.MAX_IP.append(response) + #return response#.text + break + except Exception as e: + print(e) + pass + #@self.MAX_IP.append(response) + else: + continue + #http://172.16.0.182:2014/api/sharingAddress?touch={"id":1,"_type":"server"} + # response = requests.get(url, headers=self.heders, verify=False) # اینجا verify=False به عنوان گزینه‌ای برای نادیده گرفتن گواهینامه SSL استفاده شده است. لطفا توجه داشته باشید که این روش امنیتی به خطر افتاده و باید به دلایل امنیتی دقت کنید. + + #return response.text + def chek_config_all(self): + #url = f'{self.ip}/api/httpLatency?whiches=[{xsx}]' + # row=[] + #payload = {'whiches':[row]} + + while True: + try: + ret=json.loads(requests.get(f'{self.ip}/api/touch', headers=self.heders, verify=False).text)['data']['touch']['servers'] + break + except Exception as e: + print(e) + sst+=1 + if sst==20: + return False + + + dataID = "" + for ranger in range(len(ret)): + dataID += f"%7B%22id%22:{ranger+1},%22_type%22:%22server%22,%22sub%22:null%7D," + + url = self.ip+f'/api/httpLatency?whiches=[{dataID}]' + urlss = url[0:-2]+"]" + + res = requests.get(urlss,headers=self.heders).text + print(res) + return res + def chek_config(self): + sleep(2) + #url=f'{self.ip}/api/httpLatency?whiches=\[{"id":1,"_type":"server","sub":null}\]' + url = f'{self.ip}/api/httpLatency?whiches=[%7B%22id%22:1,%22_type%22:%22server%22,%22sub%22:null%7D]' + sdx=0 + while True: + try: + return json.loads(requests.get(url,headers=self.heders).text)['data']['whiches'][0]['pingLatency'] + except Exception as e: + print(e) + sdx+=1 + if sdx==20: + return False + def selct(self): + data = { + 'id': 1, + '_type': 'server', + 'outbound': 'proxy'} + url = f'{self.ip}/api/connection' + + + while True: + try: + return requests.post(url, headers=self.heders, json=data).text + except Exception as e: + print(e) + def run_core(self): + url = f'{self.ip}/api/v2ray' + + + while True: + try: + return requests.post(url, headers=self.heders).text + except Exception as e: + print(e) + def stop_core(self): + url = f'{self.ip}/api/v2ray' + while True: + try: + return requests.delete(url, headers=self.heders).text + except Exception as e: + print(e) + def chek_2_1(self): + #self.dell_all() + self.dell_all() + self.dell_all() + self.dell_all() + while True: + self.dell_all() + self.dell_all() + batch_data = self.read_and_remove_batch_2() + self.dell_all() + print(len(batch_data)) + print('--------') + print('--------') + print('--------') + print('--------') + print('--------') + print('--------') + print('--------') + print('--------') + #input('--------') + for ixc in batch_data: + print(ixc) + bnbs=self.add_config(str(ixc)) + print(bnbs) + if bnbs==False: + self.dell_all() + continue + + sleep(2) + pr=self.chek_config() + print(pr) + if pr==False: + self.dell_all() + continue + if 'ms' in pr: + print(pr,'*******') + print(self.selct()) + sleep(2) + print(self.run_core()) + #input('>xxxxxx>') + return True + self.dell() + def chek_2_2(self,url): + + self.dell_all() + self.dell_all() + self.dell_all() + while True: + + bnbs=self.add_config(str(url)) + if bnbs==False: + self.dell_all() + return 'add_fail' + print('add') + break + pr=self.chek_config_all() + sleep(5) + if pr==False: + self.dell_all() + return 'chek_config_all_fail' + if 'ms' in pr: + print(pr,'*******') + print(self.selct()) + sleep(2) + print(self.run_core()) + #input('>xxxxxx>') + return True + return False + + +class ea_fucking(): + def __init__(self,path_png_file): + self.path_png_file=path_png_file + def qr_code(self): + sleep(3) + pyautogui.screenshot(os.path.join(os.getcwd(),'image.png')) + image_path = "image.png" # مسیر عکس رو مشخص کن + image = cv2.imread(image_path) + + # --- اسکن QR Code --- + qr_codes = decode(image) + try:os.remove("image.png") + except:pass + + for qr in qr_codes: + qr_text = qr.data.decode("utf-8").split('?secret=')[1].split('&issuer=Electronic%20Arts')[0] + print("QR Code Data:", qr_text) + return qr_text + + if not qr_codes: + return False + print("هیچ QR Code‌ای پیدا نشد!") + def top(self,secret): + secret=secret.replace(' ','',100) + + totp = pyotp.TOTP(secret) + + try: + while True: + # Get the current OTP + current_otp = totp.now() + + # Clear the console output + #os.system('cls' if os.name == 'nt' else 'clear') + + # Display the current OTP + print(f"Current OTP: {current_otp}") + return current_otp + + # Show time remaining for the next OTP update (default interval is 30 seconds) + time_remaining = 30 - (int(time.time()) % 30) + print(f"Time remaining: {time_remaining} seconds") + + # Wait 1 second before updating + time.sleep(1) + #input(">>") + + except KeyboardInterrupt: + print("\nProcess stopped by user.") + + + def load_browser_windows(self,path): + # print(codex,'--------------') + print(path) + path=rf'C:\Users\{user_sys}\Desktop\Browser\firefox.exe' + subprocess.Popen([path]) + time.sleep(6) + #pyautogui.press("f11") + # pyautogui.write("https://ea.com") + pyautogui.press("enter") + time.sleep(6) + pyautogui.press("enter") + + + return True + def get_tor(self): + pyautogui.press('enter') + pyautogui.press('enter') + # pyautogui.hotkey('ctrl', 'shift', 'n') + # pyautogui.press("f11") + time.sleep(2) + # pyautogui.write("https://ea.com") + # time.sleep(2) + + #tottotttpyautogui.press("enter") + time.sleep(4) + for i in range(5): + print(os.path.join(self.path_png_file,r'1_dcuk_clik.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'1_dcuk_clik.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'1_1_dcuk_clik.PNG'), confidence=0.8) + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + + if location: + pyautogui.click(pyautogui.center(location)) + + return True + + else: + print("1 تصویر مورد نظر پیدا نشد.") + return False + def disabel(self): + sleep(4) + pyautogui.write("about:config") + pyautogui.press("enter") + # about:config + for i in range(5): + print(os.path.join(self.path_png_file,r'accept.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'accept.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'accept.PNG'), confidence=0.8) + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + + if location: + pyautogui.click(pyautogui.center(location)) + # accept.PNG + pyautogui.write("privacy.firstparty.isolate") + sleep(1) + for i in range(10): + print(os.path.join(self.path_png_file,r'true.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'True.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'true2.PNG'), confidence=0.8) + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + + if location: + pyautogui.click(pyautogui.center(location)) + + sleep(4) + pyautogui.hotkey('ctrl', 't') + sleep(2) + return True + def get_to_ea(self): + + pyautogui.write("https://myaccount.ea.com/cp-ui/security/index") + pyautogui.press("enter") + time.sleep(5) + for i in range(20): + print(os.path.join(self.path_png_file,r'click_gmail.PNG')) + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_make_other_time.PNG'), confidence=0.8) + return 'ea_created__app_code_nead!!' + except: + pass + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'click_gmail.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'click_gmail.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + time.sleep(10) + return True + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + return 'click_gmail' + def clik_extenshen(self,get_cookes): + chek='' + for i in range(20): + print(os.path.join(self.path_png_file,r'extenshen.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'extenshen.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'extenshen.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + + chek=True + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + if chek==True: + pass + else: + return 'extenshen' + chek2='' + for i in range(10): + print(os.path.join(self.path_png_file,r'cookes.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'cookes.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'cookes.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + chek2=True + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + if chek2==True: + pass + else: + return 'cookes' + sleep(20) + chek3='' + for i in range(30): + print(os.path.join(self.path_png_file,r'del.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'del.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'del.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + chek3=True + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + if chek3==True: + pass + else: + return 'del' + sleep(3) + chek4='' + for i in range(10): + print(os.path.join(self.path_png_file,r'import2.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'import2.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'import2.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + chek4=True + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(6) + continue + if chek4==True: + pass + else: + return 'import2' + chunk_size = 100 # تعداد کاراکترهایی که در هر مرحله تایپ می‌شوند + for i in range(0, len(get_cookes), chunk_size): + chunk = get_cookes[i:i + chunk_size] # گرفتن ۵۰ کاراکتر از متن + pyautogui.write(chunk) # تایپ کردن بخش مورد نظر + time.sleep(0.1) # تاخیر برای طبیعی‌تر شد + '''for ixx in get_cookes:y0MAZ24g + + # pyautogui.write(ixx)''' + time.sleep(3) + # input('>>>>>>>>>>>>Sssss') + #time.sleep(4) + chek45='' + for i in range(10): + print(os.path.join(self.path_png_file,r'import2.PNG')) + try: + + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'import2.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'import2.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + chek45=True + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + if chek45==True: + pass + else: + return 'import2' + time.sleep(10) + + pyautogui.hotkey('ctrl', 'r') + + time.sleep(10) + #input('>>>>>>>>>>>>Sssss') + + time.sleep(3) + pyautogui.hotkey('ctrl', 'w') + time.sleep(3) + return True + def click_gmail(self): + sleep(5) + for i in range(20): + print(os.path.join(self.path_png_file,r'click_gmail.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'clik_fail_gmail.PNG'), confidence=0.8) + return + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'click_gmail.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'click_gmail.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + return 'click_gmail' + def chek_logo(self): + cont=0 + for i in range(15): + #fail_mail.PNG + print(os.path.join(self.path_png_file,r'ea_logo.PNG')) + try: + print('start chek') + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'fail_mail.PNG'), confidence=0.8) + if location: + return 'fail_mail' + except: + pass + try: + print('start chek') + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'next.PNG'), confidence=0.8) + if location: + return 'nime' + except: + pass + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'ea_logo.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'ea_logo.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(1) + try: + print('start chek') + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'next.PNG'), confidence=0.8) + if location: + return 'nime' + except: + pass + cont+=1 + if cont>5: + return False + continue + cont+=1 + if cont>5: + return False + try: + print('start chek') + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'next.PNG'), confidence=0.8) + if location: + return 'nime' + except: + pass + + #import pdb;pdb.set_trace() + sleep(6) + pyautogui.press('tab')#, + sleep(1) + pyautogui.press('tab') + sleep(1) + pyautogui.press("enter") + pyautogui.press("enter") + pyautogui.press("enter") + sleep(5) + return True + def continue_page(self): + sleep(20) + for i in range(15): + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'ok_maker.PNG'), confidence=0.8) + if location: + # pyautogui.click(pyautogui.center(location)) + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'ea_logo.PNG'), confidence=0.8) + print('ea_logo boadddddddddd') + except: + return 'nime' + except: + print('nime >>> ok_maker.PNG') + print(os.path.join(self.path_png_file,r'contnue_persain.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'conntinueee.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'continue_en.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(4) + continue + return 'conntinueee' + def input_PATRH(self): + sleep(5) + for i in range(15): + print(os.path.join(self.path_png_file,r'input.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'input.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'input.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + return 'input' + def contuen_page2(self): + sleep(10) + for i in range(15): + print(os.path.join(self.path_png_file,r'contnue_persain.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'conntinueee.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'continue_en.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + return 'contnue_persain' + def next(self): + for i in range(15): + print(os.path.join(self.path_png_file,r'next.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'next.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'next.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + + except Exception as e: + time.sleep(5) + continue + #return True + def accept(self): + sleep(10) + for i in range(1,5): + print(os.path.join(self.path_png_file,r' ========= accept >>> next.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'next.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'next.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + sleep(20) + for i in range(15): + #for i in range(1,4): + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'10_accept.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + except: + print('fail >>> 10_accept.PNG') + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'10_accept_1.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + except: + print('fail >>> 10_accept_1.PNG') + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'10_accept_2.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + except: + print('fail >>> 10_accept_1.PNG') + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'ok_maker.PNG'), confidence=0.8) + if location: + # pyautogui.click(pyautogui.center(location)) + return 'make_other_time' + except: + print('make_other_time >>> ok_maker.PNG') + # 10_accept + return 'fail_10_acceptt' + def creat(self): + for i in range(15): + print(os.path.join(self.path_png_file,r'11_create_account.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'11_create_account.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'11_create_account.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + return 'fail_11_create_account' + def finsh(self): + for i in range(15): + print(os.path.join(self.path_png_file,r'13finsh13.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'13finsh13.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'13finsh13.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + time.sleep(15) + return True + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + return 'fail_13finsh13' + '''input('>>>>>>>>>>>>Sssss') + input('>>>>>>>>>>>>Sssss') + input('>>>>>>>>>>>>Sssss') + pyautogui.hotkey('ctrl', 't') + sleep(1) + pyautogui.write("about:config") + pyautogui.press("enter") + sleep(2) + for i in range(5): + print(os.path.join(self.path_png_file,r'accept.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'accept.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'accept.PNG'), confidence=0.8) + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(3) + continue + + if location: + pyautogui.click(pyautogui.center(location)) + # accept.PNG + pyautogui.write("privacy.firstparty.isolate") + sleep(1) + for i in range(10): + print(os.path.join(self.path_png_file,r'false2.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'false2.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'false.PNG'), confidence=0.8) + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + + if location: + pyautogui.click(pyautogui.center(location)) + #extenshen.PNG + #privacy.firstparty.isolat + # e''' + + def get_seting_sec_1(self): + return True + for i in range(15): + print(os.path.join(self.path_png_file,r'click_hhtt.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'click_hhtt.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'click_hhtt.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + pyautogui.hotkey('ctrl', 'a') + pyautogui.write('https://myaccount.ea.com/cp-ui/security/index') + sleep(1) + pyautogui.press("enter") + return True + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + return 'fail_click_hhtt' + # https://myaccount.ea.com/cp-ui/aboutme/index + + def get_turn_on_2(self,codex,value,val2): + + for i in range(4): + print(os.path.join(self.path_png_file,r'14_tron_on.PNG')) + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_make_other_time.PNG'), confidence=0.8) + return 'ea_created__app_code_nead!!' + except: + pass + + for i in range(4): + print(os.path.join(self.path_png_file,r'chalenge1_find_next.PNG')) + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chalenge1_find_next.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + print(' ok >>> chalenge1_find_next') + #return 'ea_created__app_code_nead!!' + except: + print(' eror >>> chalenge1_find_next') + pass + sleep(30) + for i in range(4): + print(os.path.join(self.path_png_file,r'chalenge1_find_next.PNG')) + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chalenge1_find_next.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + print(' ok >>> chalenge1_find_next') + #return 'ea_created__app_code_nead!!' + except: + print(' eror >>> chalenge1_find_next') + pass + sleep(30) + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chalenge1_find_next.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + print(' chalenge1_find_next >>> EROR') + return 'send_code_page_stoped' + #return 'ea_created__app_code_nead!!' + except: + + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_2.PNG'), confidence=0.8) + if location: + return True + except:pass + codex.end() + codex=Gmail(value,val2,browser_proxy=browser_proxy) + codes='' + for isx in range(4): + if self.dicline()=='Internal Server Error':return 'Internal Server Error'#=='Internal Server Error':return 'Internal Server Error' + for i in range(2): + try: + + code=codex.get_code()#str(re.findall(pattern=r'Your EA Security Code is: \w*',string=copied_text)[0]).replace('Your EA Security Code is: ','') + if 'ALERT_to_mnay_code_chek'==code: + return 'ALERT_to_mnay_code_chek' + if code=='continue': + codex.end() + codexs=Gmail(value,val2,browser_proxy=browser_proxy) + code=codexs.get_code() + if 'ALERT_to_mnay_code_chek'==code: + return 'ALERT_to_mnay_code_chek' + if code=='continue': + continue + codes=True + codes=True + #break + #codex.end() + + except: + codex.end() + codex=Gmail(value,val2,browser_proxy=browser_proxy) + print('eror') + #import pdb;pdb.set_trace() + print('break_one') + if codes==True: + pass + else: + return 'fail_get_code_new_EROR' + for i in code: + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'6code_.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + except: + pass + pyautogui.write(i) + sleep(0.5) + pyautogui.press('enter') + sleep(15) + ################ + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek____true_1.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek____true_2.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek____true_3.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek____true_4.PNG'), confidence=0.8) + if location: + return True + except: + pass + ################ + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_2.PNG'), confidence=0.8) + if location: + return True + except:pass + sleep(5) + print('start >>> chek_True_1') + if self.dicline()=='Internal Server Error':return 'Internal Server Error' + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + return True + except:pass + print('fail >>> chek_True_1') + print('start >>> chek_True_2') + if self.dicline()=='Internal Server Error':return 'Internal Server Error' + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_2.PNG'), confidence=0.8) + if location: + return True + except:pass + print('fail >>> chek_True_1') + if self.dicline()=='Internal Server Error':return 'Internal Server Error' + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_eror.PNG'), confidence=0.8) + if location: + pass + else: + sleep(10) + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + return True + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_2.PNG'), confidence=0.8) + if location: + return True + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_eror.PNG'), confidence=0.8) + if location: + pass + else: + return True + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + return True + sleep(2) + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_2.PNG'), confidence=0.8) + if location: + return True + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_2.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_2.PNG'), confidence=0.8) + if location: + return True + except:pass + ################################### + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek____true_1.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek____true_2.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek____true_3.PNG'), confidence=0.8) + if location: + return True + except:pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek____true_4.PNG'), confidence=0.8) + if location: + return True + except:pass + ##################################### + if self.dicline()=='Internal Server Error':return 'Internal Server Error' + codex.end() + codex=Gmail(value,val2,browser_proxy=browser_proxy) + return 'fail_14_tron_on' + def get_send_sec_3(self): + sleep(10) + if self.dicline()=='Internal Server Error': + return 'Internal Server Error' + for i in range(10): + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'14_tron_on.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + except: + pass + + ''' + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1_2.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + print('click it chek_True_1') + except: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + print('click it chek_True_1') + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + print('click it chek_True_1') + except: + pass + if location: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + print('click it chek_True_1') + for i in range(6): + pyautogui.press('tab') + sleep(0.5) + pyautogui.press('enter') + # return True + #https://e1_1_dcuk_clik.PNG + sleep(10) + for i in range(10): + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'send_code_new.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + + return True + + except: + pass + except Exception as e: + print(e) + time.sleep(5) + continue + import pdb;pdb.set_trace()''' + check_images = ['chek_True_1_2.PNG', 'chek_True_1.PNG'] + + # تلاش برای پیدا کردن یکی از تصاویر True + found = False + for image in check_images: + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file, image), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + print(f'Clicked on {image}') + found = True + break + except: + continue + + if found: + # زدن 6 تا tab و 1 enter + for _ in range(6): + pyautogui.press('tab') + sleep(0.5) + #pyautogui.press('enter') + sleep(10) + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file, 'towfacktor.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + pyautogui.press('tab') + pyautogui.press('enter') + except Exception as e: + print('eror ==========towfacktor=============',e) + sleep(10) + pyautogui.press('enter') + # تلاش برای پیدا کردن send_code_new.PNG + sleep(10) + for _ in range(10): + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file, 'send_code_new.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + return True + except: + continue + return 'fail_15_send_sec_code_app_code' + # https://myaccount.ea.com/cp-ui/aboutme/index + + + def handel_page_and_code(self,codex,value,val2): + sleep(50) + codex.end() + codex=Gmail(value,val2,browser_proxy=browser_proxy) + codes='' + + for i in range(2): + try: + + code=codex.get_code()#str(re.findall(pattern=r'Your EA Security Code is: \w*',string=copied_text)[0]).replace('Your EA Security Code is: ','') + if 'ALERT_to_mnay_code_chek'==code: + return 'ALERT_to_mnay_code_chek' + if code=='continue': + codex.end() + codexs=Gmail(value,val2,browser_proxy=browser_proxy) + + + + + code=codexs.get_code() + if 'ALERT_to_mnay_code_chek'==code: + return 'ALERT_to_mnay_code_chek' + if code=='continue': + codexs.end() + continue + codes=True + codes=True + + except: + codex.end() + codex=Gmail(value,val2,browser_proxy=browser_proxy) + print('eror') + #import pdb;pdb.set_trace() + + if codes==True: + pass + else: + return 'fail_get_code' + + chek='' + #import pdb;pdb.set_trace() + sleep(5) + for i in range(30): + smb=False + + print(os.path.join(self.path_png_file,r'veryfy_idyntt.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'veryfy_idyntt.PNG'), confidence=0.8) + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'veryfy_idyntt.PNG'), confidence=0.8) + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'box_for_codee.PNG'), confidence=0.8) + smb=True + except: + pass + + if location: + pyautogui.click(pyautogui.center(location)) + for i in range(3): + if smb==True: + pass + else: + pyautogui.press('tab') + sleep(0.5) + print('input code selcted',i) + for i_code in code: + pyautogui.write(i_code) + print('handel_page_and_code mission 21 next !!!!',i_code) + pyautogui.press('tab') + pyautogui.press('enter') + sleep(5) + + + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_invalid_2.PNG'), confidence=0.8) + print( 'code chek_invalid_2.PNG fail continue ...') + for ix in range(4): + pyautogui.press('tab') + sleep(0.5) + pyautogui.hotkey('ctrl', 'a') + pyautogui.press('backspace') + continue + except: + pass + sleep(5) + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'invalid_chek.PNG'), confidence=0.8) + print( 'code chek_invalid_2.PNG fail continue ...') + for ix in range(4): + pyautogui.press('tab') + sleep(0.5) + pyautogui.hotkey('ctrl', 'a') + pyautogui.press('backspace') + continue + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_invalid_2.PNG'), confidence=0.8) + print( 'code chek_invalid_2.PNG fail continue ...') + for ix in range(4): + pyautogui.press('tab') + sleep(0.5) + pyautogui.hotkey('ctrl', 'a') + pyautogui.press('backspace') + continue + except: + pass + + + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) + chek=True + break + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_tow_factor_1.PNG'), confidence=0.8) + chek=True + break + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'one_trn.PNG'), confidence=0.8) + chek=True + break + except: + pass + + if chek==True: + break + else: + # import pdb;pdb.set_trace() + return 'faill_all_code' + except Exception as e: + time.sleep(5) + print(e) + import pdb;pdb.set_trace() + continue + + import pdb;pdb.set_trace() + if chek==True: + pass + else: + return 'input_bouten2' + sleep(10) + chek22='' + for i in range(30): + #if self.dicline()=='Internal Server Error':return 'Internal Server Error' + print(os.path.join(self.path_png_file,r'one_trn.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) + chek22=True + break + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'one_trn.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'one_trn.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + + + print('handel_page_and_code mission 3 next !!!!') + chek22=True + break + #https://e1_1_dcuk_clik.PNG + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) + chek22=True + break + except: + pass + except Exception as e: + print(e) + time.sleep(5) + continue + + sleep(10) + if chek22==True: + pass + else: + return 'Two-factor authentication' + chek3='' + for i in range(30): + # if self.dicline()=='Internal Server Error':return 'Internal Server Error' + print(os.path.join(self.path_png_file,r'17_app_authentctor.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) + except: + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_2app_authentctor.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_3app_authentctor.PNG'), confidence=0.8) + + + if location: + pyautogui.click(pyautogui.center(location)) + pyautogui.press('tab') + pyautogui.press('enter') + pyautogui.press('enter') + + print('handel_page_and_code mission 3 next !!!!') + chek3=True + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + sleep(10) + # import pdb;pdb.set_trace() + if chek3==True: + pass + else: + return '17_app_authentctor' + chek4='' + #self.dicline() + '''for i in range(30): + if self.dicline()=='Internal Server Error':return 'Internal Server Error' + print(os.path.join(self.path_png_file,r'18_send_code.PNG.PNG.PNG')) + pyautogui.press('down') + pyautogui.press('down') + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'18_send_code.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + + print('handel_page_and_code mission 3 next !!!!') + chek4=True + break + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'18_send_code.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + + print('handel_page_and_code mission 3 next !!!!') + chek4=True + break + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'18_send_code_1.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + + print('handel_page_and_code mission 3 next !!!!') + chek4=True + break + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'18_send_code_1.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + + print('handel_page_and_code mission 3 next !!!!') + chek4=True + break + except: + pass + + + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + if chek4==True: + pass + else: + return '18_send_code' + sleep(10)''' + chek5='' + for i in range(30): + # pyautogui.press('down') + # pyautogui.press('down') + # if self.dicline()=='Internal Server Error':return 'Internal Server Error' + print(os.path.join(self.path_png_file,r'19_continue.PNG.PNG.PNG.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'19_continue.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'19_continue.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + + print('handel_page_and_code mission 3 next !!!!') + chek5=True + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) + except: + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_2app_authentctor.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_3app_authentctor.PNG'), confidence=0.8) + + if location: + pyautogui.click(pyautogui.center(location)) + pyautogui.press('tab') + pyautogui.press('enter') + print('handel_page_and_code mission 3 next !!!!') + + continue + if chek5==True: + pass + else: + return '19_continue' + sleep(15) + tot=self.qr_code() + sleep(3) + totx=self.top(tot) + #import pdb;pdb.set_trace() + # ea_png/input_bouten1.PNG ea_png/input_bouten2.PNG ea_png/input_for_end.PNG + if chek5==True: + pass + else: + return 'click_code' + chek6='' + sleep(8) + for i in range(30): + + + #if self.dicline()=='Internal Server Error':return 'Internal Server Error' + print(os.path.join(self.path_png_file,r'komaki.PNG.PNG.PNG.PNG.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'komaki.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + sleep(1) + pyautogui.press('tab') + sleep(1) + pyautogui.press('tab') + sleep(1) + pyautogui.press('tab') + sleep(1) + pyautogui.write(totx) + print('handel_page_and_code mission 3 next !!!!') + chek6=True + break + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'komaki.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + sleep(1) + pyautogui.press('tab') + sleep(1) + pyautogui.press('tab') + sleep(1) + pyautogui.press('tab') + sleep(1) + pyautogui.write(totx) + print('handel_page_and_code mission 3 next !!!!') + chek6=True + break + except: + pass + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'komaki.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + pyautogui.press('tab') + pyautogui.press('tab') + pyautogui.press('tab') + pyautogui.write(totx) + print('handel_page_and_code mission 3 next !!!!') + chek6=True + break + except: + pass + + + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + if chek6==True: + pass + else: + return 'input_bouten1' + chek7='' + #spam = pyperclip.paste() + sleep(8) + for i in range(30): + pyautogui.press('down') + pyautogui.press('down') + print(os.path.join(self.path_png_file,r'20_turn_on_login.PNG.PNG.PNG.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'20_turn_on_login.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'20_turn_on_login.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + chek7=True + print('handel_page_and_code mission 3 next !!!!') + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + if chek7==True: + pass + else: + return '20_turn_on_login' + time.sleep(5) + chek8='' + #spam = pyperclip.paste() + for i in range(30): + pyautogui.press('down') + pyautogui.press('down') + pyautogui.press('down') + pyautogui.press('down') + time.sleep(10) + print(os.path.join(self.path_png_file,r'vew_back_up.PNG.PNG.PNG.PNG.PNG')) + try: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'vew_back_up.PNG'), confidence=0.8) + except: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'vew_back_up.PNG'), confidence=0.8) + if location: + pyautogui.click(pyautogui.center(location)) + pyautogui.click(pyautogui.center(location)) + chek8=True + print('handel_page_and_code mission 3 next !!!!') + break + #https://e1_1_dcuk_clik.PNG + except Exception as e: + time.sleep(5) + continue + #back_done.PNG + if chek8==True: + pass + else: + return 'vew_back_up' + time.sleep(10) + pyautogui.hotkey('ctrl', 'a') + pyautogui.hotkey('ctrl', 'c') + time.sleep(2) + copied_text = pyperclip.paste() + pattern = r'\d+\.\d+' + codes = str(re.findall(pattern, copied_text)) + if len(codes)==0: + try: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'vew_back_up.PNG'), confidence=0.8) + pyautogui.press('tab') + pyautogui.press('enter') + except: + pass + time.sleep(10) + pyautogui.hotkey('ctrl', 'a') + pyautogui.hotkey('ctrl', 'c') + time.sleep(2) + copied_text = pyperclip.paste() + pattern = r'\d+\.\d+' + codes = str(re.findall(pattern, copied_text)) + + #\d+\.\d+ + try: + + return [tot,'$$',codes] + except: + return 'tot' + + def chek_by_pdb(self,name): + time.sleep(5) + return name + def dicline(self): + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'fail_ant_try_again.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + print('Internal Server Error findddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd') + return 'Internal Server Error' + except: + pass + #fail_ant_try_again.PNG + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_2.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_2.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + except: + pass + ########################################### + ########################################### + + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_base.PNG'), confidence=0.8) + + flag1=True + except: + pass + try: + if flag1==True: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + except: + pass + try: + if flag1==True: + + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3_test.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + except: + pass + try: + if flag1==True: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3_1test.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) + except: + pass + + +class Gmail: + def __init__(self, name, pasword, browser_proxy): + self.flag_exit = None + self.name = name + self.pasword = pasword + + os.makedirs('profile', exist_ok=True) + os.makedirs('picher', exist_ok=True) + + user_data_dir = os.path.join(os.getcwd(), 'profile', name) + + if name not in os.listdir(os.path.join(os.getcwd(), 'profile')): + self.flag_exit = True + + + chromium_args = ["--remote-debugging-port=9222",] + + if self.flag_exit is not True: + print() + print() + print() + print() + print() + print('wwwwwwwww$$$$$$$$$$$$$$$$$--window-position=--remote-debugging-port=9222') + print() + print() + print() + print() + print() + chromium_args.append("--window-position=-32000,-32000") + + + + #if browser_proxy==None: + # print('proxy_not_set and exit',browser_proxy) + # sys.exit() + self.driver = Driver( + uc=True, + user_data_dir=user_data_dir, + chromium_arg=chromium_args + ) + + self.driver.get("https://accounts.google.com/servicelogin?service=mail") + + def check_cookies(self): + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + time.sleep(5) + + if 'https://mail.google.com/mail/u/0/' in self.driver.current_url: + + self.driver.get('https://accounts.google.com/v3/signin/') + time.sleep(5) + if 'To help keep your account secure, Google needs to verify it’s you. Please sign in again to continue to Gmail.'in self.driver.page_source: + return 'help keep your account secure' + + cookies = self.driver.execute_cdp_cmd("Network.getAllCookies",{}) + + cookies_json = json.dumps(cookies, indent=4, ensure_ascii=False) + cookies_json = cookies.get("cookies", []) + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + self.driver.execute_script("window.open('https://www.google.com', '_blank');") + time.sleep(2) + + + self.driver.switch_to.window(self.driver.window_handles[1]) + + + self.driver.switch_to.window(self.driver.window_handles[0]) + + + + self.driver.switch_to.window(self.driver.window_handles[0]) + #if "Verify" in self.driver.page_source: + # self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) + # return 'robot' + if "Verify it" in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) + return 'robot' + if 'Wrong password. Try again or click Forgot password to reset it.' in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_pasword_eror.png")) + return 'pas_eror' + if 'Confirm you’re not a robot' in self.driver.page_source: + return 'robot' + return cookies_json + else: + self.driver.get("https://accounts.google.com/servicelogin?service=mail") + sleep(8) + if 'To help keep your account secure, Google needs to verify it’s you. Please sign in again to continue to Gmail.'in self.driver.page_source: + return 'help keep your account secure' + d=self.send_username(self.name) + sleep(8) + + if 'find your Google Account'in self.driver.page_source: + return 'userx' + if 'Couldn’t find your Google Account'in self.driver.page_source: + return 'userx' + if 'To help keep your account secure, Google needs to verify it’s you. Please sign in again to continue to Gmail.'in self.driver.page_source: + return 'help keep your account secure' + print(d) + # input('>>>>>>1') + if 'To help keep your account secure, Google needs to verify it’s you. Please sign in again to continue to Gmail.'in self.driver.page_source: + return 'help keep your account secure' + # @#input('>>>>>>2') + if 'To help keep your account secure, Google needs to verify it’s you. Please sign in again to continue to Gmail.'in self.driver.page_source: + return 'help keep your account secure' + # input('>>>>>>3') + if 'Confirm you’re not a robot' in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_old.png")) + return 'robot' + # input('>>>>>>4') + if "Verify" in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) + return 'robot' + if "Verify it" in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) + return 'robot' + if 'Wrong password. Try again or click Forgot password to reset it.' in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_pasword_eror.png")) + return 'pas_eror' + if 'Confirm you’re not a robot' in self.driver.page_source: + return 'robot' + sleep(8) + if 'To help keep your account secure, Google needs to verify it’s you. Please sign in again to continue to Gmail.'in self.driver.page_source: + return 'help keep your account secure' + # input('>>>>>>5') + if 'Confirm you’re not a robot' in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_old.png")) + return 'robot' + + #print(self.pasword) + #input('?????') + sleep(8) + try: + fx=self.driver.find_element(By.XPATH, "//input") + print('userx!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') + fx=self.driver.find_element(By.XPATH, "//input").send_key('helooooooooooooooooo') + print('userx!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') + return 'userx' + except: + pass + + # input('>>>>>>') + sleep(8) + w=self.send_pasword(self.pasword) + sleep(9) + #if self.driver.current_url=='https://support.google.com/accounts/answer/40039?p=mail': + # return 'block_acses' + #if 'https://support.google.com/accounts/answer/40039?p=mail' in self.driver.current_url: + #return 'block_acses' + if "Unable to access a Google product" in self.driver.page_source: + return 'block_acses' + # i#f "Unable" in self.driver.page_source: + # return 'block_acses' + + if "Unable to access" in self.driver.page_source: + return 'block_acses' + + try: + fx=self.driver.find_element(By.XPATH,'//*[@id="phoneNumberId"]') + print('find ************* phoneNumberId') + return 'robot' + except: + pass + #if "Verify" in self.driver.page_source: + # self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) + # return 'robot' + if "Verify it" in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) + return 'robot' + if 'Wrong password. Try again or click Forgot password to reset it.' in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_pasword_eror.png")) + return 'pas_eror' + if 'Confirm you’re not a robot' in self.driver.page_source: + return 'robot' + try: + fx=self.driver.find_element(By.XPATH, "//input[@name='Passwd']") + return 'userx2' + except: + pass + if w=='username_eror': + #self.driver.save_screenshot(f"_{self.name}_old.png") + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_old.png")) + return 'fail_cookes' + if 'robot' in str(d): + #self.driver.save_screenshot(f"_{self.name}_old.png") + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_old.png")) + return 'robot' + time.sleep(5) + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_old.png")) + #self.driver.save_screenshot(f"_{self.name}_old.png") + + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + time.sleep(5) + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_old.png")) + status = self.status() + print('status >>>>>>>>>>', status) + + if not status: + + return 'fail_cookes' + else: + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + time.sleep(5) + if 'https://mail.google.com/mail/u/0/' in self.driver.current_url: + self.driver.get('https://accounts.google.com/v3/signin/') + time.sleep(5) + cookies = self.driver.execute_cdp_cmd("Network.getAllCookies",{}) + cookies_json = json.dumps(cookies, indent=4, ensure_ascii=False) + cookies_json = cookies.get("cookies", []) + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + self.driver.execute_script("window.open('https://www.google.com', '_blank');") + time.sleep(2) + + # سوییچ به تب جدید + self.driver.switch_to.window(self.driver.window_handles[1]) + + # بستن تب قبلی + self.driver.switch_to.window(self.driver.window_handles[0]) + self.driver.close() + + # سوییچ مجدد به تب جدید + self.driver.switch_to.window(self.driver.window_handles[0]) + + return cookies_json + + def get_code_1(self): + code=[] + for i in range(3): + try: + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + time.sleep(7) + elements = self.driver.find_elements(By.XPATH, "//*[contains(text(), 'Your EA Security Code is:')]")#.text + print(elements) + for i in elements: + print(i.text) + data=i.text.replace('Your EA Security Code is: ', '') + if len(data)==0: + continue + code.append(data) + print(code) + #input('>>') + if len(code)==0: + return 'continue' + if len(code)>7: + return 'ALERT_to_mnay_code_chek' + if len(code)==7: + return 'ALERT_to_mnay_code_chek' + if len(code)==6: + return 'ALERT_to_mnay_code_chek' + if len(code)==8: + return 'ALERT_to_mnay_code_chek' + if len(code)==9: + return 'ALERT_to_mnay_code_chek' + return code + except Exception as e: + print(e) + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + time.sleep(6) + self.driver.refresh() + time.sleep(6) + return 'continue' + def get_code(self): + code=[] + for i in range(3): + try: + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + time.sleep(7) + elements = self.driver.find_elements(By.XPATH, "//*[contains(text(), 'Your EA Security Code is:')]")#.text + if len(elements)==0: + print('data not fund languge .......') + elements = self.driver.find_elements(By.XPATH, "//*[contains(text(), 'EA')]")#.text + + + for i in elements: + + #print(i.text) + if i in code: + continue + try: + pri=(re.findall(r'EA (.+): (\d+)',i.text)[0][1]) + if pri in code:continue + print(pri) + code.append(re.findall(r'EA (.+): (\d+)',i.text)[0][1]) + except Exception as e: + print(e) + pass + # code=list(set(bb)) + #input('>>>>>>>>>>>>>>>>>') + print(code) + #input('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') + #input('>>') + if len(code)==0: + return 'continue' + + return code + + print(elements) + #import pdb;pdb.set_trace() + for i in elements: + print(i.text) + data=i.text.replace('Your EA Security Code is: ', '') + if len(data)==0: + continue + code.append(data) + print(code) + #input('>>') + if len(code)==0: + return 'continue' + + return code + except Exception as e: + print(e) + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + time.sleep(6) + self.driver.refresh() + time.sleep(6) + return 'continue' + + def end(self): + + try: + + self.driver.quit() + except: + pass + def send_username(self,user): + if 'Confirm you’re not a robot' in self.driver.page_source: + return 'robot' + self.driver.get("https://accounts.google.com/servicelogin?service=mail") + sleep(10) + sf='' + #if 'https://mail.google.com/mail/u/0/' in self.driver.current_url: + #return 'next' + for i in range(15): + + try: + if 'Confirm you’re not a robot' in self.driver.page_source: + return 'robot' + fx=self.driver.find_element(By.XPATH, "//input")#.click() + sf=True + break + #sf=True + except Exception as e: + print(e) + self.driver.get("https://accounts.google.com/servicelogin?service=mail") + #sleep(10) + sleep(4) + sf=False + if sf==False: + return 'Kill' + fx.click() + fx.send_keys(user) + try: + + self.driver.find_element(By.XPATH, "//div[@id='identifierNext']/div/button/span").click() + return True + except: + for i in self.driver.find_elements(By.XPATH, "//*[contains(text(), 'Next')]"): + i.click()#.text + return True + + #//div[@id='identifierNext']/div/button/span + def send_pasword(self,pasw): + sleep(8) + + + # return 'username_eror' + if 'Confirm you’re not a robot' in self.driver.page_source: + return 'robot' + for i in range(5): + try: + + fx=self.driver.find_element(By.XPATH, "//input[@name='Passwd']")#.click() + sf=True + break + #sf=True + except Exception as e: + print(e) + sleep(4) + sf=False + if sf==False: + return 'Kill' + fx.click() + fx.send_keys(pasw) + try: + self.driver.find_element(By.XPATH, '//*[@id="passwordNext"]/div/button/span').click() + return True + except: + pass + + try: + + self.driver.find_element(By.XPATH, "//div[@id='identifierNext']/div/button/span").click() + return True + except: + try: + + for i in self.driver.find_elements(By.XPATH, "//*[contains(text(), 'Next')]"): + i.click()#.text + return True + except: + pass + #//span[contains(.,'Next')] + def change_lang(self): + # return True + + self.driver.get("https://mail.google.com/mail/u/0/#settings/general") + sleep(10) + #import pdb;pdb.set_trace() + #iframes = self.driver.find_elements(By.TAG_NAME, "iframe") + xx=self.driver.find_element(By.XPATH, "//select") + sleep(5) + xx.click() + xx.send_keys('English (UK)') + xx.click() + xx=self.driver.find_element(By.XPATH, "//td/div/button").click() + sleep(3) + self.driver.get("https://myaccount.google.com/language") + #import pdb;pdb.set_trace() + #https://myaccount.google.com/language + xd='' + for i in range(8): + try: + try: + sfg=self.driver.find_element(By.XPATH, "//div/button/div") + sfg.click() + xd=True + break + except: + pass + try: + sfg=self.driver.find_element(By.XPATH, "/html/body/c-wiz/div/div[2]/div[2]/c-wiz/div[1]/div[4]/div/div[1]/ul/li/div/div[2]/div/button/div") + sfg.click() + xd=True + break + except: + pass + try: + sfg=self.driver.find_element(By.XPATH,'/html').click() + sfg=self.driver.find_element(By.XPATH,'/html').send_keys(Keys.TAB) + active_element =self.driver.switch_to.active_element + active_element.click() + xd=True + break + except: + pass + + except: + + self.driver.refresh() + sleep(5) + if xd==True: + sleep(1) + try: + + self.driver.find_element(By.XPATH, "//label/input").send_keys("English") + except: + active_element =self.driver.switch_to.active_element + active_element.send_keys("English") + sleep(1) + try: + + self.driver.find_element(By.XPATH, "//label/input").send_keys(Keys.ARROW_DOWN) + except: + active_element =self.driver.switch_to.active_element + active_element.send_keys(Keys.ARROW_DOWN) + sleep(1) + try: + self.driver.find_element(By.XPATH, "//label/input").send_keys(Keys.ENTER) + except: + active_element =self.driver.switch_to.active_element + active_element.send_keys(Keys.ENTER) + + sleep(1) + self.driver.find_element(By.XPATH, "//li[58]").click() + self.driver.find_element(By.XPATH, "//div[3]/button/span[5]").click() + sleep(1) + + return True + return True + + + + def status(self): + + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + sleep(8) + if 'https://mail.google.com/mail/u/0/#inbox' in self.driver.current_url: + self.change_lang() + + self.driver.get('https://mail.google.com/mail/u/0/#inbox') + sleep(1) + return True + else: + return False + + + + +def main(path_png_file, + chrome, + eamil, + get_cookes, + codex, + value, + val2, + browser_proxy, + ): + + ea=ea_fucking(path_png_file) + + + + load_browser_windows=ea.load_browser_windows(chrome) + + # pyautogui.press("enter") + ea.get_tor() + pyautogui.press("enter") + + sleep(1) + + + + get_ea=ea.get_to_ea() + print('get_to_ea >>>',get_ea) + if 'ea_created__app_code_nead!!' in str(get_ea): + return 'ea_created__app_code_nead!!' + if get_ea: + print('get_to_ea ok hoeraaa gooo') + + clik_extenshen = ea.clik_extenshen(get_cookes=get_cookes) + print('clik_extenshen >>>', clik_extenshen) + if isinstance(clik_extenshen, str):return clik_extenshen + if clik_extenshen: + # Click month + click_gmail = ea.click_gmail() + print('click_gmail >>>', click_gmail) + if isinstance(click_gmail, str):return click_gmail + if not click_gmail: + print('click_gmail Failed!') + return 'click_gmail Failed' + + # Click day + chek_logo = ea.chek_logo() + if chek_logo=='fail_mail': + return 'fail_mail' + print('chek_logo >>>', chek_logo) + #if isinstance(chek_logo, str):return chek_logo + if chek_logo=='fail_mail': + return 'fail_mail' + if chek_logo==True: + + + continue_page = ea.continue_page() + + print('continue_page >>>', continue_page) + if not continue_page: + print('continue_page Failed!') + return 'continue_page Failed' + ##################################################################################################################################### + if continue_page=='nime': + sleep(10) + #######################################$$$$$ + get_seting_sec_1 = ea.get_seting_sec_1() + if isinstance(get_seting_sec_1, str):return get_seting_sec_1 + print('ea.get_seting_sec_1 >>>', get_seting_sec_1) + if not ea.get_seting_sec_1: + print('ea.get_seting_sec_1 Failed!') + return 'ea.get_seting_sec_1 Failed' + sleep(10) + + get_turn_on_2 = ea.get_turn_on_2(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in str(get_turn_on_2): + return 'ALERT_to_mnay_code_chek' + + print('----------//////////',get_turn_on_2) + #import pdb;pdb.set_trace() + if 'ea_created__app_code_nead!!' in str(get_turn_on_2): + return "ea_created__app_code_nead!!" + if isinstance(get_turn_on_2, str):return get_turn_on_2 + print('ea.get_turn_on_2 >>>', get_turn_on_2) + if not get_turn_on_2: + print('ea.get_turn_on_2 Failed!') + return 'ea.get_turn_on_2 Failed' + sleep(10) + send_green_status(server) + get_send_sec_3 = ea.get_send_sec_3() + if isinstance(get_send_sec_3, str):return get_send_sec_3 + print('finsh >>>', get_send_sec_3) + if not get_send_sec_3: + print('ea.get_send_sec_3 Failed!') + return 'ea.get_send_sec_3 Failed' + sleep(10) + handel_page_and_code = ea.handel_page_and_code(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in handel_page_and_code: + return 'ALERT_to_mnay_code_chek' + if isinstance(handel_page_and_code, str):return handel_page_and_code + print('handel_page_and_code >>>', handel_page_and_code) + if not handel_page_and_code: + print('handel_page_and_code Failed!') + return 'handel_page_and_code Failed' + ###########################################^^^^ + #import pdb;pdb.set_trace() + return handel_page_and_code + #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + # Go to next page + input_PATRH = ea.input_PATRH() + if isinstance(input_PATRH, str):return input_PATRH + print('input_PATRH >>>', input_PATRH) + if not input_PATRH: + print('input_PATRH Failed!') + return 'input_PATRH Failed' + + # Check CAPTCHA + contuen_page2 = ea.contuen_page2() + if isinstance(contuen_page2, str):return contuen_page2 + print('contuen_page2 >>>', contuen_page2) + if not contuen_page2: + print('contuen_page2 Failed!') + return 'contuen_page2 Failed' + # import pdb;pdb.set_trace() + # Accept buttons + next = ea.next() + if isinstance(next, str):return next + print('next >>>', next) + if not next: + print('next Failed!') + return 'next Failed' + ############################################################## + sleep(10) + accept = ea.accept() + + print('accept >>>', accept) + if 'make_other_time'==accept: + #import pdb;pdb.set_trace() + #return 'make_other_time' + sleep(10) + get_seting_sec_1 = ea.get_seting_sec_1() + if isinstance(get_seting_sec_1, str):return get_seting_sec_1 + print('ea.get_seting_sec_1 >>>', get_seting_sec_1) + if not ea.get_seting_sec_1: + print('ea.get_seting_sec_1 Failed!') + return 'ea.get_seting_sec_1 Failed' + sleep(10) + get_turn_on_2 = ea.get_turn_on_2(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in str(get_turn_on_2): + return 'ALERT_to_mnay_code_chek' + print('----------//////////',get_turn_on_2) + #import pdb;pdb.set_trace() + if 'ea_created__app_code_nead!!' in str(get_turn_on_2): + return "ea_created__app_code_nead!!" + if isinstance(get_turn_on_2, str):return get_turn_on_2 + print('ea.get_turn_on_2 >>>', get_turn_on_2) + if not get_turn_on_2: + print('ea.get_turn_on_2 Failed!') + return 'ea.get_turn_on_2 Failed' + sleep(10) + get_send_sec_3 = ea.get_send_sec_3() + if isinstance(get_send_sec_3, str):return get_send_sec_3 + print('finsh >>>', get_send_sec_3) + if not get_send_sec_3: + print('ea.get_send_sec_3 Failed!') + return 'ea.get_send_sec_3 Failed' + sleep(10) + handel_page_and_code = ea.handel_page_and_code(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in handel_page_and_code: + return 'ALERT_to_mnay_code_chek' + if isinstance(handel_page_and_code, str):return handel_page_and_code + print('handel_page_and_code >>>', handel_page_and_code) + if not handel_page_and_code: + print('handel_page_and_code Failed!') + return 'handel_page_and_code Failed' + ###########################################^^^^ + #import pdb;pdb.set_trace() + return handel_page_and_code + if not accept: + print('accept Failed!') + return 'accept Failed' + send_green_status(server) + # Click verify + sleep(10) + creat = ea.creat() + if 'make_other_time'==creat: + #return 'make_other_time' + sleep(10) + get_seting_sec_1 = ea.get_seting_sec_1() + if isinstance(get_seting_sec_1, str):return get_seting_sec_1 + print('ea.get_seting_sec_1 >>>', get_seting_sec_1) + if not ea.get_seting_sec_1: + print('ea.get_seting_sec_1 Failed!') + return 'ea.get_seting_sec_1 Failed' + sleep(10) + get_turn_on_2 = ea.get_turn_on_2(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in str(get_turn_on_2): + return 'ALERT_to_mnay_code_chek' + #import pdb;pdb.set_trace() + if 'ea_created__app_code_nead!!' in str(get_turn_on_2): + return "ea_created__app_code_nead!!" + if isinstance(get_turn_on_2, str):return get_turn_on_2 + print('ea.get_turn_on_2 >>>', get_turn_on_2) + if not get_turn_on_2: + print('ea.get_turn_on_2 Failed!') + return 'ea.get_turn_on_2 Failed' + sleep(10) + get_send_sec_3 = ea.get_send_sec_3() + if isinstance(get_send_sec_3, str):return get_send_sec_3 + print('finsh >>>', get_send_sec_3) + if not get_send_sec_3: + print('ea.get_send_sec_3 Failed!') + return 'ea.get_send_sec_3 Failed' + sleep(10) + + handel_page_and_code = ea.handel_page_and_code(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in handel_page_and_code: + return 'ALERT_to_mnay_code_chek' + if isinstance(handel_page_and_code, str):return handel_page_and_code + print('handel_page_and_code >>>', handel_page_and_code) + if not handel_page_and_code: + print('handel_page_and_code Failed!') + return 'handel_page_and_code Failed' + ###########################################^^^^ + #import pdb;pdb.set_trace() + return handel_page_and_code + print('creat >>>', creat) + if isinstance(creat, str):return creat + if not creat: + print('creat Failed!') + return 'creat Failed' + + sleep(10) + finsh = ea.finsh() + if isinstance(finsh, str):return finsh + print('finsh >>>', finsh) + if not finsh: + print('finsh Failed!') + return 'finsh Failed' + #######################################$$$$$ + get_seting_sec_1 = ea.get_seting_sec_1() + if isinstance(get_seting_sec_1, str):return get_seting_sec_1 + print('ea.get_seting_sec_1 >>>', get_seting_sec_1) + if not ea.get_seting_sec_1: + print('ea.get_seting_sec_1 Failed!') + return 'ea.get_seting_sec_1 Failed' + sleep(10) + get_turn_on_2 = ea.get_turn_on_2(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in str(get_turn_on_2): + return 'ALERT_to_mnay_code_chek' + # import pdb;pdb.set_trace() + if 'ea_created__app_code_nead!!' in str(get_turn_on_2): + return "ea_created__app_code_nead!!" + if isinstance(get_turn_on_2, str):return get_turn_on_2 + print('ea.get_turn_on_2 >>>', get_turn_on_2) + if not get_turn_on_2: + print('ea.get_turn_on_2 Failed!') + return 'ea.get_turn_on_2 Failed' + sleep(10) + get_send_sec_3 = ea.get_send_sec_3() + if isinstance(get_send_sec_3, str):return get_send_sec_3 + print('get_send_sec_3 >>>', get_send_sec_3) + if not get_send_sec_3: + print('ea.get_send_sec_3 Failed!') + return 'ea.get_send_sec_3 Failed' + sleep(10) + send_green_status(server) + handel_page_and_code = ea.handel_page_and_code(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in handel_page_and_code: + return 'ALERT_to_mnay_code_chek' + if isinstance(handel_page_and_code, str):return handel_page_and_code + print('handel_page_and_code >>>', handel_page_and_code) + if not handel_page_and_code: + print('handel_page_and_code Failed!') + return 'handel_page_and_code Failed' + ###########################################^^^^ + # import #pdb;pdb.set_trace() + return handel_page_and_code + send_green_status(server) + if chek_logo=='nime': + send_green_status(server) + next = ea.next() + if isinstance(next, str):return next + print('next >>>', next) + if not next: + print('next Failed!') + return 'next Failed' + ########################################################## + sleep(10) + accept = ea.accept() + print('accept >>>', accept) + + if 'make_other_time'==accept: + #import pdb;pdb.set_trace() + #return 'make_other_time' + #import pdb;pdb.set_trace() + #return 'make_other_time' + sleep(10) + get_seting_sec_1 = ea.get_seting_sec_1() + if isinstance(get_seting_sec_1, str):return get_seting_sec_1 + print('ea.get_seting_sec_1 >>>', get_seting_sec_1) + if not ea.get_seting_sec_1: + print('ea.get_seting_sec_1 Failed!') + return 'ea.get_seting_sec_1 Failed' + sleep(10) + get_turn_on_2 = ea.get_turn_on_2(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in str(get_turn_on_2): + return 'ALERT_to_mnay_code_chek' + print('----------//////////',get_turn_on_2) + #import pdb;pdb.set_trace() + if 'ea_created__app_code_nead!!' in str(get_turn_on_2): + return "ea_created__app_code_nead!!" + if isinstance(get_turn_on_2, str):return get_turn_on_2 + print('ea.get_turn_on_2 >>>', get_turn_on_2) + if not get_turn_on_2: + print('ea.get_turn_on_2 Failed!') + return 'ea.get_turn_on_2 Failed' + sleep(10) + send_green_status(server) + get_send_sec_3 = ea.get_send_sec_3() + if isinstance(get_send_sec_3, str):return get_send_sec_3 + print('finsh >>>', get_send_sec_3) + if not get_send_sec_3: + print('ea.get_send_sec_3 Failed!') + return 'ea.get_send_sec_3 Failed' + sleep(10) + handel_page_and_code = ea.handel_page_and_code(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in handel_page_and_code: + return 'ALERT_to_mnay_code_chek' + if isinstance(handel_page_and_code, str):return handel_page_and_code + print('handel_page_and_code >>>', handel_page_and_code) + if not handel_page_and_code: + print('handel_page_and_code Failed!') + return 'handel_page_and_code Failed' + ###########################################^^^^ + #import pdb;pdb.set_trace() + return handel_page_and_code + if not accept: + print('accept Failed!') + return 'accept Failed' + + # Click verify + sleep(10) + creat = ea.creat() + if 'make_other_time'==creat: + #return 'make_other_time' + sleep(10) + get_seting_sec_1 = ea.get_seting_sec_1() + if isinstance(get_seting_sec_1, str):return get_seting_sec_1 + print('ea.get_seting_sec_1 >>>', get_seting_sec_1) + if not ea.get_seting_sec_1: + print('ea.get_seting_sec_1 Failed!') + return 'ea.get_seting_sec_1 Failed' + sleep(10) + get_turn_on_2 = ea.get_turn_on_2(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in str(get_turn_on_2): + return 'ALERT_to_mnay_code_chek' + #import pdb;pdb.set_trace() + if 'ea_created__app_code_nead!!' in str(get_turn_on_2): + return "ea_created__app_code_nead!!" + if isinstance(get_turn_on_2, str):return get_turn_on_2 + print('ea.get_turn_on_2 >>>', get_turn_on_2) + if not get_turn_on_2: + print('ea.get_turn_on_2 Failed!') + return 'ea.get_turn_on_2 Failed' + sleep(10) + get_send_sec_3 = ea.get_send_sec_3() + if isinstance(get_send_sec_3, str):return get_send_sec_3 + print('finsh >>>', get_send_sec_3) + if not get_send_sec_3: + print('ea.get_send_sec_3 Failed!') + return 'ea.get_send_sec_3 Failed' + sleep(10) + + handel_page_and_code = ea.handel_page_and_code(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in handel_page_and_code: + return 'ALERT_to_mnay_code_chek' + if 'ALERT_to_mnay_code_chek' in handel_page_and_code: + return 'ALERT_to_mnay_code_chek' + if isinstance(handel_page_and_code, str):return handel_page_and_code + print('handel_page_and_code >>>', handel_page_and_code) + if not handel_page_and_code: + print('handel_page_and_code Failed!') + return 'handel_page_and_code Failed' + ###########################################^^^^ + #import pdb;pdb.set_trace() + return handel_page_and_code + print('creat >>>', creat) + if not creat: + print('creat Failed!') + return 'creat Failed' + + sleep(10) + finsh = ea.finsh() + if isinstance(finsh, str):return finsh + print('finsh >>>', finsh) + if not finsh: + print('finsh Failed!') + return 'finsh Failed' + #######################################$$$$$ + get_seting_sec_1 = ea.get_seting_sec_1() + if isinstance(get_seting_sec_1, str):return get_seting_sec_1 + print('ea.get_seting_sec_1 >>>', get_seting_sec_1) + if not ea.get_seting_sec_1: + print('ea.get_seting_sec_1 Failed!') + return 'ea.get_seting_sec_1 Failed' + sleep(10) + get_turn_on_2 = ea.get_turn_on_2(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in str(get_turn_on_2): + return 'ALERT_to_mnay_code_chek' + print('----------//////////',get_turn_on_2) + # import pdb;pdb.set_trace() + if 'ea_created__app_code_nead!!' in str(get_turn_on_2): + return "ea_created__app_code_nead!!" + if isinstance(get_turn_on_2, str):return get_turn_on_2 + print('ea.get_turn_on_2 >>>', get_turn_on_2) + if not get_turn_on_2: + print('ea.get_turn_on_2 Failed!') + return 'ea.get_turn_on_2 Failed' + sleep(10) + send_green_status(server) + get_send_sec_3 = ea.get_send_sec_3() + if isinstance(get_send_sec_3, str):return get_send_sec_3 + print('finsh >>>', get_send_sec_3) + if not get_send_sec_3: + print('ea.get_send_sec_3 Failed!') + return 'ea.get_send_sec_3 Failed' + sleep(10) + handel_page_and_code = ea.handel_page_and_code(codex,value,val2) + if 'ALERT_to_mnay_code_chek' in handel_page_and_code: + return 'ALERT_to_mnay_code_chek' + if isinstance(handel_page_and_code, str):return handel_page_and_code + print('handel_page_and_code >>>', handel_page_and_code) + if not handel_page_and_code: + print('handel_page_and_code Failed!') + return 'handel_page_and_code Failed' + ###########################################^^^^ + #import pdb;pdb.set_trace() + return handel_page_and_code + # Open new tab + ###################################### + send_green_status(server) + if 'click_gmail' in str(get_ea): + send_green_status(server) + return 'get_ea Failed' + else: + send_green_status(server) + print('get_ea Failed!') + return 'get_ea Failed' +######################################################################### + +def create_session(name,pas): + BASE_URL=os.getenv("url") + response = requests.post(f"{BASE_URL}/create_session", json={"name": name,"pas":pas},timeout=500) + if '500 Internal Server Error' in response.text: + return 'fail_server' + if response.json()['message']=='Session created': + + session_data = response.json()['name'] + + print("Session Response: >>>>>>>>>>>>>>>", session_data) + return session_data + else: + print('>>>>>>False cookes >>>>>>>>>') + return False + +def check_cookies(name): + BASE_URL=os.getenv("url") + response = requests.post(f"{BASE_URL}/check_cookies", json={"name": name},timeout=500) + print(response.text) + #@input('======') + if '500 Internal Server Error' in response.text: + return 'fail_server' + if 'fail_cookes' in str(response.text): + return False + if 'success' in str(response.json()): + + cookies = response.json()['success'] + + print("Cookies Response:", cookies) + return cookies + else: + return False + +#socks5://8f7b6c1bdfc33fce0973__cr.us:11a1f76e3314b769@148.251.5.30:10023#148.251.5.30 + +browser_proxy=None#os.getenv("browser_proxy") +browser=os.getenv("browser") +url=os.getenv("url") +type_proxy=os.getenv("type_proxy") +user=os.getenv("user") +pasword=os.getenv("pasword") +ipx=os.getenv("ip") +portx=int(os.getenv("port")) +max_range=int(os.getenv("max_range")) +######################################################################### +user_sys = os.getlogin() +path_file=os.path.join(os.getcwd(),'input') +path_png_file=os.path.join(os.getcwd(),'ea_png') + + +###################################################### +try: + + with open('LOGS_forse.TXT', 'r', encoding='utf-8') as fsx: + + bsxs=fsx.read() +except: + with open('LOGS_forse.TXT', 'w', encoding='utf-8') as fsx: + pass + with open('LOGS_forse.TXT', 'r', encoding='utf-8') as fsx: + + bsxs=fsx.read() +################################################# +try: + + with open('LOGS.TXT', 'r', encoding='utf-8') as fsx: + + bs=fsx.read() +except: + with open('LOGS.TXT', 'w', encoding='utf-8') as fsx: + pass + with open('LOGS.TXT', 'r', encoding='utf-8') as fsx: + + bs=fsx.read() +#################################################### +try: + + with open('True.TXT', 'r', encoding='utf-8') as fsx: + + Truex=fsx.read() +except: + with open('True.TXT', 'w', encoding='utf-8') as fsx: + pass + with open('True.TXT', 'r', encoding='utf-8') as fsx: + + Truex=fsx.read() + + #C:\Users\1\Desktop\New folder (4)\New folder +def check_and_update_email_usage(email: str) -> bool: + USAGE_FILE = 'email_usage.json' + + usage_data = {} + + # اگر فایل وجود داشت، بخون + if os.path.exists(USAGE_FILE): + try: + with open(USAGE_FILE, 'r') as f: + usage_data = json.load(f) + except: + usage_data = {} + else: + # فایل اولیه بساز + with open(USAGE_FILE, 'w') as f: + json.dump({}, f) + + # تعداد فعلی استفاده + current_count = usage_data.get(email, 0) + + if current_count >= 6: + usage_data[email] = 0 # ریست بشه + result = False + else: + usage_data[email] = current_count + 1 + result = True + + # ذخیره‌سازی در فایل + try: + with open(USAGE_FILE, 'w') as f: + json.dump(usage_data, f, indent=2) + except Exception as e: + print(f"خطا در ذخیره‌سازی فایل: {e}") + + return result +def send_green_status(SERVER_NAME): + SERVER_URL = 'http://188.245.173.247:5000/robot_ping' + try: + + requests.post(SERVER_URL, json={ + 'server_name': SERVER_NAME, + 'status': 'در حال اجرا', + 'note': 'همه چی اوکیه، دارم کار می‌کنم :)' + }) + except Exception as e: + print(e) +def send_orange_status(SERVER_NAME): + SERVER_URL = 'http://188.245.173.247:5000/robot_ping' + try: + requests.post(SERVER_URL, json={ + 'server_name': SERVER_NAME, + 'status': 'در حال انتظار', + 'note': 'منتظرم شرایط مناسب بشه یا جوابی بیاد.' + }) + except Exception as e: + print(e) +def send_red_status(SERVER_NAME): + SERVER_URL = 'http://188.245.173.247:5000/robot_ping' + try: + + requests.post(SERVER_URL, json={ + 'server_name': SERVER_NAME, + 'status': 'خطا یا توقف', + 'note': 'یه مشکلی پیش اومده، لطفاً بررسی کن.' + }) + except Exception as e: + print(e) +def clear_selected_folders(folder_names): + profile_dir = os.path.join(os.getcwd(), "profile") + + if os.path.exists(profile_dir): + for folder_name in folder_names: + folder_path = os.path.join(profile_dir, folder_name) + if os.path.exists(folder_path) and os.path.isdir(folder_path): + try: + shutil.rmtree(folder_path) + print(f"پاک شد: {folder_name}") + except Exception as e: + print(f"خطا در پاک کردن {folder_name}: {e}") + else: + print(f"فولدر {folder_name} پیدا نشد.") + else: + print("فولدر profile وجود نداره.") +def delete_if_low_disk_space(path_to_check, folder_to_delete, threshold_gb=10): + """ + اگه فضای خالی دیسک کمتر از threshold_gb گیگ بود، پوشه مشخص‌شده رو حذف می‌کنه. + + path_to_check: آدرس جایی از دیسک برای چک کردن فضای آزاد (مثلاً '/') + folder_to_delete: آدرس پوشه‌ای که باید حذف بشه اگه فضا کم بود + threshold_gb: حد آستانه‌ی گیگابایتی (پیش‌فرض: 5 گیگ) + """ + total, used, free = shutil.disk_usage(path_to_check) + free_gb = free / (1024 ** 3) + + if free_gb < threshold_gb: + if os.path.exists(folder_to_delete): + shutil.rmtree(folder_to_delete) + print(f"پوشه '{folder_to_delete}' حذف شد چون فقط {free_gb:.2f} گیگ فضا باقی‌مونده بود.") + else: + print(f"پوشه‌ای به نام '{folder_to_delete}' پیدا نشد.") + else: + print(f"فضای کافی ({free_gb:.2f} گیگ) وجود داره. نیازی به حذف نیست.") + +#value,val2='azam46ahi@gmail.com','azam46ahi@gmail.com' +#codexs=Gmail(value,val2,browser_proxy='fuck') +#print(codexs.change_lang()) +#input('>>') +#check_cookiesx=str(codexs.check_cookies()) +#codexs=Gmail('arzw10053@gmail.com','Shwe65544t',browser_proxy='fuck') +#check_cookiesx=str(codexs.check_cookies()) + + + +if __name__ == "__main__": + + conter_port=0 + chek_sum='' + db_config = { + 'host': os.getenv("DB_HOST"), + 'port': os.getenv("DB_PORT"), + 'dbname': os.getenv("DB_NAME"), + 'user': os.getenv("DB_USER"), + 'password': os.getenv("DB_PASSWORD") + } + server = os.getenv('SERVER_NAME') + print(db_config) + manager = EmailGroupManager(db_config) + + group_data=[] + + while True: + try: + + + if len(group_data)==0: + + group_data = manager.get_group(server) + print(group_data) + print(len(group_data)) + print('get new data drom database -------------------------------------------****') + if len(group_data)==0: + + group_datax = manager.get_open_groups_1(server) + group_data=[] + for ig in group_datax: + group_data.append({ + "id": ig[0], + "email": ig[1], + "email_password": ig[-3], + }) + print(group_data) + print(len(group_data)) + print('old data base ///////////////////////////////////////////////////////////') + + if len(group_data)==0: + send_orange_status(server) + continue + send_green_status(server) + for ixs in group_data: + os.system("taskkill /f /im chrome.exe") + os.system("taskkill /f /im chromedriver.exe") + os.system("taskkill /f /im chrome.exe") + os.system("taskkill /f /im uc_driver.exe") + os.system("taskkill /f /im chromedriver.exe") + #df = pd.read_excel(os.path.join(path_file, ixs), engine='openpyxl') + print(ixs) + # {'id': 4, 'email': 'sunnmp97667@gmail.com', 'email_password': 'Exgvufc6Rxtf'} + value=ixs['email'] + val2=ixs['email_password'] + id_mail=ixs['id'] + # email = 'someone@gmail.com' + delete_if_low_disk_space("C:\\",os.path.join(os.getcwd(),'profile')) + + if check_and_update_email_usage(value): + print('مجاز به استفاده ✅') + else: + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="unknown error") + manager.append_to_history(email_id=id_mail,message="unknown error") + manager.mark_email_finished_nime( + email_id=id_mail, + success=False, + backup_code='unknown error' + ) + print('تعداد استفاده به حداکثر رسید! مقدار ریست شد ❌') + clear_selected_folders([value]) + continue + #for value, val2 in zip(df.iloc[:, 0], df.iloc[:, 1]): + # value='kosnago22r@gmail.com' + # val2='aezakmi90' + manager.set_taken_at(id_mail) + print(value, val2) + + #input('>>>') + kill_tor_browser() + + ip=pool() + if chek_sum==True: + pass + else: + + while True: + + print(portx) + portx+=1 + conter_port+=1 + if conter_port>int(max_range): + conter_port=0 + portx=int(os.getenv("port")) + break + # @ socks5://8f7b6c1bdfc33fce0973__cr.us:11a1f76e3314b769@148.251.5.30:10023#148.251.5.30 + print(f'{type_proxy}://{user}:{pasword}@{ipx}:{portx}#148.251.5.30') + chek_2_2=ip.chek_2_2(f'{type_proxy}://{user}:{pasword}@{ipx}:{portx}#148.251.5.30') + print(chek_2_2) + if chek_2_2==True: + print('proxy conected!!!') + chek_sum=True + break + + print(value) + #Gmail(value,val2) + os.system("taskkill /f /im chrome.exe") + os.system("taskkill /f /im chromedriver.exe") + os.system("taskkill /f /im chrome.exe") + os.system("taskkill /f /im uc_driver.exe") + os.system("taskkill /f /im chromedriver.exe") + + codexs=Gmail(value,val2,browser_proxy=browser_proxy) + + + try: + + check_cookiesx=str(codexs.check_cookies()) + if codexs.flag_exit==True: + codexs.flag_exit=None + codexs.end() + codexs=Gmail(value,val2,browser_proxy=browser_proxy) + check_cookiesx=str(codexs.check_cookies()) + + if 'pas_eror' in check_cookiesx: + with open('woring_gmail.txt','a')as gy: + gy.write(f"{str(get_tehran_time())} : {value} : {'passw_eror'}\n") + file_data["username"]=value + file_data["totp"]='passw_eror' + file_data["time"]=get_tehran_time() + + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="passw_eror") + clear_selected_folders([value]) + continue + if 'help keep your account secure' in check_cookiesx: + with open('woring_gmail.txt','a')as gy: + gy.write(f"{str(get_tehran_time())} : {value} : {'help keep your account secure'}\n") + file_data["username"]=value + file_data["totp"]='help keep your account secure' + file_data["time"]=get_tehran_time() + + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="help keep your account secure") + clear_selected_folders([value]) + continue + if 'block_acses' in check_cookiesx: + with open('woring_gmail.txt','a')as gy: + gy.write(f"{str(get_tehran_time())} : {value} : {'Unable to access a Google product'}\n") + file_data["username"]=value + file_data["totp"]='Unable to access a Google product' + file_data["time"]=get_tehran_time() + + + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="Unable to access a Google product") + clear_selected_folders([value]) + continue + if 'robot' in check_cookiesx: + with open('woring_gmail.txt','a')as gy: + gy.write(f"{str(get_tehran_time())} : {value} : {'nead_very_fy'}\n") + file_data["username"]=value + file_data["totp"]='nead_very_fy' + file_data["time"]=get_tehran_time() + + + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="nead_very_fy") + clear_selected_folders([value]) + continue + if 'userx' in check_cookiesx: + with open('LOGS.txt','a')as gy: + gy.write(f"{str(get_tehran_time())} : {value} : {'username_eror'}\n") + file_data["username"]=value + file_data["totp"]='username_eror' + file_data["time"]=get_tehran_time() + + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="userx") + clear_selected_folders([value]) + continue + + if 'userx2' in check_cookiesx: + with open('woring_gmail.txt','a')as gy: + gy.write(f"{str(get_tehran_time())} : {value} : {'pasword_eror'}\n") + file_data["username"]=value + file_data["totp"]='pasword_eror' + file_data["time"]=get_tehran_time() + + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="pasword_eror") + clear_selected_folders([value]) + continue + + print(check_cookiesx) + check_cookiesxddd=check_cookiesx + check_cookiesx=check_cookiesx.replace('"sameSite": "Lax",','',1000).replace('"sameSite": "None",','',1000) + print(check_cookiesx) + except Exception as e: + #value=ixs['email'] + #val2=ixs['email_password'] + fxxxx=str(ixs['email']).split('@')[0] + + with open(f'piche\\chek_it_it______Q___{fxxxx}.txt','w')as gy: + try: + + gy.write(str(e)) + except: + gy.write(str(e)) + with open(f'picher\\chek_it_it_________{fxxxx}.txt','w')as gy: + try: + + gy.write(str(check_cookiesxddd)) + except: + gy.write(str('check_cookiesxddd')) + print('cookes can notloaded no set data base',e) + + continue + + + + if 'block_acses' in check_cookiesx: + with open('robot.TXT', 'a', encoding='utf-8') as fs: + fs.write(f"{str(get_tehran_time())} : {value} : {'Unable to access a Google product'}\n") + print('Unable to access a Google product') + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="Unable to access a Google product") + clear_selected_folders([value]) + continue + if 'robot' in check_cookiesx: + with open('robot.TXT', 'a', encoding='utf-8') as fs: + fs.write(f"{str(get_tehran_time())} : {value} : {'500 Internal Server Error'}\n") + print('robot') + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="robot") + clear_selected_folders([value]) + continue + print(check_cookiesx) + if check_cookiesx==str(False): + with open('LOGS_forse.TXT', 'a', encoding='utf-8') as fs: + fs.write(f"{str(get_tehran_time())} : {value} : {'fail_cookes'}\n") + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="fail_cookes") + print('fail_cookes') + clear_selected_folders([value]) + continue + + try: + data = eval(check_cookiesx) + check_cookiesx = json.dumps(data, indent=4) + except Exception as e: + with open('LOGS_cookes.TXT', 'a', encoding='utf-8') as fs: + fs.write(f"{str(get_tehran_time())} : {value} : {e}\n") + print('fail_cookes') + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="fail_cookes") + clear_selected_folders([value]) + continue + + manager.update_login_status( + email_id=id_mail, + success=True) + + + send_green_status(server) + result=main(path_png_file,browser,os.path.join(path_file,value),get_cookes=check_cookiesx,codex=codexs,value=value, val2=val2,browser_proxy=browser_proxy) + sleep(10) + # import pdb;pdb.set_trace() + # import pdb;pdb.set_trace() + ################### + # fail_15_send_sec_code_app_code + # if '11111111' in result: + # manager.append_to_history(email_id=id_mail,message="fail_15_send_sec_code_app_code") + # manager.mark_email_finished( + # email_id=id_mail, + #success=True, + # backup_code='fail_15_send_sec_code_app_code' + # ) + # manager.update_login_status( + #email_id=id_mail, + # success=False, + #error_message="fail_15_send_sec_code_app_code") + + # clear_selected_folders([value]) + ################### + if 'ALERT_to_mnay_code_chek' in result: + manager.append_to_history(email_id=id_mail,message="ALERT_to_mnay_code_chek!!") + manager.mark_email_finished( + email_id=id_mail, + success=True, + backup_code='ALERT_to_mnay_code_chek' + ) + manager.update_login_status( + email_id=id_mail, + success=False, + error_message="ALERT_to_mnay_code_chek") + + clear_selected_folders([value]) + if 'ea_created__app_code_nead!!' in result: + #manager.append_to_history(email_id=id_mail,message="ea_created__app_code_nead!!") + manager.mark_email_finished_nime( + email_id=id_mail, + success=True, + backup_code='ea_created__app_code_nead!!' + ) + with open('True.TXT', 'a', encoding='utf-8') as fs: + fs.write(f"{str(get_tehran_time())} : {value} : {result}\n") + clear_selected_folders([value]) + if isinstance(result, list): + with open('True.TXT', 'a', encoding='utf-8') as fs: + fs.write(f"{str(get_tehran_time())} : {value} : {result}\n") + manager.mark_email_finished( + email_id=id_mail, + success=True, + backup_code=result + ) + clear_selected_folders([value]) + if 'fail_mail' in result: + print('gamil or eror 500 png eror :) continue') + continue + + with open('LOGS.TXT', 'a', encoding='utf-8') as fs: + + fs.write(f"{str(get_tehran_time())} : {value} : {result}\n") + manager.append_to_history(email_id=id_mail,message=result) + file_data["username"]=value + + file_data["totp"]=result + file_data["time"]=get_tehran_time() + try: + + file_name = 'out_put_ea_with_gmail.xlsx' + if os.path.exists(file_name): + df_existing = pd.read_excel(file_name) + df_new = pd.DataFrame([file_data]) + df_updated = pd.concat([df_existing, df_new], ignore_index=True) + else: + df_updated = pd.DataFrame([file_data]) + df_updated.to_excel(file_name, index=False) + chek_sum=False + codexs.end() + except: + pass + try: + + with open('LOGS_forse.TXT', 'r', encoding='utf-8') as fsx: + + bsxs=fsx.read() + except: + with open('LOGS_forse.TXT', 'w', encoding='utf-8') as fsx: + pass + with open('LOGS_forse.TXT', 'r', encoding='utf-8') as fsx: + + bsxs=fsx.read() + ################################################# + try: + + with open('LOGS.TXT', 'r', encoding='utf-8') as fsx: + + bs=fsx.read() + except: + with open('LOGS.TXT', 'w', encoding='utf-8') as fsx: + pass + with open('LOGS.TXT', 'r', encoding='utf-8') as fsx: + + bs=fsx.read() + #################################################### + try: + + with open('True.TXT', 'r', encoding='utf-8') as fsx: + + Truex=fsx.read() + except: + with open('True.TXT', 'w', encoding='utf-8') as fsx: + pass + with open('True.TXT', 'r', encoding='utf-8') as fsx: + + Truex=fsx.read() + os.system("taskkill /f /im chrome.exe") + os.system("taskkill /f /im uc_driver.exe") + os.system("taskkill /f /im chromedriver.exe") + sleep(2) + chek_sum=False + group_data.clear()# + except Exception as e: + print(e) + with open('exitlogs.txt','a')as fxs: + fxs.write(str(e)+'\n') + group_data.clear() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..69d1e30 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,15 @@ +psycopg2 +pyautogui +opencv-python +numpy +pyzbar +pandas +requests +pyotp +pyperclip +selenium +seleniumbase +pytz +openpyxl +psutil +python-dotenv \ No newline at end of file