From 52a827beb39f5adbffecca0021ab8292b38c20d4 Mon Sep 17 00:00:00 2001 From: pythonkoft Date: Wed, 8 Oct 2025 19:39:23 +0000 Subject: [PATCH] Update main.py by pass mail --- main.py | 462 ++++++++++++++------------------------------------------ 1 file changed, 110 insertions(+), 352 deletions(-) diff --git a/main.py b/main.py index 6c53829..7fb3153 100644 --- a/main.py +++ b/main.py @@ -154,24 +154,6 @@ class EmailGroupManager: def release_connection(self, conn): if conn: self.pool.putconn(conn) - - def get_open_groups_111(self, server_name: str): - while True: - - conn = self.get_connection() - try: - with conn.cursor() as cur: - cur.execute(""" - SELECT * FROM ea_shadow_tactics - WHERE server_name = %s - AND (is_finished IS NULL OR is_finished IS DISTINCT FROM TRUE) - AND (login_status = TRUE OR login_status IS NULL) - AND group_id IS NOT NULL - AND taken_at IS NULL - """, (server_name,)) - return cur.fetchall() - finally: - self.release_connection(conn) def get_open_groups_1(self, server_name: str): conn = self.get_connection() @@ -183,7 +165,6 @@ class EmailGroupManager: AND (is_finished IS NULL OR is_finished IS DISTINCT FROM TRUE) AND (login_status = TRUE OR login_status IS NULL) AND group_id IS NOT NULL - AND (backup_code IS NULL OR backup_code = '') """, (server_name,)) return cur.fetchall() finally: @@ -214,7 +195,6 @@ class EmailGroupManager: return cur.fetchone()[0] finally: self.release_connection(conn) - def set_taken_at(self, email_id: int): @@ -234,7 +214,6 @@ class EmailGroupManager: 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: @@ -272,8 +251,7 @@ class EmailGroupManager: ] finally: self.release_connection(conn) - - def assign_new_group_old_1(self, server_name: str, group_id: int) -> List[dict]: + def assign_new_group(self, server_name: str, group_id: int) -> List[dict]: conn = self.get_connection() try: with conn.cursor() as cur: @@ -310,40 +288,6 @@ class EmailGroupManager: ] finally: self.release_connection(conn) - def assign_new_group(self, server_name, group_id): - while True: - try: - - conn = self.get_connection() - with conn.cursor() as cur: - cur.execute( - """ - WITH next_emails AS ( - SELECT id FROM ea_shadow_tactics - WHERE - taken_at IS NULL - AND server_name IS NULL - AND (is_finished IS NULL OR is_finished IS DISTINCT FROM TRUE) - AND login_status IS DISTINCT FROM FALSE - AND (backup_code IS NULL OR backup_code = '') - ORDER BY id - LIMIT 5 - FOR UPDATE SKIP LOCKED - ) - UPDATE ea_shadow_tactics - SET taken_at = NOW(), - server_name = %s, - group_id = %s - WHERE id IN (SELECT id FROM next_emails) - RETURNING id; - """, - (server_name, group_id), - ) - updated_ids = [row[0] for row in cur.fetchall()] - conn.commit() - return updated_ids - finally: - self.release_connection(conn) def get_group(self, server_name: str) -> List[dict]: try: if self.has_open_group(server_name): @@ -387,64 +331,54 @@ class EmailGroupManager: self.release_connection(conn) def append_to_history(self, email_id: int, message: str): - while True: - - - try: - conn = self.get_connection() - with conn.cursor() as cur: - timestamp = datetime.utcnow().isoformat() - cur.execute(""" - UPDATE ea_shadow_tactics - SET history = COALESCE(history, '{}'::jsonb) || %s::jsonb - WHERE id = %s - """, (json.dumps({timestamp: message}), email_id)) - conn.commit() - print(f"history آپدیت شد برای ایمیل id={email_id}") - break - finally: - self.release_connection(conn) + 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) def mark_email_finished(self, email_id: int, success: bool, backup_code: Optional[str] = None): - - while True: - conn = self.get_connection() - try: - - with conn.cursor() as cur: - cur.execute(""" - UPDATE ea_shadow_tactics - SET is_finished = TRUE, - finished_at = NOW(), - login_status = %s, - backup_code = %s - WHERE id = %s - """, (success, backup_code, email_id)) - conn.commit() - print(f"ایمیل با id={email_id} با وضعیت login_status={success} فینیش شد.") - break - finally: - self.release_connection(conn) - + 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) def mark_email_finished_nime(self, email_id: int, success: bool, backup_code: Optional[str] = None): - while True: - conn = self.get_connection() - try: - - with conn.cursor() as cur: - cur.execute(""" - UPDATE ea_shadow_tactics - SET is_finished = TRUE, - finished_at = NOW(), - login_status = %s, - backup_code = %s - WHERE id = %s - """, (False, 'ea_created__app_code_nead', email_id)) - conn.commit() - print(f"ایمیل با id={email_id} با وضعیت login_status={success} فینیش شد.") - break - finally: - self.release_connection(conn) + 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) ip_v2ray='http://127.0.0.1:2017' class pool(): @@ -1352,29 +1286,7 @@ class ea_fucking(): except: print(' eror >>> chalenge1_find_next') pass - sleep(30) - for i in range(4): - print(os.path.join(self.path_png_file,r'chalenge1_find_next.PNG')) - try: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chalenge1_find_next.PNG'), confidence=0.8) - pyautogui.click(pyautogui.center(location)) - print(' ok >>> chalenge1_find_next') - #return 'ea_created__app_code_nead!!' - except: - print(' eror >>> chalenge1_find_next') - pass - sleep(30) - try: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chalenge1_find_next.PNG'), confidence=0.8) - pyautogui.click(pyautogui.center(location)) - print(' chalenge1_find_next >>> EROR') - return 'send_code_page_stoped' - #return 'ea_created__app_code_nead!!' - except: - - pass + sleep(55) try: location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) @@ -1573,8 +1485,7 @@ class ea_fucking(): return 'fail_14_tron_on' def get_send_sec_3(self): sleep(10) - if self.dicline()=='Internal Server Error': - return 'Internal Server Error' + if self.dicline()=='Internal Server Error':return 'Internal Server Error' for i in range(10): try: location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'14_tron_on.PNG'), confidence=0.8) @@ -1582,22 +1493,21 @@ class ea_fucking(): pyautogui.click(pyautogui.center(location)) except: pass - - ''' + 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')) try: try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1_2.PNG'), confidence=0.8) + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) if location: pyautogui.click(pyautogui.center(location)) - print('click it chek_True_1') except: try: location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) if location: pyautogui.click(pyautogui.center(location)) - print('click it chek_True_1') except: pass try: @@ -1605,13 +1515,10 @@ class ea_fucking(): location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) if location: pyautogui.click(pyautogui.center(location)) - print('click it chek_True_1') except: pass if location: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_True_1.PNG'), confidence=0.8) pyautogui.click(pyautogui.center(location)) - print('click it chek_True_1') for i in range(6): pyautogui.press('tab') sleep(0.5) @@ -1631,62 +1538,15 @@ class ea_fucking(): except: pass except Exception as e: - print(e) time.sleep(5) continue - import pdb;pdb.set_trace()''' - check_images = ['chek_True_1_2.PNG', 'chek_True_1.PNG'] - - # تلاش برای پیدا کردن یکی از تصاویر True - found = False - for image in check_images: - try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file, image), confidence=0.8) - if location: - pyautogui.click(pyautogui.center(location)) - print(f'Clicked on {image}') - found = True - break - except: - continue - - if found: - # زدن 6 تا tab و 1 enter - for _ in range(6): - pyautogui.press('tab') - sleep(0.5) - #pyautogui.press('enter') - sleep(10) - try: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file, 'towfacktor.PNG'), confidence=0.8) - pyautogui.click(pyautogui.center(location)) - pyautogui.press('tab') - pyautogui.press('enter') - except Exception as e: - print('eror ==========towfacktor=============',e) - sleep(10) - pyautogui.press('enter') - # تلاش برای پیدا کردن send_code_new.PNG - sleep(10) - for _ in range(10): - try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file, 'send_code_new.PNG'), confidence=0.8) - if location: - pyautogui.click(pyautogui.center(location)) - return True - except: - continue return 'fail_15_send_sec_code_app_code' # https://myaccount.ea.com/cp-ui/aboutme/index - - def handel_page_and_code(self,codex,value,val2): - sleep(50) + sleep(30) codex.end() codex=Gmail(value,val2,browser_proxy=browser_proxy) codes='' - for i in range(2): try: @@ -1721,10 +1581,8 @@ class ea_fucking(): return 'fail_get_code' chek='' - #import pdb;pdb.set_trace() - sleep(5) for i in range(30): - smb=False + print(os.path.join(self.path_png_file,r'veryfy_idyntt.PNG')) try: @@ -1740,23 +1598,19 @@ class ea_fucking(): pass try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'box_for_codee.PNG'), confidence=0.8) - smb=True + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'veryfy_idyntt.PNG'), confidence=0.8) except: pass if location: pyautogui.click(pyautogui.center(location)) for i in range(3): - if smb==True: - pass - else: - pyautogui.press('tab') + pyautogui.press('tab') sleep(0.5) - print('input code selcted',i) + for i_code in code: pyautogui.write(i_code) - print('handel_page_and_code mission 21 next !!!!',i_code) + print('handel_page_and_code mission 21 next !!!!') pyautogui.press('tab') pyautogui.press('enter') sleep(5) @@ -1799,40 +1653,42 @@ class ea_fucking(): continue except: pass + + 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') - - try: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) - chek=True - break - except: - pass - try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'chek_tow_factor_1.PNG'), confidence=0.8) - chek=True - break - except: - pass - try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'one_trn.PNG'), confidence=0.8) - chek=True - break - except: - pass + 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 + break + except: + pass + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'one_trn.PNG'), confidence=0.8) + chek=True + break + except: + pass if chek==True: break else: - # import pdb;pdb.set_trace() return 'faill_all_code' except Exception as e: time.sleep(5) - print(e) - import pdb;pdb.set_trace() continue - import pdb;pdb.set_trace() if chek==True: pass else: @@ -1840,38 +1696,22 @@ class ea_fucking(): sleep(10) chek22='' for i in range(30): - #if self.dicline()=='Internal Server Error':return 'Internal Server Error' + if self.dicline()=='Internal Server Error':return 'Internal Server Error' print(os.path.join(self.path_png_file,r'one_trn.PNG')) try: try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) - chek22=True - break - except: - pass - try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'one_trn.PNG'), confidence=0.8) except: location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'one_trn.PNG'), confidence=0.8) if location: pyautogui.click(pyautogui.center(location)) - print('handel_page_and_code mission 3 next !!!!') chek22=True break #https://e1_1_dcuk_clik.PNG - try: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) - chek22=True - break - except: - pass except Exception as e: - print(e) time.sleep(5) continue @@ -1882,25 +1722,17 @@ class ea_fucking(): return 'Two-factor authentication' chek3='' for i in range(30): - # if self.dicline()=='Internal Server Error':return 'Internal Server Error' + if self.dicline()=='Internal Server Error':return 'Internal Server Error' print(os.path.join(self.path_png_file,r'17_app_authentctor.PNG')) try: try: location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) except: - try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_2app_authentctor.PNG'), confidence=0.8) - except: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_3app_authentctor.PNG'), confidence=0.8) - - + 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)) - pyautogui.press('tab') - pyautogui.press('enter') - pyautogui.press('enter') - + print('handel_page_and_code mission 3 next !!!!') chek3=True break @@ -1908,19 +1740,16 @@ class ea_fucking(): except Exception as e: time.sleep(5) continue - sleep(10) - # import pdb;pdb.set_trace() + #sleep(10) if chek3==True: pass else: return '17_app_authentctor' chek4='' - #self.dicline() - '''for i in range(30): + self.dicline() + for i in range(30): if self.dicline()=='Internal Server Error':return 'Internal Server Error' print(os.path.join(self.path_png_file,r'18_send_code.PNG.PNG.PNG')) - pyautogui.press('down') - pyautogui.press('down') try: try: @@ -1973,12 +1802,10 @@ class ea_fucking(): pass else: return '18_send_code' - sleep(10)''' + sleep(10) chek5='' for i in range(30): - # pyautogui.press('down') - # pyautogui.press('down') - # if self.dicline()=='Internal Server Error':return 'Internal Server Error' + if self.dicline()=='Internal Server Error':return 'Internal Server Error' print(os.path.join(self.path_png_file,r'19_continue.PNG.PNG.PNG.PNG')) try: try: @@ -1995,23 +1822,7 @@ class ea_fucking(): #https://e1_1_dcuk_clik.PNG except Exception as e: time.sleep(5) - - try: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_app_authentctor.PNG'), confidence=0.8) - except: - try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_2app_authentctor.PNG'), confidence=0.8) - except: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'17_3app_authentctor.PNG'), confidence=0.8) - - if location: - pyautogui.click(pyautogui.center(location)) - pyautogui.press('tab') - pyautogui.press('enter') - print('handel_page_and_code mission 3 next !!!!') - - continue + continue if chek5==True: pass else: @@ -2027,11 +1838,8 @@ class ea_fucking(): else: return 'click_code' chek6='' - sleep(8) for i in range(30): - - - #if self.dicline()=='Internal Server Error':return 'Internal Server Error' + if self.dicline()=='Internal Server Error':return 'Internal Server Error' print(os.path.join(self.path_png_file,r'komaki.PNG.PNG.PNG.PNG.PNG')) try: try: @@ -2039,13 +1847,9 @@ class ea_fucking(): location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'komaki.PNG'), confidence=0.8) if location: pyautogui.click(pyautogui.center(location)) - sleep(1) pyautogui.press('tab') - sleep(1) pyautogui.press('tab') - sleep(1) pyautogui.press('tab') - sleep(1) pyautogui.write(totx) print('handel_page_and_code mission 3 next !!!!') chek6=True @@ -2057,13 +1861,9 @@ class ea_fucking(): location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'komaki.PNG'), confidence=0.8) if location: pyautogui.click(pyautogui.center(location)) - sleep(1) pyautogui.press('tab') - sleep(1) pyautogui.press('tab') - sleep(1) pyautogui.press('tab') - sleep(1) pyautogui.write(totx) print('handel_page_and_code mission 3 next !!!!') chek6=True @@ -2096,10 +1896,7 @@ class ea_fucking(): return 'input_bouten1' chek7='' #spam = pyperclip.paste() - sleep(8) for i in range(30): - pyautogui.press('down') - pyautogui.press('down') print(os.path.join(self.path_png_file,r'20_turn_on_login.PNG.PNG.PNG.PNG')) try: try: @@ -2124,11 +1921,6 @@ class ea_fucking(): chek8='' #spam = pyperclip.paste() for i in range(30): - pyautogui.press('down') - pyautogui.press('down') - pyautogui.press('down') - pyautogui.press('down') - time.sleep(10) print(os.path.join(self.path_png_file,r'vew_back_up.PNG.PNG.PNG.PNG.PNG')) try: try: @@ -2137,7 +1929,6 @@ class ea_fucking(): except: location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'vew_back_up.PNG'), confidence=0.8) if location: - pyautogui.click(pyautogui.center(location)) pyautogui.click(pyautogui.center(location)) chek8=True print('handel_page_and_code mission 3 next !!!!') @@ -2146,7 +1937,6 @@ class ea_fucking(): except Exception as e: time.sleep(5) continue - #back_done.PNG if chek8==True: pass else: @@ -2158,29 +1948,12 @@ class ea_fucking(): copied_text = pyperclip.paste() pattern = r'\d+\.\d+' codes = str(re.findall(pattern, copied_text)) - if len(codes)==0: - try: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'vew_back_up.PNG'), confidence=0.8) - pyautogui.press('tab') - pyautogui.press('enter') - except: - pass - time.sleep(10) - pyautogui.hotkey('ctrl', 'a') - pyautogui.hotkey('ctrl', 'c') - time.sleep(2) - copied_text = pyperclip.paste() - pattern = r'\d+\.\d+' - codes = str(re.findall(pattern, copied_text)) - #\d+\.\d+ try: return [tot,'$$',codes] except: return 'tot' - def chek_by_pdb(self,name): time.sleep(5) return name @@ -2215,31 +1988,19 @@ class ea_fucking(): pass ########################################### ########################################### - try: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_base.PNG'), confidence=0.8) - - flag1=True + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) except: pass - try: - if flag1==True: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3.PNG'), confidence=0.8) - pyautogui.click(pyautogui.center(location)) + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3_test.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) except: pass - try: - if flag1==True: - - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3_test.PNG'), confidence=0.8) - pyautogui.click(pyautogui.center(location)) - except: - pass - try: - if flag1==True: - location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3_1test.PNG'), confidence=0.8) - pyautogui.click(pyautogui.center(location)) + try: + location = pyautogui.locateOnScreen(os.path.join(self.path_png_file,r'decline_3_1test.PNG'), confidence=0.8) + pyautogui.click(pyautogui.center(location)) except: pass @@ -2316,9 +2077,9 @@ class Gmail: self.driver.switch_to.window(self.driver.window_handles[0]) - #if "Verify" in self.driver.page_source: - # self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) - # return 'robot' + if "Verify" in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) + return 'robot' if "Verify it" in self.driver.page_source: self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) return 'robot' @@ -2407,12 +2168,13 @@ class Gmail: return 'robot' except: pass - #if "Verify" in self.driver.page_source: - # self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) - # return 'robot' + ''' if "Verify" in self.driver.page_source: + self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) + return 'robot' if "Verify it" in self.driver.page_source: self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}verify.png")) return 'robot' + ''' if 'Wrong password. Try again or click Forgot password to reset it.' in self.driver.page_source: self.driver.save_screenshot(os.path.join(os.getcwd(),'picher',f"_{self.name}_pasword_eror.png")) return 'pas_eror' @@ -3684,9 +3446,6 @@ if __name__ == "__main__": send_green_status(server) result=main(path_png_file,browser,os.path.join(path_file,value),get_cookes=check_cookiesx,codex=codexs,value=value, val2=val2,browser_proxy=browser_proxy) - sleep(10) - # import pdb;pdb.set_trace() - # import pdb;pdb.set_trace() ################### # fail_15_send_sec_code_app_code # if '11111111' in result: @@ -3806,4 +3565,3 @@ if __name__ == "__main__": print(e) with open('exitlogs.txt','a')as fxs: fxs.write(str(e)+'\n') - group_data.clear()