mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 12:01:51 +09:00
[Update]
This commit is contained in:
parent
92967ed353
commit
495b3a52da
5 changed files with 161 additions and 30 deletions
|
|
@ -4,6 +4,7 @@ from patchright.async_api import async_playwright as async_patchright
|
|||
from lib.agents.find_login_page import find_login_page
|
||||
from lib.browser_use_utils.clean_resources import clean_session_resources
|
||||
from lib.browser_use_utils.get_profile import get_profile
|
||||
from lib.utils.save_oauth_providers import save_oauth_providers
|
||||
|
||||
async def find_sso_list(target_url):
|
||||
session = BrowserSession(
|
||||
|
|
@ -18,29 +19,40 @@ async def find_sso_list(target_url):
|
|||
FINISH = 0
|
||||
|
||||
final_result = None
|
||||
task_queue = []
|
||||
|
||||
# find SSO
|
||||
login_url = target_url
|
||||
state = FIND_LOGIN_PAGE
|
||||
while True:
|
||||
if state == FIND_LOGIN_PAGE:
|
||||
status, response = await find_login_page(
|
||||
is_success, resp = await find_login_page(
|
||||
target_url=target_url,
|
||||
session=session,
|
||||
)
|
||||
if not status:
|
||||
print(f"⚠️ 로그인 페이지 탐지 실패: {target_url} | {response}")
|
||||
if not is_success:
|
||||
print(f"⚠️ 로그인 페이지 탐지 실패: {target_url} | {resp}")
|
||||
state = WHEN_ERROR
|
||||
login_url = resp if resp else target_url
|
||||
state = FIND_SSO_LIST
|
||||
|
||||
if state == FIND_SSO_LIST:
|
||||
print(f"🔎 SSO 목록 찾는 중: {target_url}")
|
||||
await asyncio.sleep(10) # 잠시 대기 후 다음 단계로 넘어감
|
||||
break
|
||||
is_success, resp = await find_sso_list(
|
||||
target_url=login_url,
|
||||
session=session,
|
||||
)
|
||||
if not is_success:
|
||||
print(f"⚠️ SSO 목록 탐지 실패: {target_url} | {resp}")
|
||||
state = WHEN_ERROR
|
||||
final_result = ""
|
||||
state = SAVE_DATA
|
||||
|
||||
if state == SAVE_DATA:
|
||||
print(f"💾 데이터 저장 중: {target_url}")
|
||||
break
|
||||
if not final_result:
|
||||
print(f"⚠️ SSO 목록이 전달되지 않았습니다: {target_url}")
|
||||
state = WHEN_ERROR
|
||||
|
||||
save_oauth_providers(target_url, final_result)
|
||||
state = FINISH
|
||||
|
||||
if state == WHEN_ERROR:
|
||||
print(f"⚠️ 에러 발생: {target_url} | 스캔을 중단합니다.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue