diff options
| author | J08nY | 2024-11-04 14:08:55 +0100 |
|---|---|---|
| committer | J08nY | 2024-11-04 14:08:55 +0100 |
| commit | 239918860f3d05692444d87f3a50ed25db07ff2a (patch) | |
| tree | d1492caa1329666f0c78e631562fdeaeddc549e7 /src | |
| parent | f245827bda3625a2d9338514821921eefc98ed11 (diff) | |
| download | sec-certs-239918860f3d05692444d87f3a50ed25db07ff2a.tar.gz sec-certs-239918860f3d05692444d87f3a50ed25db07ff2a.tar.zst sec-certs-239918860f3d05692444d87f3a50ed25db07ff2a.zip | |
Add Poland scheme web download.
Fixes #454.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sec_certs/constants.py | 3 | ||||
| -rw-r--r-- | src/sec_certs/sample/cc_scheme.py | 62 |
2 files changed, 65 insertions, 0 deletions
diff --git a/src/sec_certs/constants.py b/src/sec_certs/constants.py index b1c25fe5..bc7e2ead 100644 --- a/src/sec_certs/constants.py +++ b/src/sec_certs/constants.py @@ -126,6 +126,9 @@ CC_KOREA_BASE_URL = "https://itscc.kr" CC_KOREA_EN_URL = CC_KOREA_BASE_URL + "/main/mainEn.do" CC_KOREA_CERTIFIED_URL = CC_KOREA_BASE_URL + "/certprod/listA.do" CC_KOREA_PRODUCT_URL = CC_KOREA_BASE_URL + "/certprod/view.do?product_id={}&product_class=1" +CC_POLAND_BASE_URL = "https://en.nask.pl" +CC_POLAND_CERTIFIED_URL = CC_POLAND_BASE_URL + "/eng/activities/certification/list-of-certificates" +CC_POLAND_INEVAL_URL = CC_POLAND_BASE_URL + "/eng/activities/certification/ongoing-certifications" CC_SINGAPORE_BASE_URL = "https://www.csa.gov.sg" CC_SINGAPORE_CERTIFIED_URL = ( CC_SINGAPORE_BASE_URL + "/Programmes/certification-and-labelling-schemes/csa-common-criteria/product-list" diff --git a/src/sec_certs/sample/cc_scheme.py b/src/sec_certs/sample/cc_scheme.py index 0ed3b84a..f60c1da6 100644 --- a/src/sec_certs/sample/cc_scheme.py +++ b/src/sec_certs/sample/cc_scheme.py @@ -1225,6 +1225,64 @@ def get_korea_archived(enhanced: bool = True, artifacts: bool = False) -> list[d return _get_korea(product_class=4, enhanced=enhanced, artifacts=artifacts) +def get_poland_certified(artifacts: bool = False) -> list[dict[str, Any]]: + """ """ + soup = _get_page(constants.CC_POLAND_CERTIFIED_URL) + table = soup.find("table", class_="cert_tb") + results = [] + for tr in table.find_all("tr")[1:]: + tds = tr.find_all("td") + cert = { + "client": sns(tds[0].text), + "product": sns(tds[1].text), + "certification_date": sns(tds[4].text), + "expiration_date": sns(tds[5].text), + } + cc_entry = sns(tds[2].text) + cc_split = None + if cc_entry and "\n" in cc_entry: + cc_split = cc_entry.split("\n") + elif cc_entry and "," in cc_entry: + cc_split = cc_entry.split(",") + if cc_split: + cert["cc_version"] = cc_split[0].strip() + cert["assurance_level"] = ", ".join(cc_split[1:]).strip() + + for name, i in (("report", 6), ("target", 7), ("cert", 8)): + a = tds[i].find("a") + if a: + href = urljoin(constants.CC_POLAND_BASE_URL, a["href"]) + cert[f"{name}_link"] = href + if artifacts: + cert[f"{name}_hash"] = _get_hash(href).hex() + results.append(cert) + return results + + +def get_poland_ineval() -> list[dict[str, Any]]: + """ """ + soup = _get_page(constants.CC_POLAND_INEVAL_URL) + table = soup.find("table", class_="cert_tb") + results = [] + for tr in table.find_all("tr")[1:]: + tds = tr.find_all("td") + cert = { + "client": sns(tds[0].text), + "product": sns(tds[1].text), + } + cc_entry = sns(tds[2].text) + cc_split = None + if cc_entry and "\n" in cc_entry: + cc_split = cc_entry.split("\n") + elif cc_entry and "," in cc_entry: + cc_split = cc_entry.split(",") + if cc_split: + cert["cc_version"] = cc_split[0].strip() + cert["assurance_level"] = ", ".join(cc_split[1:]).strip() + results.append(cert) + return results + + def _get_singapore(url: str, artifacts: bool) -> list[dict[str, Any]]: soup = _get_page(url) page_id = str(soup.find("input", id="CurrentPageId").value) @@ -1652,6 +1710,10 @@ class CCScheme(ComplexSerializableType): EntryType.Certified: get_korea_certified, EntryType.Archived: get_korea_archived, }, + "PL": { + EntryType.Certified: get_poland_certified, + EntryType.InEvaluation: get_poland_ineval, + }, "SG": { EntryType.InEvaluation: get_singapore_in_evaluation, EntryType.Certified: get_singapore_certified, |
