Skip to content

Commit

Permalink
Added support for MFA to login method of API.py (#3)
Browse files Browse the repository at this point in the history
Added support to pass TOTP token to API.login method. The default is still to not use a null token unless a token is passed. Also, fixed the output error message for the login to show the error "datas" instead of the "status" which seemed to be a mistake.
  • Loading branch information
d-woosley committed Aug 8, 2024
1 parent 6c48eb9 commit 6dc33e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pwndocapi/API.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def __init__(self, host, port=443, ssl=True, verbose=True):
self.verbose = verbose
self.user = {"token": "", "refreshToken": ""}

def login(self, username, password):
def login(self, username, password, totp=""):
r = self.session.post(
self.target + "/api/users/token",
json={"username": username, "password": password, "totpToken": ""},
json={"username": username, "password": password, "totpToken": totp},
verify=False
)
if r.json()["status"] == "success":
Expand All @@ -57,7 +57,7 @@ def login(self, username, password):
self.loggedin = True
elif r.json()["status"] == "error":
if self.verbose:
print("[!] Login error. (%s)" % r.json()["status"])
print("[!] Login error. (%s)" % r.json()["datas"])
self.loggedin = False
return self.loggedin

Expand Down

0 comments on commit 6dc33e3

Please sign in to comment.