2025-08-15 20:10:29 +00:00
import pyautogui , os , time , subprocess , random , pyotp , re , pyperclip
2025-11-07 16:15:22 +00:00
import cv2 ##
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
import os
import json
import time
import re
from pathlib import Path
from camoufox . sync_api import Camoufox
import pdb
2025-11-07 16:15:22 +00:00
import os
import time
import traceback
import psutil
import pandas as pd
from multiprocessing import Process
2025-11-06 14:18:41 +00:00
#from playwright.sync_api import Keys
import time
2025-08-15 20:10:29 +00:00
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 ( " تمام پروسههای مرتبط با تور بررسی شدند. " )
2025-11-06 14:18:41 +00:00
import time
import platform
def minimize_camoufox ( title_hint = None , profile_path = None , wait = 0.3 ) :
"""
ویندوز : پنجره Camoufox / Firefox را مینی مایز می کند .
- title_hint : رشته ای از عنوان پنجره ( مثلا ً " Camoufox " یا نام پروفایل )
- profile_path : اگر مسیر پروفایل را می دانی ، کمک می کند PID درست پیدا شود ( اختیاری )
خروجی : True اگر موفق شود ، وگرنه False
"""
if platform . system ( ) . lower ( ) != " windows " :
return False
# سعی 1: با عنوان پنجره (سریع و ساده)
try :
import pygetwindow as gw
titles = gw . getAllTitles ( )
if title_hint :
candidates = [ t for t in titles if t and title_hint . lower ( ) in t . lower ( ) ]
else :
# اگر هینت ندادید، «Camoufox» را هدف میگیرد
candidates = [ t for t in titles if t and " camoufox " in t . lower ( ) ]
for t in candidates :
try :
w = gw . getWindowsWithTitle ( t ) [ 0 ]
w . minimize ( )
time . sleep ( wait )
return True
except Exception :
continue
except Exception :
# pygetwindow نصب نیست یا مشکلی داشت -> میریم سراغ روش بعدی
pass
# سعی 2: با PID پروسه و مینیمایز همهی hwndه ا ی مربوط (پایدارتر)
try :
import psutil
import win32gui , win32con , win32process
target_pids = set ( )
# پیدا کردن پروسهها از روی نام/cmdline
for proc in psutil . process_iter ( [ ' pid ' , ' name ' , ' cmdline ' ] ) :
try :
name = ( proc . info . get ( ' name ' ) or ' ' ) . lower ( )
cmd = ' ' . join ( proc . info . get ( ' cmdline ' ) or [ ] ) . lower ( )
good_name = ( ' camoufox ' in name ) or ( ' camoufox ' in cmd ) or ( ' firefox ' in name )
good_profile = ( profile_path and profile_path . lower ( ) in cmd )
# اگر نام درست بود، یا مسیر پروفایل در cmdline دیده شد، این PID را هدف بگیر
if good_name or good_profile :
target_pids . add ( proc . info [ ' pid ' ] )
except ( psutil . NoSuchProcess , psutil . AccessDenied ) :
continue
if not target_pids :
return False
hwnds = [ ]
def enum_handler ( hwnd , result_list ) :
try :
_ , pid = win32process . GetWindowThreadProcessId ( hwnd )
if pid in target_pids and win32gui . IsWindowVisible ( hwnd ) and win32gui . GetWindowText ( hwnd ) :
result_list . append ( hwnd )
except Exception :
pass
win32gui . EnumWindows ( enum_handler , hwnds )
if not hwnds :
time . sleep ( 0.5 )
win32gui . EnumWindows ( enum_handler , hwnds )
if not hwnds :
return False
ok = False
for h in hwnds :
try :
win32gui . ShowWindow ( h , win32con . SW_MINIMIZE )
ok = True
except Exception :
continue
time . sleep ( wait )
return ok
except Exception :
return False
2025-08-15 20:10:29 +00:00
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_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
""" , (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 )
2025-10-08 19:39:23 +00:00
def assign_new_group ( self , server_name : str , group_id : int ) - > List [ dict ] :
2025-08-15 20:10:29 +00:00
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 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 ) :
2025-10-08 19:39:23 +00:00
conn = self . get_connection ( )
try :
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 } " )
finally :
self . release_connection ( conn )
2025-08-15 20:10:29 +00:00
def mark_email_finished ( self , email_id : int , success : bool , backup_code : Optional [ str ] = None ) :
2025-10-08 19:39:23 +00:00
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 } فینیش شد. " )
finally :
self . release_connection ( conn )
2025-08-15 20:10:29 +00:00
def mark_email_finished_nime ( self , email_id : int , success : bool , backup_code : Optional [ str ] = None ) :
2025-10-08 19:39:23 +00:00
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 } فینیش شد. " )
finally :
self . release_connection ( conn )
2025-08-15 20:10:29 +00:00
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 ( " \n Process stopped by user. " )
def load_browser_windows ( self , path ) :
# print(codex,'--------------')
print ( path )
2025-11-06 14:18:41 +00:00
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
2025-08-15 20:10:29 +00:00
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 ' ) )
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
try :
try :
2025-11-06 14:18:41 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 2_dcuk_clik.PNG ' ) , confidence = 0.8 )
if location :
pyautogui . click ( pyautogui . center ( location ) )
return True
2025-08-15 20:10:29 +00:00
except :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 1_1_dcuk_clik.PNG ' ) , confidence = 0.8 )
2025-11-06 14:18:41 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
return True
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 1_dcuk_clik.PNG ' ) , confidence = 0.8 )
if location :
pyautogui . click ( pyautogui . center ( location ) )
return True
except :
pass
2025-08-15 20:10:29 +00:00
except Exception as e :
2025-11-06 14:18:41 +00:00
print ( e )
2025-08-15 20:10:29 +00:00
time . sleep ( 5 )
continue
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 " )
2025-11-06 14:18:41 +00:00
time . sleep ( 15 )
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
except Exception as e :
time . sleep ( 5 )
continue
return ' click_gmail '
def chek_logo ( self ) :
cont = 0
2025-11-06 14:18:41 +00:00
sleep ( 30 )
#input('2222')
2025-08-15 20:10:29 +00:00
for i in range ( 15 ) :
#fail_mail.PNG
print ( os . path . join ( self . path_png_file , r ' ea_logo.PNG ' ) )
2025-11-06 14:18:41 +00:00
try :
print ( ' start chek ' )
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' chalenge1_find_next.PNG ' ) , confidence = 0.8 )
if location :
return ' jump_to_sec '
except :
pass
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-10-13 09:50:23 +00:00
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
for i in range ( 9 ) :
2025-08-15 20:10:29 +00:00
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 ' )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
#return 'ea_created__app_code_nead!!'
except :
print ( ' eror >>> chalenge1_find_next ' )
pass
2025-10-08 19:39:23 +00:00
sleep ( 55 )
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
# codex.end()
# codex=Gmail(value,val2,browser_proxy=browser_proxy)
2025-08-15 20:10:29 +00:00
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 ' )
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-10-08 19:39:23 +00:00
if self . dicline ( ) == ' Internal Server Error ' : return ' Internal Server Error '
2025-08-15 20:10:29 +00:00
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
2025-10-08 19:39:23 +00:00
for i in range ( 15 ) :
if self . dicline ( ) == ' Internal Server Error ' : return ' Internal Server Error '
print ( os . path . join ( self . path_png_file , r ' 15_send_sec_code_app_code.PNG ' ) )
2025-08-15 20:10:29 +00:00
try :
try :
2025-10-08 19:39:23 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' chek_True_1.PNG ' ) , confidence = 0.8 )
2025-08-15 20:10:29 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
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 ) )
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 ) )
except :
pass
if location :
pyautogui . click ( pyautogui . center ( location ) )
for i in range ( 6 ) :
2025-11-07 11:33:13 +00:00
try :
# towfacktor.PNG
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' towfacktor.PNG ' ) , confidence = 0.8 )
if location :
pyautogui . click ( pyautogui . center ( location ) )
pyautogui . press ( ' tab ' )
pyautogui . press ( ' enter ' )
print ( ' find towfacktor !!!!!!!!!!!! ' )
break
# print('find towfacktor !!!!!!!!!!!!')
except :
pass
2025-08-15 20:10:29 +00:00
pyautogui . press ( ' tab ' )
sleep ( 0.5 )
pyautogui . press ( ' enter ' )
# return True
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 :
time . sleep ( 5 )
continue
return ' fail_15_send_sec_code_app_code '
# https://myaccount.ea.com/cp-ui/aboutme/index
2025-11-06 14:18:41 +00:00
def handel_page_and_code_send_code ( self , codex , value , val2 ) :
2025-10-08 19:39:23 +00:00
sleep ( 30 )
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
return code
codes = True
return code
2025-08-15 20:10:29 +00:00
except :
codex . end ( )
codex = Gmail ( value , val2 , browser_proxy = browser_proxy )
print ( ' eror ' )
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
return ' fail_get_code '
2025-11-06 14:18:41 +00:00
def handel_page_and_code_write_code ( self , code ) :
2025-08-15 20:10:29 +00:00
chek = ' '
for i in range ( 30 ) :
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 :
2025-10-08 19:39:23 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' veryfy_idyntt.PNG ' ) , confidence = 0.8 )
2025-08-15 20:10:29 +00:00
except :
pass
if location :
pyautogui . click ( pyautogui . center ( location ) )
for i in range ( 3 ) :
2025-10-08 19:39:23 +00:00
pyautogui . press ( ' tab ' )
2025-08-15 20:10:29 +00:00
sleep ( 0.5 )
2025-10-08 19:39:23 +00:00
2025-08-15 20:10:29 +00:00
for i_code in code :
2025-11-06 14:18:41 +00:00
pyautogui . write ( i_code . replace ( ' EA ' , ' ' ) )
2025-10-08 19:39:23 +00:00
print ( ' handel_page_and_code mission 21 next !!!! ' )
2025-08-15 20:10:29 +00:00
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
2025-10-08 19:39:23 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
sleep ( 5 )
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 16_submit.PNG ' ) , confidence = 0.8 )
print ( ' code eror 16_submit ' )
pyautogui . hotkey ( ' ctrl ' , ' a ' )
pyautogui . press ( ' backspace ' )
continue
except :
pass
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' chek_tow_factor_1.PNG ' ) , confidence = 0.8 )
chek = True
2025-11-06 14:18:41 +00:00
return True
2025-10-08 19:39:23 +00:00
except :
pass
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' one_trn.PNG ' ) , confidence = 0.8 )
chek = True
2025-11-06 14:18:41 +00:00
return True
2025-10-08 19:39:23 +00:00
except :
2025-11-06 14:18:41 +00:00
pass
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' tow_factor__.PNG ' ) , confidence = 0.8 )
chek = True
return True
except :
pass
#tow_factor__.PNG
2025-08-15 20:10:29 +00:00
if chek == True :
2025-11-06 14:18:41 +00:00
return True
2025-08-15 20:10:29 +00:00
else :
return ' faill_all_code '
except Exception as e :
time . sleep ( 5 )
continue
2025-11-06 14:18:41 +00:00
def handel_page_and_code_one_trn ( self ) :
2025-08-15 20:10:29 +00:00
for i in range ( 30 ) :
2025-10-08 19:39:23 +00:00
if self . dicline ( ) == ' Internal Server Error ' : return ' Internal Server Error '
2025-08-15 20:10:29 +00:00
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 ' one_trn.PNG ' ) , confidence = 0.8 )
2025-11-06 14:18:41 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek22 = True
return True
2025-08-15 20:10:29 +00:00
except :
2025-11-06 14:18:41 +00:00
try :
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 !!!! ' )
return True
except :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' tow_factor__.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 !!!! ' )
chek22 = True
return True
2025-08-15 20:10:29 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
print ( ' handel_page_and_code mission 3 next !!!! ' )
2025-11-06 14:18:41 +00:00
return True
2025-08-15 20:10:29 +00:00
break
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
except Exception as e :
time . sleep ( 5 )
continue
2025-11-06 14:18:41 +00:00
return ' Two-factor authentication '
def handel_page_and_codeapp_authentctor ( self ) :
2025-08-15 20:10:29 +00:00
for i in range ( 30 ) :
2025-11-06 14:18:41 +00:00
#if self.dicline()=='Internal Server Error':return 'Internal Server Error'
2025-08-15 20:10:29 +00:00
print ( os . path . join ( self . path_png_file , r ' 17_app_authentctor.PNG ' ) )
try :
2025-11-06 14:18:41 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( path_png_file , r ' app_authentctor__komaki.PNG ' ) , confidence = 0.8 )
if location :
pyautogui . click ( pyautogui . center ( location ) )
pyautogui . press ( ' tab ' )
sleep ( 1 )
pyautogui . press ( ' tab ' )
sleep ( 1 )
pyautogui . press ( ' right ' )
sleep ( 1 )
pyautogui . press ( ' tab ' )
sleep ( 1 )
pyautogui . press ( ' enter ' )
sleep ( 15 )
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 19_continue.PNG ' ) , confidence = 0.8 )
if location :
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek3 = True
return True
except :
pass
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 19_continue__.PNG ' ) , confidence = 0.8 )
if location :
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek3 = True
return True
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 !!!! ' )
chek3 = True
return True
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 !!!! ' )
chek3 = True
return True
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 !!!! ' )
chek3 = True
return True
except :
pass
#!!!!!!!!!!!!!!!!!!
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 19_continue.PNG ' ) , confidence = 0.8 )
if location :
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek3 = True
return True
except :
pass
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 19_continue__.PNG ' ) , confidence = 0.8 )
if location :
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek3 = True
return True
except :
pass
#!!!!!!!!!!!!!!!!!!
''' try:
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( path_png_file , r ' 17_app_authentctor.PNG ' ) , confidence = 0.8 )
if location :
pyautogui . click ( pyautogui . center ( location ) )
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek3 = True
break
2025-08-15 20:10:29 +00:00
except :
2025-11-06 14:18:41 +00:00
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 17_app_authentctor.PNG ' ) , confidence = 0.8 )
if location :
pyautogui . click ( pyautogui . center ( location ) )
2025-10-08 19:39:23 +00:00
2025-11-06 14:18:41 +00:00
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek3 = True
break
except :
pass
try :
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 ) )
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek3 = True
break
except :
pass
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' 17_2app_authentctor.PNG ' ) , confidence = 0.8 )
if location :
pyautogui . click ( pyautogui . center ( location ) )
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek3 = True
break
except :
pass '''
2025-08-15 20:10:29 +00:00
except Exception as e :
time . sleep ( 5 )
continue
2025-11-06 14:18:41 +00:00
return ' 17_app_authentctor '
def handel_page_and_code_19_continue ( self ) :
sleep ( 10 )
2025-10-08 19:39:23 +00:00
for i in range ( 30 ) :
2025-11-06 14:18:41 +00:00
# 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 ' ) )
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
#try:#19_continue__.PNG
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
# location = pyautogui.locateOnScreen(os.path.join(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
#eturn True
#except:
#pass
try :
location = pyautogui . locateOnScreen ( os . path . join ( path_png_file , r ' 19_continue__.PNG ' ) , confidence = 0.8 )
2025-08-15 20:10:29 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
print ( ' handel_page_and_code mission 3 next !!!! ' )
2025-11-06 14:18:41 +00:00
return True
2025-08-15 20:10:29 +00:00
except :
pass
try :
2025-11-06 14:18:41 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( path_png_file , r ' su_contuinue.PNG ' ) , confidence = 0.8 )
2025-08-15 20:10:29 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
print ( ' handel_page_and_code mission 3 next !!!! ' )
2025-11-06 14:18:41 +00:00
return True
2025-08-15 20:10:29 +00:00
except :
2025-11-06 14:18:41 +00:00
pass
2025-08-15 20:10:29 +00:00
except Exception as e :
time . sleep ( 5 )
continue
2025-11-06 14:18:41 +00:00
return ' 19_continue '
def handel_page_and_code_komaki_write_code ( self ) :
2025-08-15 20:10:29 +00:00
tot = self . qr_code ( )
2025-11-06 14:18:41 +00:00
self . tot = tot
2025-08-15 20:10:29 +00:00
sleep ( 3 )
totx = self . top ( tot )
for i in range ( 30 ) :
2025-11-06 14:18:41 +00:00
#if self.dicline()=='Internal Server Error':return 'Internal Server Error'
2025-08-15 20:10:29 +00:00
print ( os . path . join ( self . path_png_file , r ' komaki.PNG.PNG.PNG.PNG.PNG ' ) )
try :
try :
2025-11-06 14:18:41 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' komaki__1.PNG ' ) , confidence = 0.8 )
2025-08-15 20:10:29 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
pyautogui . press ( ' tab ' )
pyautogui . press ( ' tab ' )
pyautogui . press ( ' tab ' )
pyautogui . write ( totx )
2025-11-06 14:18:41 +00:00
pyautogui . press ( ' tab ' )
pyautogui . press ( ' enter ' )
2025-08-15 20:10:29 +00:00
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek6 = True
2025-11-06 14:18:41 +00:00
return True
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
pyautogui . press ( ' tab ' )
pyautogui . press ( ' enter ' )
2025-08-15 20:10:29 +00:00
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek6 = True
2025-11-06 14:18:41 +00:00
return True
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
pyautogui . press ( ' tab ' )
pyautogui . press ( ' enter ' )
2025-08-15 20:10:29 +00:00
print ( ' handel_page_and_code mission 3 next !!!! ' )
chek6 = True
2025-11-06 14:18:41 +00:00
return True
2025-08-15 20:10:29 +00:00
except :
pass
except Exception as e :
time . sleep ( 5 )
continue
2025-11-06 14:18:41 +00:00
return ' input_bouten1 '
def handel_page_and_code_vew_back_up ( self ) :
2025-08-15 20:10:29 +00:00
for i in range ( 30 ) :
print ( os . path . join ( self . path_png_file , r ' vew_back_up.PNG.PNG.PNG.PNG.PNG ' ) )
try :
try :
2025-11-06 14:18:41 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' ttttte.PNG ' ) , confidence = 0.8 )
if location :
pyautogui . click ( pyautogui . center ( location ) )
pyautogui . press ( ' tab ' )
sleep ( 1 )
pyautogui . press ( ' tab ' )
sleep ( 1 )
pyautogui . press ( ' enter ' )
sleep ( 5 )
return True
2025-08-15 20:10:29 +00:00
except :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' vew_back_up.PNG ' ) , confidence = 0.8 )
2025-11-06 14:18:41 +00:00
if location :
pyautogui . click ( pyautogui . center ( location ) )
return True
2025-08-15 20:10:29 +00:00
except Exception as e :
time . sleep ( 5 )
continue
2025-11-06 14:18:41 +00:00
return ' vew_back_up '
def handel_page_and_code ( self , codex , value , val2 ) :
# 1
try :
r = self . handel_page_and_code_send_code ( codex , value , val2 )
except Exception as e :
print ( f " [ERROR] handel_page_and_code_send_code: { e } " )
return " handel_page_and_code_send_code " , f " exception: { e } "
# if r is not True:
# print(f"[ERROR] handel_page_and_code_send_code: {r}")
# return "handel_page_and_code_send_code", str(r)
# time.sleep(10)
# 2
try :
r = self . handel_page_and_code_write_code ( r )
except Exception as e :
print ( f " [ERROR] handel_page_and_code_write_code: { e } " )
return " handel_page_and_code_write_code " , f " exception: { e } "
if r is not True :
print ( f " [ERROR] handel_page_and_code_write_code: { r } " )
return " handel_page_and_code_write_code " , str ( r )
time . sleep ( 10 )
# 3
try :
pyautogui . hotkey ( ' ctrl ' , ' - ' )
except Exception as e :
print ( f " [ERROR] pyautogui ctrl- #1: { e } " )
return " pyautogui_ctrl_minus_1 " , f " exception: { e } "
time . sleep ( 10 )
# 4
try :
pyautogui . hotkey ( ' ctrl ' , ' - ' )
except Exception as e :
print ( f " [ERROR] pyautogui ctrl- #2: { e } " )
return " pyautogui_ctrl_minus_2 " , f " exception: { e } "
time . sleep ( 10 )
# 5
try :
r = self . handel_page_and_code_one_trn ( )
except Exception as e :
print ( f " [ERROR] handel_page_and_code_one_trn: { e } " )
return " handel_page_and_code_one_trn " , f " exception: { e } "
if r is not True :
print ( f " [ERROR] handel_page_and_code_one_trn: { r } " )
return " handel_page_and_code_one_trn " , str ( r )
time . sleep ( 10 )
# 6
try :
r = self . handel_page_and_codeapp_authentctor ( )
except Exception as e :
print ( f " [ERROR] handel_page_and_codeapp_authentctor: { e } " )
return " handel_page_and_codeapp_authentctor " , f " exception: { e } "
if r is not True :
print ( f " [ERROR] handel_page_and_codeapp_authentctor: { r } " )
return " handel_page_and_codeapp_authentctor " , str ( r )
time . sleep ( 10 )
# 7
try :
r = self . handel_page_and_code_19_continue ( )
except Exception as e :
print ( f " [ERROR] handel_page_and_code_19_continue: { e } " )
return " handel_page_and_code_19_continue " , f " exception: { e } "
if r is not True :
print ( f " [ERROR] handel_page_and_code_19_continue: { r } " )
return " handel_page_and_code_19_continue " , str ( r )
time . sleep ( 10 )
# 8
try :
r = self . handel_page_and_code_komaki_write_code ( )
except Exception as e :
print ( f " [ERROR] handel_page_and_code_komaki_write_code: { e } " )
return " handel_page_and_code_komaki_write_code " , f " exception: { e } "
if r is not True :
print ( f " [ERROR] handel_page_and_code_komaki_write_code: { r } " )
return " handel_page_and_code_komaki_write_code " , str ( r )
time . sleep ( 10 )
# 9
try :
r = self . handel_page_and_code_vew_back_up ( )
except Exception as e :
print ( f " [ERROR] handel_page_and_code_vew_back_up: { e } " )
return " handel_page_and_code_vew_back_up " , f " exception: { e } "
if r is not True :
print ( f " [ERROR] handel_page_and_code_vew_back_up: { r } " )
return " handel_page_and_code_vew_back_up " , str ( r )
2025-08-15 20:10:29 +00:00
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 :
2025-11-06 14:18:41 +00:00
return [ self . tot , ' $$ ' , codes ]
2025-08-15 20:10:29 +00:00
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 :
2025-10-08 19:39:23 +00:00
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' decline_3.PNG ' ) , confidence = 0.8 )
pyautogui . click ( pyautogui . center ( location ) )
2025-08-15 20:10:29 +00:00
except :
pass
2025-10-08 19:39:23 +00:00
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' decline_3_test.PNG ' ) , confidence = 0.8 )
pyautogui . click ( pyautogui . center ( location ) )
2025-08-15 20:10:29 +00:00
except :
pass
2025-10-08 19:39:23 +00:00
try :
location = pyautogui . locateOnScreen ( os . path . join ( self . path_png_file , r ' decline_3_1test.PNG ' ) , confidence = 0.8 )
pyautogui . click ( pyautogui . center ( location ) )
2025-08-15 20:10:29 +00:00
except :
pass
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
class Gmail :
2025-11-06 14:18:41 +00:00
def __init__ ( self , name , password , browser_proxy = None ) :
2025-08-15 20:10:29 +00:00
self . name = name
2025-11-06 14:18:41 +00:00
self . password = password
self . browser_proxy = browser_proxy
self . flag = ' '
self . flag_user = ' '
self . flag_user_sg = ' '
self . profile_dir = Path ( ' profile ' )
self . picher_dir = Path ( ' picher ' )
self . profile_dir . mkdir ( exist_ok = True )
self . picher_dir . mkdir ( exist_ok = True )
self . user_data_dir = self . profile_dir / self . name
self . is_new_profile = not self . user_data_dir . exists ( )
2025-08-15 20:10:29 +00:00
user_data_dir = os . path . join ( os . getcwd ( ) , ' profile ' , name )
if name not in os . listdir ( os . path . join ( os . getcwd ( ) , ' profile ' ) ) :
2025-11-06 14:18:41 +00:00
self . flag = True
print ( f " [INFO] No profile found for { self . name } . Browser will be visible. " )
else :
2025-11-07 12:16:43 +00:00
2025-11-06 14:18:41 +00:00
print ( f " [INFO] Profile found for { self . name } . Hiding browser window. " )
self . flag = False
browser_args = [ ]
#if not self.is_new_profile:
# browser_args.append("--window-position=-32000,-32000")
# print(f"[INFO] Profile found for {self.name}. Hiding browser window.")
# self.flag=False
# else:
#print(f"[INFO] No profile found for {self.name}. Browser will be visible.")
#self.flag=True
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
self . ctx_manager = Camoufox (
persistent_context = True ,
user_data_dir = str ( self . user_data_dir ) ,
headless = False ,
geoip = False ,
enable_cache = True ,
humanize = True ,
2025-11-07 11:51:41 +00:00
# args=browser_args
2025-08-15 20:10:29 +00:00
)
2025-11-06 14:18:41 +00:00
self . browser_context = self . ctx_manager . start ( )
self . page = self . browser_context . new_page ( )
if self . flag == True :
user = self . send_username ( name )
if user == True :
time . sleep ( 8 )
self . send_pasword ( password )
time . sleep ( 9 )
print ( ' changelanggggggggggggggggggggggggg ' , self . change_lang ( ) )
else :
self . flag_user = False
self . flag_user_sg = user
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
print ( f " [INFO] Browser for { self . name } started. " )
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
def end ( self ) :
""" این متد را برای بستن مرورگر فراخوانی کنید. """
if self . browser_context :
self . browser_context . close ( )
self . browser_context = None
self . page = None
self . ctx_manager = None
print ( f " [INFO] Browser context for { self . name } closed. " )
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
def check_cookies ( self ) :
"""
این تابع فقط وضعیت لاگین را بررسی کرده و کوکی ه ا را برمی گرداند .
فرض بر این است که مراحل لاگین از قبل انجام شده است .
"""
try :
# صبر میکنیم تا پس از لاگین، صفحه به مقصد برسد
time . sleep ( 5 )
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
# به اینباکس میرویم تا ببینیم لاگین موفق بوده یا نه
self . page . goto ( " https://mail.google.com/mail/u/0/#inbox " , wait_until = " domcontentloaded " )
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
if " mail.google.com/mail/u/0/ " in self . page . url :
print ( " [INFO] Login successful. Getting cookies. " )
return self . _get_cookies_or_check_errors ( )
# اگر به اینباکس نرفت، یعنی لاگین ناموفق بوده. خطاها را بررسی میکنیم.
print ( " [INFO] Login failed. Checking for errors... " )
error = self . _check_for_errors ( )
if error :
return error
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
# اگر خطای مشخصی پیدا نشد، یک شکست عمومی را گزارش میدهیم
self . page . screenshot ( path = self . picher_dir / f " _ { self . name } _login_failed.png " )
return ' fail_cookes '
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
except Exception as e :
print ( f " [ERROR] An exception occurred in check_cookies: { e } " )
self . page . screenshot ( path = self . picher_dir / f " _ { self . name } _exception.png " )
return ' fail_cookes '
def _get_cookies_or_check_errors ( self ) :
try :
# تلاش برای رفتن به صفحه ورود (مثل کد اصلی)
self . page . goto ( " https://accounts.google.com/v3/signin/ " , wait_until = " load " , timeout = 10000 )
except Exception as e :
# اگر خطای حلقه رخ داد، نادیده بگیر و ادامه بده
print ( f " [WARN] Redirect loop detected. Proceeding anyway. Error: { e } " )
pass
# صبر میکنیم تا مطمئن شویم وضعیت پایدار است
time . sleep ( 2 )
error = self . _check_for_errors ( )
if error :
return error
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
# در هر صورت، کوکیها را از محیط اصلی بگیرsameSite
cookies = self . browser_context . cookies ( )
keys_to_drop = { ' sameSite ' , ' secure ' , ' httpOnly ' , ' expires ' }
cookies = [ { k : v for k , v in c . items ( ) if k not in keys_to_drop } for c in cookies ]
# شبیهسازی رفتار عجیب کد اصلی برای باز و بسته کردن تب
self . page . goto ( " https://mail.google.com/mail/u/0/#inbox " )
new_page = self . browser_context . new_page ( )
new_page . goto ( " https://www.google.com " )
time . sleep ( 2 )
new_page . close ( )
print ( cookies )
# self.end()
return json . dumps ( cookies , indent = 4 , ensure_ascii = False )
def _check_for_errors ( self ) :
""" این تابع تمام بررسیهای خطای متنی و مبتنی بر عنصر کد اصلی را پوشش میدهد. """
page_content = self . page . content ( )
if " Verify it " in page_content or " Confirm you’ re not a robot " in page_content :
self . page . screenshot ( path = self . picher_dir / f " _ { self . name } verify.png " )
return ' robot '
if ' Wrong password. Try again ' in page_content :
self . page . screenshot ( path = self . picher_dir / f " _ { self . name } _pasword_eror.png " )
return ' pas_eror '
if " Unable to access a Google product " in page_content :
return ' block_acses '
if ' To help keep your account secure ' in page_content :
return ' help keep your account secure '
if ' Couldn’ t find your Google Account ' in page_content or ' find your Google Account ' in page_content :
return ' userx '
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
try :
self . page . locator ( ' //*[@id= " phoneNumberId " ] ' ) . wait_for ( state = " visible " , timeout = 2000 )
print ( ' find ************* phoneNumberId ' )
return ' robot '
except :
pass
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
return None
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
def get_code ( self ) :
try :
try :
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
self . page . goto ( ' https://mail.google.com/mail/u/0/#inbox ' , wait_until = " domcontentloaded " )
except :
pass
time . sleep ( 35 )
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
self . page . reload ( wait_until = " domcontentloaded " )
except :
pass
time . sleep ( 35 )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
elements = self . page . locator ( " //*[contains(text(), ' Your EA Security Code is: ' )] " )
if elements . count ( ) > 0 :
codes = [ ]
for i in range ( elements . count ( ) ) :
text = elements . nth ( i ) . inner_text ( )
data = text . replace ( ' Your EA Security Code is: ' , ' ' )
if data :
print ( data )
codes . append ( data . replace ( ' EA ' , ' ' ) )
if codes :
#
print ( codes )
#
return codes
print ( " [INFO] Full text not found, trying regex... " )
elements = self . page . locator ( " //*[contains(text(), ' EA ' )] " )
codes = [ ]
if elements . count ( ) > 0 :
for i in range ( elements . count ( ) ) :
text = elements . nth ( i ) . inner_text ( )
try :
match = re . findall ( r ' EA (.+): ( \ d+) ' , text )
if match :
code = match [ 0 ] [ 1 ]
if code not in codes :
print ( codes )
codes . append ( code . replace ( ' EA ' , ' ' ) )
except Exception :
2025-08-15 20:10:29 +00:00
continue
2025-11-06 14:18:41 +00:00
#
print ( codes )
return codes if codes else ' continue '
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
except Exception as e :
print ( f " [ERROR] Failed to get code: { e } " )
return ' continue '
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
def send_username ( self , user ) :
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
# #import pdb;pdb.set_trace()
self . page . goto ( " https://accounts.google.com/servicelogin?service=mail " , wait_until = " networkidle " )
time . sleep ( 1 )
email_input = self . page . locator ( " input[type= ' email ' ], input[type= ' text ' ] " ) . first
email_input . wait_for ( state = " visible " , timeout = 15000 )
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
#if 'robot' in self.page.content():
# return 'robot'
email_input . fill ( user )
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
self . page . locator ( " #identifierNext >> text=Next " ) . click ( )
except :
self . page . locator ( " //*[contains(text(), ' Next ' )] " ) . first . click ( )
alert = self . _check_for_errors ( )
if alert == None :
return True
else :
return alert
except Exception as e :
print ( f " [ERROR] Could not send username: { e } " )
2025-08-15 20:10:29 +00:00
return ' Kill '
2025-11-06 14:18:41 +00:00
def send_pasword ( self , pasw ) :
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
password_input = self . page . locator ( " input[name= ' Passwd ' ] " ) . first
# password_input.wait_for(state="visible", timeout=10000)
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
#if 'robot' in self.page.content():
#return 'robot'
password_input . fill ( pasw )
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
self . page . locator ( " #passwordNext >> text=Next " ) . click ( )
except :
self . page . locator ( " //*[contains(text(), ' Next ' )] " ) . first . click ( )
2025-08-15 20:10:29 +00:00
return True
2025-11-06 14:18:41 +00:00
except Exception as e :
print ( f " [ERROR] Could not send password: { e } " )
return ' Kill '
def change_lang ( self ) :
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
self . page . goto ( " https://mail.google.com/mail/u/0/#settings/general " )
time . sleep ( 10 )
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
lang_select = self . page . get_by_role ( " cell " , name = " Gmail display language: " ) . get_by_role ( " combobox " )
lang_select . select_option ( label = " English (US) " )
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
self . page . get_by_role ( " button " , name = " Save Changes " ) . click ( )
2025-08-15 20:10:29 +00:00
except :
pass
2025-11-06 14:18:41 +00:00
time . sleep ( 3 )
#self.page.goto("https://myaccount.google.com/language")
self . page . goto ( " https://myaccount.google.com/language " , wait_until = " domcontentloaded " )
time . sleep ( 5 )
for i in range ( 8 ) :
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
try :
sfg = self . page . locator ( " xpath=//div/button/div " )
sfg . click ( )
xd = True
break
except :
pass
try :
try :
sfg = self . page . locator ( " 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
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
except :
sfg = self . page . locator ( " 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/span/button/div " )
sfg . click ( )
xd = True
break
xd = True
break
except :
pass
# try:
# self.page.locator('html').click()
# self.page.locator('html').press('Tab')
# active_element = self.page.locator(":focus")
## active_element.click()
# xd = True
# break
# except:
# pass
except :
self . page . reload ( )
time . sleep ( 5 )
# فقط روی دکمه "Edit" تمرکز میکنیم و برایش صبر میکنیم
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
time . sleep ( 2 )
# بقیه منطق شما که شکننده است ولی حفظ شده
2025-08-15 20:10:29 +00:00
try :
2025-11-06 14:18:41 +00:00
search_input = self . page . locator ( " input[aria-label*= ' Search ' ] " ) . first
search_input . fill ( " English " )
search_input . press ( " ArrowDown " )
search_input . press ( " Enter " )
2025-08-15 20:10:29 +00:00
except :
2025-11-06 14:18:41 +00:00
active_element = self . page . locator ( " :focus " )
active_element . fill ( " English " )
active_element . press ( " ArrowDown " )
active_element . press ( " Enter " )
time . sleep ( 1 )
self . page . locator ( " //li[58] " ) . first . click ( )
self . page . locator ( " xpath=//div[3]/button/span[5] " ) . click ( )
2025-08-15 20:10:29 +00:00
return True
2025-11-06 14:18:41 +00:00
except Exception as e :
print ( f " [ERROR] Could not change language: { e } " )
# برای دیباگ کردن، یک اسکرینشات بگیر
self . page . screenshot ( path = self . picher_dir / f " _ { self . name } _lang_error.png " )
return False
2025-08-15 20:10:29 +00:00
def status ( self ) :
2025-11-06 14:18:41 +00:00
try :
self . page . goto ( ' https://mail.google.com/mail/u/0/#inbox ' , wait_until = " networkidle " )
time . sleep ( 5 )
if " mail.google.com/mail/u/0/#inbox " in self . page . url :
self . change_lang ( )
return True
return False
except Exception as e :
print ( f " [ERROR] Status check failed: { e } " )
2025-08-15 20:10:29 +00:00
return False
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
sleep ( 15 )
2025-08-15 20:10:29 +00:00
chek_logo = ea . chek_logo ( )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
print ( ' chek_logo >>> ' , chek_logo )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
#if isinstance(chek_logo, str):return chek_logo
2025-11-06 14:18:41 +00:00
send_green_status ( server )
2025-08-15 20:10:29 +00:00
if chek_logo == ' fail_mail ' :
return ' fail_mail '
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
handel_page_and_code = ea . handel_page_and_code ( codex , value , val2 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
###########################################^^^^
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
2025-11-06 14:18:41 +00:00
# #import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
# 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 :
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
#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 )
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
handel_page_and_code = ea . handel_page_and_code ( codex , value , val2 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
###########################################^^^^
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
handel_page_and_code = ea . handel_page_and_code ( codex , value , val2 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
###########################################^^^^
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
2025-11-06 14:18:41 +00:00
# #import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
handel_page_and_code = ea . handel_page_and_code ( codex , value , val2 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
send_green_status ( server )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 ( )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
print ( ' accept >>> ' , accept )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
if ' make_other_time ' == accept :
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
#return 'make_other_time'
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
#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 )
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
handel_page_and_code = ea . handel_page_and_code ( codex , value , val2 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
###########################################^^^^
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
return handel_page_and_code
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
if not accept :
print ( ' accept Failed! ' )
return ' accept Failed '
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
# Click verify
sleep ( 10 )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
creat = ea . creat ( )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 '
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
handel_page_and_code = ea . handel_page_and_code ( codex , value , val2 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
###########################################^^^^
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
return handel_page_and_code
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
print ( ' creat >>> ' , creat )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
if not creat :
print ( ' creat Failed! ' )
return ' creat Failed '
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
sleep ( 10 )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
finsh = ea . finsh ( )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
if isinstance ( finsh , str ) : return finsh
print ( ' finsh >>> ' , finsh )
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
if not finsh :
print ( ' finsh Failed! ' )
return ' finsh Failed '
#######################################$$$$$
2025-11-06 14:18:41 +00:00
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
# #import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
handel_page_and_code = ea . handel_page_and_code ( codex , value , val2 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 '
###########################################^^^^
2025-11-06 14:18:41 +00:00
##import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
return handel_page_and_code
# Open new tab
2025-11-06 14:18:41 +00:00
send_green_status ( server )
if chek_logo == ' jump_to_sec ' :
send_green_status ( server )
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 )
#import pdb;pdb.set_trace()
handel_page_and_code = ea . handel_page_and_code ( codex , value , val2 )
#import pdb;pdb.set_trace()
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
2025-08-15 20:10:29 +00:00
######################################
send_green_status ( server )
if ' click_gmail ' in str ( get_ea ) :
send_green_status ( server )
2025-11-06 14:18:41 +00:00
return ' get_ea Failed___1 '
2025-08-15 20:10:29 +00:00
else :
send_green_status ( server )
print ( ' get_ea Failed! ' )
2025-11-06 14:18:41 +00:00
return ' get_ea Failed___2 '
2025-08-15 20:10:29 +00:00
#########################################################################
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 ' <title>500 Internal Server Error</title> ' 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 ' <title>500 Internal Server Error</title> ' 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())
2025-11-06 14:18:41 +00:00
#codexs=Gmail('eatestfornewbot9@gmail.com','Shwe65544t',browser_proxy='fuck')
2025-08-15 20:10:29 +00:00
#check_cookiesx=str(codexs.check_cookies())
2025-11-07 16:15:22 +00:00
def kill_browser_processes ( ) :
names = [ " chrome.exe " , " chromedriver.exe " , " uc_driver.exe " , " Camoufox.exe " ]
for proc in psutil . process_iter ( [ " pid " , " name " ] ) :
try :
if proc . info [ " name " ] and proc . info [ " name " ] . lower ( ) in [ n . lower ( ) for n in names ] :
proc . kill ( )
except Exception :
pass
2025-08-15 20:10:29 +00:00
2025-11-07 16:15:22 +00:00
def process_emails ( ) :
2025-11-07 16:21:23 +00:00
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 ' )
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#t21993837@gmail.com : xxx093382
#group_data=[{
# "id":'2',
# "email":'eatestfornewbot9@gmail.com' ,
# "email_password": 'pass:aezakmi90',
# }]
# group_data=[{
# "id":'2',
# "email":'tiosondemu1988@gmail.com' ,
#@ "email_password": 'jxDPlX7Kb2',
# }]
#tiosondemu1988@gmail.com:jxDPlX7Kb2:tiosondemu1988rc@hotmail.com
2025-10-13 09:50:23 +00:00
group_data = [ ]
2025-08-15 20:10:29 +00:00
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 " )
2025-11-06 14:18:41 +00:00
os . system ( " taskkill /f /im Camoufox.exe " )
2025-08-15 20:10:29 +00:00
#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 " )
2025-11-06 14:18:41 +00:00
os . system ( " taskkill /f /im Camoufox.exe " )
#input('>>>')
2025-10-13 09:50:23 +00:00
codexs = Gmail ( value , val2 , browser_proxy = browser_proxy )
2025-11-07 16:15:22 +00:00
print ( ' codexs>>>>>>>>>>>>>>> ' , codexs )
2025-11-06 14:18:41 +00:00
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
minimize_camoufox ( title_hint = " Camoufox " )
#print(codexs)
# code=codexs.get_code()
# print(code)
# #import pdb;pdb.set_trace()
# input('>>>')
try :
if codexs . flag_user == False :
check_cookiesx = codexs . flag_user_sg
else :
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
check_cookiesx = ( codexs . check_cookies ( ) )
print ( check_cookiesx )
# #import pdb;pdb.set_trace()
2025-11-07 16:15:22 +00:00
#check_cookiesx=str(codexs.check_cookies())
2025-11-06 14:18:41 +00:00
# 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 ' fail ' 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
2025-08-15 20:10:29 +00:00
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
2025-11-06 14:18:41 +00:00
if ' fail_cookes ' in check_cookiesx :
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 " )
os . system ( " taskkill /f /im Camoufox.exe " )
clear_selected_folders ( [ value ] )
''' with open( ' woring_gmail.txt ' , ' a ' )as gy:
gy . write ( f " { str ( get_tehran_time ( ) ) } : { value } : { ' fail_cookes ' } \n " )
file_data [ " username " ] = value
file_data [ " totp " ] = ' fail_cookes '
file_data [ " time " ] = get_tehran_time ( )
2025-08-15 20:10:29 +00:00
2025-11-06 14:18:41 +00:00
manager . update_login_status (
email_id = id_mail ,
success = False ,
error_message = " fail_cookes " )
clear_selected_folders ( [ value ] )
continue '''
# fail_cookes
#print(check_cookiesx)
#check_cookiesxddd=check_cookiesx
#check_cookiesx=check_cookiesx.replace('"sameSite": "Lax",','',1000).replace('"sameSite": "None",','',1000)
#print(check_cookiesx)
2025-08-15 20:10:29 +00:00
except Exception as e :
2025-11-06 14:18:41 +00:00
print ( e )
2025-08-15 20:10:29 +00:00
#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 :
2025-11-06 14:18:41 +00:00
gy . write ( str ( check_cookiesx ) )
2025-08-15 20:10:29 +00:00
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 } : { ' <title>500 Internal Server Error</title> ' } \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
2025-11-06 14:18:41 +00:00
# try:
# #import pdb;pdb.set_trace()
#ظdata = eval(check_cookiesx)
# check_cookiesx = json.dumps(data, indent=4)
# except Exception as e:
# print('eval eror')
# 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
2025-08-15 20:10:29 +00:00
manager . update_login_status (
email_id = id_mail ,
success = True )
send_green_status ( server )
2025-11-06 14:18:41 +00:00
# #import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
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 )
2025-11-06 14:18:41 +00:00
#import pdb;pdb.set_trace()
2025-08-15 20:10:29 +00:00
###################
# 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 ' )
2025-11-07 16:15:22 +00:00
return str ( e )
2025-11-06 14:18:41 +00:00
2025-11-07 16:15:22 +00:00
if __name__ == " __main__ " :
while True :
p = Process ( target = process_emails )
p . start ( )
p . join ( )
if p . exitcode != 0 :
print ( " [INFO] Process crashed, restarting... " )
kill_browser_processes ( )
time . sleep ( 2 )
else :
print ( " [INFO] Process finished normally, restarting... " )
time . sleep ( 2 )