[docs]class HtbException(Exception):
"""Base exception class for `hackthebox`"""
pass
[docs]class ApiError(HtbException):
"""The API responded in an unexpected way"""
[docs]class AuthenticationException(HtbException):
"""An error authenticating to the API"""
pass
[docs]class NotFoundException(HtbException):
"""The API returned a 404 response for this request"""
pass
[docs]class MissingEmailException(AuthenticationException):
"""An email was not given where it was required"""
pass
[docs]class MissingPasswordException(AuthenticationException):
"""A password was not given where it was required"""
pass
[docs]class MissingOTPException(AuthenticationException):
"""An OTP was not given but 2FA is enabled"""
pass
[docs]class IncorrectOTPException(AuthenticationException):
"""An OTP was given but not accepted"""
pass
[docs]class VpnException(HtbException):
"""An error associated with the VPN"""
pass
[docs]class CannotSwitchWithActive(VpnException):
"""Failed to switch VPN because the user has an active machine"""
pass
[docs]class MachineException(HtbException):
"""An error associated with a machine"""
pass
[docs]class TooManyResetAttempts(MachineException):
"""Error for too many reset attempts"""
pass
[docs]class UnknownSolveException(HtbException):
"""An unknown solve type was passed"""
pass
[docs]class SolveError(HtbException):
"""Exceptions for solving"""
[docs]class IncorrectFlagException(SolveError):
"""An incorrect flag was submitted"""
pass
[docs]class UserAlreadySubmitted(SolveError):
"""Player has already completed the user flag for this box"""
pass
[docs]class RootAlreadySubmitted(SolveError):
"""Player has already completed the root flag for this box"""
[docs]class IncorrectArgumentException(HtbException):
"""An incorrectly formatted argument was passed"""
reason: str
def __str__(self):
return repr(self)
def __repr__(self):
return f"IncorrectArgumentException(reason='{self.reason}')"
def __init__(self, reason: str):
self.reason = reason
pass
[docs]class NoDockerException(HtbException):
"""A challenge was 'started' when no Docker is available"""
pass
[docs]class NoDownloadException(HtbException):
"""A challenge was 'downloaded' when no download is available"""
pass
[docs]class RateLimitException(HtbException):
"""An internal ratelimit to prevent spam was violated"""
def __init__(self, message):
print(message)
super().__init__(message)
[docs]class CacheException(HtbException):
"""There was an issue with the token cache"""
pass