From e42cf3968c798ebf3689447552600d0224e5c97c Mon Sep 17 00:00:00 2001 From: Avi Aminov Date: Tue, 7 Jan 2025 17:27:34 +0200 Subject: [PATCH] - handle case of no MFA - add missing dependency in poetry --- mfa_bomber.py | 5 ++++- pyproject.toml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mfa_bomber.py b/mfa_bomber.py index b2d0b0b..cef48f6 100644 --- a/mfa_bomber.py +++ b/mfa_bomber.py @@ -60,6 +60,10 @@ def get_okta_session(self, username, password): raise TimeoutError() # print(response.json()) + if response.json()['status'] == 'SUCCESS': + print("Got session token without MFA") + return response.json().get('sessionToken') + session_id = response.cookies.get("sid") return session_id @@ -85,7 +89,6 @@ def get_session_cookie_from_session_token(self, session_token): session_cookies = response.cookies cookie_token = response.json()['cookieToken'] return session_cookies, cookie_token - # print(f'Session cookie: {session_cookie}') def authenticate_user(okta_domain: str, username: str, password: str): diff --git a/pyproject.toml b/pyproject.toml index a34ca05..62c4148 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ okta = "^2.9.2" PyYAML = "^6.0" fire = "^0.5.0" tenacity = "^8.2.2" +requests = "^2.32.3" [tool.poetry.dev-dependencies]