Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] - Added validation for CAPE cert #132

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .test.env
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ ROLE_ACADEMY_CBBH=7168215511011276950
ROLE_ACADEMY_CPTS=1795774641027354363
ROLE_ACADEMY_CDSA=1157697238949167235
ROLE_ACADEMY_CWEE=1257697240949167235
ROLE_ACADEMY_CAPE=1318971191586979861

ROLE_UNICTF2022=6148613121047893215

Expand Down
4 changes: 4 additions & 0 deletions src/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class AcademyCertificates(BaseSettings):
CERTIFIED_PENETRATION_TESTING_SPECIALIST = 3
CERTIFIED_DEFENSIVE_SECURITY_ANALYST = 4
CERTIFIED_WEB_EXPLOITATION_EXPERT = 5
CERTIFIED_ACTIVEDIRECTORY_PENTESTING_EXPERT = 6


class Roles(BaseSettings):
Expand Down Expand Up @@ -133,6 +134,7 @@ class Roles(BaseSettings):
ACADEMY_CPTS: int
ACADEMY_CDSA: int
ACADEMY_CWEE: int
ACADEMY_CAPE: int
# Joinable roles
UNICTF2022: int
BIZCTF2022: int
Expand Down Expand Up @@ -225,6 +227,7 @@ def get_academy_cert_role(self, certificate: int) -> int:
self.academy_certificates.CERTIFIED_PENETRATION_TESTING_SPECIALIST: self.roles.ACADEMY_CPTS,
self.academy_certificates.CERTIFIED_DEFENSIVE_SECURITY_ANALYST: self.roles.ACADEMY_CDSA,
self.academy_certificates.CERTIFIED_WEB_EXPLOITATION_EXPERT: self.roles.ACADEMY_CWEE,
self.academy_certificates.CERTIFIED_ACTIVEDIRECTORY_PENTESTING_EXPERT: self.roles.ACADEMY_CAPE
}.get(certificate)

def get_post_or_rank(self, what: str) -> Optional[int]:
Expand Down Expand Up @@ -259,6 +262,7 @@ def get_cert(self, what: str):
"CBBH": self.roles.ACADEMY_CBBH,
"CDSA": self.roles.ACADEMY_CDSA,
"CWEE": self.roles.ACADEMY_CWEE,
"CAPE": self.roles.ACADEMY_CAPE
}.get(what)

class Config:
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@

return ban_details


async def process_certification(certid: str, name: str):
"""Process certifications."""
cert_api_url = f"{settings.API_V4_URL}/certificate/lookup"
params = {'id': certid, 'name': name}
async with aiohttp.ClientSession() as session:
Expand All @@ -98,6 +100,8 @@
cert = "CDSA"
elif certRawName == "HTB Certified Web Exploitation Expert":
cert = "CWEE"
elif certRawName == "HTB Certified Active Directory Pentesting Expert":
cert = "CAPE"

Check warning on line 104 in src/helpers/verification.py

View check run for this annotation

Codecov / codecov/patch

src/helpers/verification.py#L103-L104

Added lines #L103 - L104 were not covered by tests
else:
cert = False
return cert
Expand Down
Loading