MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / api_discussion_since

Function api_discussion_since

Scripts/ButSystem.py:17945–17966  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17943def _write_local_https_cert(cert_path: str, key_path: str, san_hosts: list[str]):
17944 key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
17945 subject = issuer = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, u"ButSystem Local HTTPS")])
17946 san_entries = []
17947 seen = set()
17948 for raw in san_hosts:
17949 host = str(raw or "").strip()
17950 if not host or host in seen:
17951 continue
17952 seen.add(host)
17953 try:
17954 san_entries.append(x509.IPAddress(ipaddress.ip_address(host)))
17955 continue
17956 except Exception:
17957 pass
17958 san_entries.append(x509.DNSName(host))
17959 now = datetime.utcnow()
17960 cert = (
17961 x509.CertificateBuilder()
17962 .subject_name(subject)
17963 .issuer_name(issuer)
17964 .public_key(key.public_key())
17965 .serial_number(x509.random_serial_number())
17966 .not_valid_before(now - timedelta(days=1))
17967 .not_valid_after(now + timedelta(days=3650))
17968 .add_extension(x509.SubjectAlternativeName(san_entries), critical=False)
17969 .add_extension(x509.BasicConstraints(ca=True, path_length=None), critical=True)

Callers

nothing calls this directly

Calls 5

_feature_tables_initFunction · 0.70
current_userFunction · 0.70
db_connectFunction · 0.70

Tested by

no test coverage detected