MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / asterisk_forms

Method asterisk_forms

mitmproxy/certs.py:665–679  ·  view source on GitHub ↗

Return all asterisk forms for a domain. For example, for www.example.com this will return [b"www.example.com", b"*.example.com", b"*.com"]. The single wildcard "*" is omitted.

(dn: str | x509.GeneralName)

Source from the content-addressed store, hash-verified

663
664 @staticmethod
665 def asterisk_forms(dn: str | x509.GeneralName) -> list[str]:
666 """
667 Return all asterisk forms for a domain. For example, for www.example.com this will return
668 [b"www.example.com", b"*.example.com", b"*.com"]. The single wildcard "*" is omitted.
669 """
670 if isinstance(dn, str):
671 parts = dn.split(".")
672 ret = [dn]
673 for i in range(1, len(parts)):
674 ret.append("*." + ".".join(parts[i:]))
675 return ret
676 elif isinstance(dn, x509.DNSName):
677 return CertStore.asterisk_forms(dn.value)
678 else:
679 return [str(dn.value)]
680
681 def get_cert(
682 self,

Callers 2

get_certMethod · 0.95
test_asterisk_formsMethod · 0.80

Calls 3

splitMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by 1

test_asterisk_formsMethod · 0.64