code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def open_remote_registry(
self, target_ip: str, dns_host_name: str
) -> Optional[rpcrt.DCERPC_v5]:
"""
Open a connection to the remote registry service.
Args:
target_ip: IP address of the target
dns_host_name: DNS host name of the target
Returns:
... |
Open a connection to the remote registry service.
Args:
target_ip: IP address of the target
dns_host_name: DNS host name of the target
Returns:
DCE/RPC connection to the remote registry or None if failed
| open_remote_registry | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_certificate_templates(self) -> List[LDAPEntry]:
"""
Query LDAP for certificate templates.
Returns:
List of certificate template entries
"""
return self.connection.search(
"(objectclass=pKICertificateTemplate)",
search_base=f"CN=Certifi... |
Query LDAP for certificate templates.
Returns:
List of certificate template entries
| get_certificate_templates | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_certificate_authorities(self) -> List[LDAPEntry]:
"""
Query LDAP for certificate authorities.
Returns:
List of certificate authority entries
"""
return self.connection.search(
"(&(objectClass=pKIEnrollmentService))",
search_base=f"CN=E... |
Query LDAP for certificate authorities.
Returns:
List of certificate authority entries
| get_certificate_authorities | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_issuance_policies(self) -> List[LDAPEntry]:
"""
Query LDAP for issuance policies (OIDs).
Returns:
List of issuance policy entries
"""
return self.connection.search(
"(objectclass=msPKI-Enterprise-Oid)",
search_base=f"CN=OID,CN=Public K... |
Query LDAP for issuance policies (OIDs).
Returns:
List of issuance policy entries
| get_issuance_policies | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def find(self) -> None:
"""
Discover and analyze AD CS components and detect vulnerabilities.
This is the main entry point that:
1. Discovers templates, CAs, and issuance policies
2. Processes their properties and security settings
3. Detects vulnerabilities
4. O... |
Discover and analyze AD CS components and detect vulnerabilities.
This is the main entry point that:
1. Discovers templates, CAs, and issuance policies
2. Processes their properties and security settings
3. Detects vulnerabilities
4. Outputs results in requested formats... | find | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _link_cas_and_templates(
self, cas: List[LDAPEntry], templates: List[LDAPEntry]
) -> int:
"""
Link certificate authorities to templates and vice versa.
Args:
cas: List of certificate authorities
templates: List of certificate templates
Returns:
... |
Link certificate authorities to templates and vice versa.
Args:
cas: List of certificate authorities
templates: List of certificate templates
Returns:
Number of enabled templates
| _link_cas_and_templates | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _link_templates_and_policies(
self, templates: List[LDAPEntry], oids: List[LDAPEntry]
) -> int:
"""
Link templates to their issuance policies and vice versa.
Args:
templates: List of certificate templates
oids: List of issuance policies
Returns:
... |
Link templates to their issuance policies and vice versa.
Args:
templates: List of certificate templates
oids: List of issuance policies
Returns:
Number of enabled OIDs
| _link_templates_and_policies | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _process_ca_properties(self, cas: List[LDAPEntry]) -> None:
"""
Process certificate authority properties and security settings.
Args:
cas: List of certificate authorities
"""
for ca in cas:
if self.dc_only:
# In DC-only mode, we don't ... |
Process certificate authority properties and security settings.
Args:
cas: List of certificate authorities
| _process_ca_properties | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _get_ca_config_and_web_enrollment(self, ca: LDAPEntry) -> Dict[str, Any]:
"""
Get CA configuration and web enrollment settings.
Args:
ca: Certificate authority object
Returns:
Dictionary of CA properties
"""
# Default values
ca_proper... |
Get CA configuration and web enrollment settings.
Args:
ca: Certificate authority object
Returns:
Dictionary of CA properties
| _get_ca_config_and_web_enrollment | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _process_ca_certificate(self, ca: LDAPEntry):
"""
Process CA certificate information.
Args:
ca: Certificate authority object
"""
subject_name = ca.get("cACertificateDN")
ca.set("subject_name", subject_name)
try:
if not ca.get("cACerti... |
Process CA certificate information.
Args:
ca: Certificate authority object
| _process_ca_certificate | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def check_web_enrollment(self, ca: LDAPEntry, channel: str) -> bool:
"""
Check if web enrollment is enabled on the CA.
Args:
ca: Certificate authority object
channel: Protocol to check (http or https)
Returns:
True if enabled, False if disabled, None... |
Check if web enrollment is enabled on the CA.
Args:
ca: Certificate authority object
channel: Protocol to check (http or https)
Returns:
True if enabled, False if disabled, None if unknown
| check_web_enrollment | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def check_channel_binding(self, ca: LDAPEntry) -> Optional[bool]:
"""
Check if a Certificate Authority web enrollment endpoint enforces channel binding (EPA).
This method tests HTTPS web enrollment authentication with and without channel binding
to determine if Extended Protection for A... |
Check if a Certificate Authority web enrollment endpoint enforces channel binding (EPA).
This method tests HTTPS web enrollment authentication with and without channel binding
to determine if Extended Protection for Authentication (EPA) is enabled.
Args:
ca: LDAP entry for... | check_channel_binding | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _process_template_properties(self, templates: List[LDAPEntry]):
"""
Process certificate template properties.
Args:
templates: List of certificate templates
"""
for template in templates:
# Set enabled flag
template_cas = template.get("cas"... |
Process certificate template properties.
Args:
templates: List of certificate templates
| _process_template_properties | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _process_template_validity(self, template: LDAPEntry):
"""
Process template validity periods.
Args:
template: Certificate template
"""
# Process expiration period
expiration_period = template.get("pKIExpirationPeriod")
if expiration_period is not ... |
Process template validity periods.
Args:
template: Certificate template
| _process_template_validity | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _process_template_flags(self, template: LDAPEntry):
"""
Process template flag attributes.
Args:
template: Certificate template
"""
# Process certificate name flags
certificate_name_flag = template.get("msPKI-Certificate-Name-Flag")
if certificate_... |
Process template flag attributes.
Args:
template: Certificate template
| _process_template_flags | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _process_template_policies(self, template: LDAPEntry):
"""
Process template policy attributes and extended key usage.
Args:
template: Certificate template
"""
# Process application policies
application_policies = template.get_raw("msPKI-RA-Application-Pol... |
Process template policy attributes and extended key usage.
Args:
template: Certificate template
| _process_template_policies | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _determine_template_capabilities(
self, template: LDAPEntry, extended_key_usage: List[str]
):
"""
Determine template capabilities from EKU and flags.
Args:
template: Certificate template
extended_key_usage: List of extended key usage values
"""
... |
Determine template capabilities from EKU and flags.
Args:
template: Certificate template
extended_key_usage: List of extended key usage values
| _determine_template_capabilities | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _save_output(
self,
templates: List[LDAPEntry],
cas: List[LDAPEntry],
oids: List[LDAPEntry],
prefix: str,
):
"""
Generate and save output in requested formats.
Args:
templates: List of certificate templates
cas: List of cer... |
Generate and save output in requested formats.
Args:
templates: List of certificate templates
cas: List of certificate authorities
oids: List of issuance policies
prefix: Output file prefix
| _save_output | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_output_for_text_and_json(
self, templates: List[LDAPEntry], cas: List[LDAPEntry], oids: List[LDAPEntry]
) -> Dict[str, Any]:
"""
Generate structured output for text and JSON formats.
Args:
templates: List of certificate templates
cas: List of certific... |
Generate structured output for text and JSON formats.
Args:
templates: List of certificate templates
cas: List of certificate authorities
oids: List of issuance policies
Returns:
Dictionary containing structured output
| get_output_for_text_and_json | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_ca_output_for_csv(self, output: Dict[str, Any]) -> str:
"""
Convert Certificate Authority data to CSV format.
This function transforms nested CA data into a flattened CSV format.
It handles complex nested structures like permissions and web enrollment
settings in a way t... |
Convert Certificate Authority data to CSV format.
This function transforms nested CA data into a flattened CSV format.
It handles complex nested structures like permissions and web enrollment
settings in a way that makes them readable in CSV format.
Args:
output: D... | get_ca_output_for_csv | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _flatten_ca_data(self, ca_entry: Dict[str, Any]) -> Dict[str, str]:
"""
Flatten a nested CA dictionary for CSV output.
Handles special cases like permissions dictionaries, web enrollment settings,
and list values by converting them to appropriate string representations.
Arg... |
Flatten a nested CA dictionary for CSV output.
Handles special cases like permissions dictionaries, web enrollment settings,
and list values by converting them to appropriate string representations.
Args:
ca_entry: Dictionary containing CA data
Returns:
... | _flatten_ca_data | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_template_output_for_csv(self, output: Dict[str, Any]) -> str:
"""
Convert certificate template data to CSV format.
This function transforms nested certificate templates data into a flattened CSV format.
It handles complex nested structures like permissions and lists in a way tha... |
Convert certificate template data to CSV format.
This function transforms nested certificate templates data into a flattened CSV format.
It handles complex nested structures like permissions and lists in a way that makes them
readable in CSV format.
Args:
output: D... | get_template_output_for_csv | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def _flatten_template_data(self, template_entry: Dict[str, Any]) -> Dict[str, str]:
"""
Flatten a nested template dictionary for CSV output.
Handles special cases like permissions dictionaries, nested objects,
and list values by converting them to appropriate string representations.
... |
Flatten a nested template dictionary for CSV output.
Handles special cases like permissions dictionaries, nested objects,
and list values by converting them to appropriate string representations.
Args:
template_entry: Dictionary containing template data
Returns:
... | _flatten_template_data | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_template_properties(
self, template: LDAPEntry, template_properties: Optional[Dict[str, Any]] = None
) -> Dict[str, Any]:
"""
Extract template properties for output.
Args:
template: Certificate template
template_properties: Optional existing propertie... |
Extract template properties for output.
Args:
template: Certificate template
template_properties: Optional existing properties dictionary
Returns:
Dictionary of template properties
| get_template_properties | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_ca_properties(
self, ca: LDAPEntry, ca_properties: Optional[Dict[str, Any]] = None
) -> Dict[str, Any]:
"""
Extract CA properties for output.
Args:
ca: Certificate authority
ca_properties: Optional existing properties dictionary
Returns:
... |
Extract CA properties for output.
Args:
ca: Certificate authority
ca_properties: Optional existing properties dictionary
Returns:
Dictionary of CA properties
| get_ca_properties | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_oid_properties(
self, oid: LDAPEntry, oid_properties: Optional[Dict[str, Any]] = None
) -> Dict[str, Any]:
"""
Extract OID properties for output.
Args:
oid: Issuance policy object
oid_properties: Optional existing properties dictionary
Return... |
Extract OID properties for output.
Args:
oid: Issuance policy object
oid_properties: Optional existing properties dictionary
Returns:
Dictionary of OID properties
| get_oid_properties | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_template_permissions(self, template: LDAPEntry) -> Dict[str, Any]:
"""
Extract template permissions for output.
Args:
template: Certificate template
Returns:
Dictionary of template permissions
"""
security = CertificateSecurity(template.g... |
Extract template permissions for output.
Args:
template: Certificate template
Returns:
Dictionary of template permissions
| get_template_permissions | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_ca_permissions(self, ca: LDAPEntry) -> Dict[str, Any]:
"""
Extract CA permissions for output.
Args:
ca: Certificate authority
Returns:
Dictionary of CA permissions
"""
security = ca.get("security")
if security is None:
... |
Extract CA permissions for output.
Args:
ca: Certificate authority
Returns:
Dictionary of CA permissions
| get_ca_permissions | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_oid_permissions(self, oid: LDAPEntry) -> Dict[str, Any]:
"""
Extract OID permissions for output.
Args:
oid: Issuance policy object
Returns:
Dictionary of OID permissions
"""
nt_security_descriptor = oid.get("nTSecurityDescriptor")
... |
Extract OID permissions for output.
Args:
oid: Issuance policy object
Returns:
Dictionary of OID permissions
| get_oid_permissions | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_template_vulnerabilities(
self, template: LDAPEntry
) -> Tuple[Dict[str, str], Dict[str, str], List[str], List[str]]:
"""
Detect vulnerabilities in certificate templates.
This method checks for various Enterprise Security Configuration (ESC) vulnerabilities:
- ESC1: ... |
Detect vulnerabilities in certificate templates.
This method checks for various Enterprise Security Configuration (ESC) vulnerabilities:
- ESC1: Client authentication template with enrollee-supplied subject
- ESC2: Template that allows any purpose
- ESC3: Template with Certific... | get_template_vulnerabilities | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def template_has_vulnerable_acl(
self, template: LDAPEntry
) -> Tuple[bool, List[str]]:
"""
Check if the template has vulnerable permissions for the current user.
Args:
template: Certificate template to analyze
Returns:
Tuple of (has_vulnerable_acl, ... |
Check if the template has vulnerable permissions for the current user.
Args:
template: Certificate template to analyze
Returns:
Tuple of (has_vulnerable_acl, list_of_vulnerable_sids)
| template_has_vulnerable_acl | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def can_user_enroll_in_template(
self, template: LDAPEntry
) -> Tuple[bool, List[str]]:
"""
Check if the current user can enroll in the template.
Args:
template: Certificate template to analyze
Returns:
Tuple of (can_enroll, list_of_enrollable_sids)
... |
Check if the current user can enroll in the template.
Args:
template: Certificate template to analyze
Returns:
Tuple of (can_enroll, list_of_enrollable_sids)
| can_user_enroll_in_template | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_ca_vulnerabilities(
self, ca: LDAPEntry
) -> Tuple[Dict[str, str], Dict[str, str], List[str], List[str]]:
"""
Detect vulnerabilities in certificate authorities.
This method checks for various Enterprise Security Configuration (ESC) vulnerabilities:
- ESC6: CA allows ... |
Detect vulnerabilities in certificate authorities.
This method checks for various Enterprise Security Configuration (ESC) vulnerabilities:
- ESC6: CA allows user-specified SAN and auto-issues certificates
- ESC7: CA with dangerous permissions
- ESC8: Insecure web enrollment
... | get_ca_vulnerabilities | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def ca_has_vulnerable_acl(self, ca: LDAPEntry) -> Tuple[bool, List[str]]:
"""
Check if the CA has vulnerable permissions for the current user.
Args:
ca: Certificate authority to analyze
Returns:
Tuple of (has_vulnerable_acl, list_of_vulnerable_sids)
"""
... |
Check if the CA has vulnerable permissions for the current user.
Args:
ca: Certificate authority to analyze
Returns:
Tuple of (has_vulnerable_acl, list_of_vulnerable_sids)
| ca_has_vulnerable_acl | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def can_user_enroll_in_ca(self, ca: LDAPEntry) -> Tuple[Optional[bool], List[str]]:
"""
Check if the current user can enroll in the CA.
Args:
ca: CA to analyze
Returns:
Tuple of (can_enroll, list_of_enrollable_sids)
"""
security = ca.get("securit... |
Check if the current user can enroll in the CA.
Args:
ca: CA to analyze
Returns:
Tuple of (can_enroll, list_of_enrollable_sids)
| can_user_enroll_in_ca | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def get_oid_vulnerabilities(
self, oid: LDAPEntry
) -> Tuple[Dict[str, str], List[str]]:
"""
Detect vulnerabilities in issuance policy OIDs.
This method checks for Enterprise Security Configuration (ESC) vulnerabilities:
- ESC13: OID with dangerous permissions or owned by cu... |
Detect vulnerabilities in issuance policy OIDs.
This method checks for Enterprise Security Configuration (ESC) vulnerabilities:
- ESC13: OID with dangerous permissions or owned by current user
Args:
oid: Issuance policy OID to analyze
Returns:
Tuple of... | get_oid_vulnerabilities | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def oid_has_vulnerable_acl(self, oid: LDAPEntry) -> Tuple[bool, List[str]]:
"""
Check if the OID has vulnerable permissions for the current user.
Args:
oid: Issuance policy OID to analyze
Returns:
Tuple of (has_vulnerable_acl, list_of_vulnerable_sids)
""... |
Check if the OID has vulnerable permissions for the current user.
Args:
oid: Issuance policy OID to analyze
Returns:
Tuple of (has_vulnerable_acl, list_of_vulnerable_sids)
| oid_has_vulnerable_acl | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def entry(options: argparse.Namespace) -> None:
"""
Entry point for the 'find' command.
Args:
options: Command-line arguments
"""
target = Target.from_options(options, dc_as_target=True)
options.__delattr__("target")
find = Find(target=target, **vars(options))
find.find() |
Entry point for the 'find' command.
Args:
options: Command-line arguments
| entry | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def __init__(
self,
ca_pfx: Optional[str] = None,
ca_password: Optional[str] = None,
upn: Optional[str] = None,
dns: Optional[str] = None,
sid: Optional[str] = None,
subject: Optional[str] = None,
template: Optional[str] = None,
application_policie... |
Initialize the certificate forgery parameters.
Args:
ca_pfx: Path to the CA certificate/private key in PFX format
ca_password: Password for the CA PFX file
upn: User Principal Name for the certificate (e.g., user@domain.com)
dns: DNS name for the certifi... | __init__ | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def get_serial_number(self) -> int:
"""
Get the certificate serial number.
Returns:
Integer representation of the serial number
"""
if self.serial is None:
return x509.random_serial_number()
# Clean up colons if present and convert hex to int
... |
Get the certificate serial number.
Returns:
Integer representation of the serial number
| get_serial_number | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def get_crl(
self, crl: Optional[str] = None
) -> Optional[x509.CRLDistributionPoints]:
"""
Create a CRL distribution point extension.
Args:
crl: URI of the CRL distribution point (defaults to self.crl)
Returns:
CRL distribution points extension or N... |
Create a CRL distribution point extension.
Args:
crl: URI of the CRL distribution point (defaults to self.crl)
Returns:
CRL distribution points extension or None if no CRL specified
| get_crl | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def load_ca_certificate_and_key(
self,
) -> Tuple[CertificateIssuerPrivateKeyTypes, x509.Certificate]:
"""
Load the CA certificate and private key from the PFX file.
Returns:
Tuple of (CA private key, CA certificate)
Raises:
ValueError: If CA PFX fil... |
Load the CA certificate and private key from the PFX file.
Returns:
Tuple of (CA private key, CA certificate)
Raises:
ValueError: If CA PFX file is not specified
FileNotFoundError: If CA PFX file does not exist
Exception: If loading the CA certi... | load_ca_certificate_and_key | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def create_subject_alternative_names(
self,
) -> List[Union[x509.DNSName, x509.OtherName]]:
"""
Create subject alternative names for the certificate.
Returns:
List of subject alternative name entries
"""
sans = []
# Add DNS name if specified
... |
Create subject alternative names for the certificate.
Returns:
List of subject alternative name entries
| create_subject_alternative_names | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def create_sid_extension(self) -> Optional[x509.UnrecognizedExtension]:
"""
Create an extension containing the SID for the certificate.
Returns:
UnrecognizedExtension containing the SID or None if no SID specified
"""
if not self.alt_sid:
return None
... |
Create an extension containing the SID for the certificate.
Returns:
UnrecognizedExtension containing the SID or None if no SID specified
| create_sid_extension | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def create_application_policies(self) -> Optional[x509.UnrecognizedExtension]:
"""
Create an extension containing the application policies for the certificate.
Returns:
UnrecognizedExtension containing the application policies or None if not specified
"""
if not self... |
Create an extension containing the application policies for the certificate.
Returns:
UnrecognizedExtension containing the application policies or None if not specified
| create_application_policies | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def create_smime_extension(self) -> Optional[x509.UnrecognizedExtension]:
"""
Create an extension containing the S/MIME capability for the certificate.
Returns:
UnrecognizedExtension containing the S/MIME capability or None if not specified
"""
if not self.smime:
... |
Create an extension containing the S/MIME capability for the certificate.
Returns:
UnrecognizedExtension containing the S/MIME capability or None if not specified
| create_smime_extension | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def get_allowed_hash_algorithm(
self, template_hash_algorithm: Optional[hashes.HashAlgorithm]
) -> AllowedSignatureAlgorithms:
"""
Get an appropriate hash algorithm for certificate signing.
Args:
template_hash_algorithm: Hash algorithm from template certificate
... |
Get an appropriate hash algorithm for certificate signing.
Args:
template_hash_algorithm: Hash algorithm from template certificate
Returns:
Hash algorithm instance to use for signing
| get_allowed_hash_algorithm | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def build_from_template(
self,
ca_private_key: CertificateIssuerPrivateKeyTypes,
ca_public_key: CertificateIssuerPublicKeyTypes,
ca_cert: x509.Certificate,
) -> Tuple[PrivateKeyTypes, bytes]:
"""
Build a certificate using an existing certificate as a template.
... |
Build a certificate using an existing certificate as a template.
Args:
ca_private_key: CA private key
ca_public_key: CA public key
ca_cert: CA certificate
Returns:
Tuple of (certificate private key, PFX data)
Raises:
Excepti... | build_from_template | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def build_new_certificate(
self,
ca_private_key: CertificateIssuerPrivateKeyTypes,
ca_public_key: CertificateIssuerPublicKeyTypes,
ca_cert: x509.Certificate,
) -> Tuple[rsa.RSAPrivateKey, bytes]:
"""
Build a new certificate without a template.
Args:
... |
Build a new certificate without a template.
Args:
ca_private_key: CA private key
ca_public_key: CA public key
ca_cert: CA certificate
Returns:
Tuple of (certificate private key, PFX data)
| build_new_certificate | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def determine_output_filename(self, id_type: str, id_value: Optional[str]) -> str:
"""
Determine the output filename for the forged certificate.
Args:
id_type: Identification type (UPN, DNS)
id_value: Identification value
Returns:
Output filename
... |
Determine the output filename for the forged certificate.
Args:
id_type: Identification type (UPN, DNS)
id_value: Identification value
Returns:
Output filename
| determine_output_filename | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def forge(self) -> None:
"""
Forge a certificate with the specified parameters.
This is the main method that performs the certificate forgery process.
Raises:
ValueError: If required parameters are missing
Exception: If certificate forgery fails
"""
... |
Forge a certificate with the specified parameters.
This is the main method that performs the certificate forgery process.
Raises:
ValueError: If required parameters are missing
Exception: If certificate forgery fails
| forge | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def create_self_signed_ca(self) -> None:
"""
Create a self-signed CA certificate.
This method generates a self-signed CA certificate and saves it to the specified output file.
"""
# Generate new key pair
key = generate_rsa_key(self.key_size)
# Create self-signed... |
Create a self-signed CA certificate.
This method generates a self-signed CA certificate and saves it to the specified output file.
| create_self_signed_ca | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def entry(options: argparse.Namespace) -> None:
"""
Command-line entry point for certificate forgery.
Args:
options: Command line arguments
"""
try:
# Create and run the forger
forge = Forge(**vars(options))
if options.ca_pfx:
forge.forge()
else:... |
Command-line entry point for certificate forgery.
Args:
options: Command line arguments
| entry | python | ly4k/Certipy | certipy/commands/forge.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/forge.py | MIT |
def __init__(
self,
domain: str = "UNKNOWN",
ca: str = "UNKNOWN",
sids: List[str] = [],
published: List[str] = [],
**kwargs, # type: ignore
):
"""
Initialize the certificate template parser.
Args:
domain: Domain name for the templ... |
Initialize the certificate template parser.
Args:
domain: Domain name for the templates (default: UNKNOWN)
ca: Certificate Authority name (default: UNKNOWN)
sids: List of SIDs to resolve in ACLs
published: List of templates published by the CA
... | __init__ | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def connection(self) -> RegConnection: # type: ignore
"""
Get or create a registry connection for SID resolution.
Returns:
RegConnection object for SID resolution
"""
if self._connection is not None:
return self._connection
self._connection: Opt... |
Get or create a registry connection for SID resolution.
Returns:
RegConnection object for SID resolution
| connection | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def get_certificate_authorities(self) -> List[RegEntry]: # type: ignore
"""
Get certificate authorities.
Creates a mock CA entry with the provided templates for analysis.
Returns:
List containing a single mock CA RegEntry if templates are published,
otherwise a... |
Get certificate authorities.
Creates a mock CA entry with the provided templates for analysis.
Returns:
List containing a single mock CA RegEntry if templates are published,
otherwise an empty list
| get_certificate_authorities | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def parse(self, file: str) -> None:
"""
Parse certificate templates from a file.
Args:
file: Path to the file containing template data
"""
self.file = file
# Ensure the file exists
file_path = Path(file)
if not file_path.exists():
... |
Parse certificate templates from a file.
Args:
file: Path to the file containing template data
| parse | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def get_certificate_templates(self) -> List[RegEntry]: # type: ignore
"""
Parse certificate templates from BOF output.
Returns:
List of RegEntry objects representing certificate templates
"""
templates = []
if self.file is None:
raise ValueError... |
Parse certificate templates from BOF output.
Returns:
List of RegEntry objects representing certificate templates
| get_certificate_templates | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def get_certificate_templates(self) -> List[RegEntry]: # type: ignore
"""
Parse certificate templates from a .reg file.
Returns:
List of RegEntry objects representing certificate templates
"""
templates = []
if self.file is None:
raise ValueErro... |
Parse certificate templates from a .reg file.
Returns:
List of RegEntry objects representing certificate templates
| get_certificate_templates | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def _parse_hex_data(self, initial_data: str, lines_iter: Iterator[str]) -> bytes:
"""
Parse hex data that might span multiple lines.
Args:
initial_data: The initial hex data string
lines_iter: Iterator for the file lines
Returns:
Bytes object contain... |
Parse hex data that might span multiple lines.
Args:
initial_data: The initial hex data string
lines_iter: Iterator for the file lines
Returns:
Bytes object containing the parsed hex data
| _parse_hex_data | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def get_parser(
parser_type: ParserType,
domain: str,
ca: str,
sids: List[str],
published: List[str],
**kwargs, # type: ignore
) -> Parse:
"""
Factory function to get the appropriate parser.
Args:
parser_type: Type of parser to create
domain: Domain name
ca:... |
Factory function to get the appropriate parser.
Args:
parser_type: Type of parser to create
domain: Domain name
ca: CA name
sids: List of SIDs
published: List of published templates
kwargs: Additional arguments
Returns:
Appropriate parser instance
... | get_parser | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def entry(options: argparse.Namespace) -> None:
"""
Command-line entry point for the parse functionality.
Args:
options: Command line arguments
"""
# Extract and remove parse-specific options
domain = options.domain
ca = options.ca
sids = options.sids or []
published = optio... |
Command-line entry point for the parse functionality.
Args:
options: Command line arguments
| entry | python | ly4k/Certipy | certipy/commands/parse.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/parse.py | MIT |
def __init__(self, adcs_relay: "Relay", *args, **kwargs): # type: ignore
"""
Initialize the HTTP relay server.
Args:
adcs_relay: The parent Relay object
args: Arguments to pass to the parent class
kwargs: Keyword arguments to pass to the parent class
... |
Initialize the HTTP relay server.
Args:
adcs_relay: The parent Relay object
args: Arguments to pass to the parent class
kwargs: Keyword arguments to pass to the parent class
| __init__ | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def initConnection(self) -> Literal[True]: # noqa: N802
"""
Establish a connection to the AD CS Web Enrollment service.
Returns:
True if connection was successful
"""
logging.debug(f"Using target: {self.adcs_relay.target}...")
logging.debug(f"Base URL: {self... |
Establish a connection to the AD CS Web Enrollment service.
Returns:
True if connection was successful
| initConnection | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def sendAuth( # noqa: N802 # type: ignore
self, authenticate_blob: bytes, _server_challenge: Optional[bytes] = None
) -> Tuple[Optional[bytes], int]:
"""
Send authentication data to the target with proper locking to prevent race conditions.
Args:
authenticateMessageBlob... |
Send authentication data to the target with proper locking to prevent race conditions.
Args:
authenticateMessageBlob: The authentication message
serverChallenge: The server challenge
Returns:
Tuple of (response, status code)
| sendAuth | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def _send_auth(self, authenticate_blob: bytes) -> Tuple[Optional[bytes], int]:
"""
Process and send authentication data to the target.
Args:
authenticateMessageBlob: The authentication message
serverChallenge: The server challenge
Returns:
Tuple of (... |
Process and send authentication data to the target.
Args:
authenticateMessageBlob: The authentication message
serverChallenge: The server challenge
Returns:
Tuple of (response, status code)
| _send_auth | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def __init__(
self,
config: NTLMRelayxConfig,
target: object,
targetPort: Optional[int] = None, # noqa: N803
extendedSecurity: bool = True, # noqa: N803
):
"""
Initialize the RPC relay server.
Args:
serverConfig: NTLMRelayxConfig object ... |
Initialize the RPC relay server.
Args:
serverConfig: NTLMRelayxConfig object with relay settings
target: Target information
targetPort: Target RPC port (default: uses port mapping)
extendedSecurity: Whether to use extended security
| __init__ | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def sendAuth( # noqa: N802 # type: ignore
self, authenticate_blob: bytes, server_challenge: Optional[bytes] = None
) -> Tuple[Optional[bytes], int]:
"""
Send authentication data to the target RPC service.
Args:
authenticateMessageBlob: The authentication message
... |
Send authentication data to the target RPC service.
Args:
authenticateMessageBlob: The authentication message
serverChallenge: The server challenge
Returns:
Tuple of (response, status code)
| sendAuth | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def __init__(self, adcs_relay: "Relay", *args, **kwargs): # type: ignore
"""
Initialize the HTTP attack client.
Args:
adcs_relay: The parent Relay object
args: Arguments to pass to the parent class
kwargs: Keyword arguments to pass to the parent class
... |
Initialize the HTTP attack client.
Args:
adcs_relay: The parent Relay object
args: Arguments to pass to the parent class
kwargs: Keyword arguments to pass to the parent class
| __init__ | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def run(self) -> None: # type: ignore
"""
Execute the certificate request attack with proper locking.
"""
while not self.adcs_relay.attack_lock.acquire():
time.sleep(0.1)
try:
self._run()
except Exception as e:
logging.error(f"Failed ... |
Execute the certificate request attack with proper locking.
| run | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def _run(self) -> None:
"""
Main attack logic - request or retrieve a certificate for the relayed user.
"""
# Check if we've already attacked this target and should skip
if (
not self.adcs_relay.no_skip
and self.client.user in self.adcs_relay.attacked_targ... |
Main attack logic - request or retrieve a certificate for the relayed user.
| _run | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def _enumerate_templates(self) -> None:
"""
Enumerate available certificate templates from Web Enrollment.
"""
# Request the certificate request page
res = self.client.get("/certsrv/certrqxt.asp")
content = res.text
# Parse the HTML to extract templates
... |
Enumerate available certificate templates from Web Enrollment.
| _enumerate_templates | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def _retrieve_certificate(self, request_id: int) -> None:
"""
Retrieve a certificate by request ID.
Args:
request_id: The ID of the certificate request to retrieve
"""
result = web_retrieve(
self.client,
request_id,
)
if resul... |
Retrieve a certificate by request ID.
Args:
request_id: The ID of the certificate request to retrieve
| _retrieve_certificate | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def _request_certificate(self) -> None:
"""
Request a new certificate for the relayed user.
"""
# Choose appropriate template based on username
template = self.config.template
if template is None:
template = "Machine" if self.username.endswith("$") else "User"... |
Request a new certificate for the relayed user.
| _request_certificate | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def __init__(
self, adcs_relay: "Relay", config: NTLMRelayxConfig, dce: Any, username: str
):
"""
Initialize the RPC attack client.
Args:
adcs_relay: The parent Relay object
config: NTLMRelayxConfig object with relay settings
dce: DCE/RPC connecti... |
Initialize the RPC attack client.
Args:
adcs_relay: The parent Relay object
config: NTLMRelayxConfig object with relay settings
dce: DCE/RPC connection
username: Username of the relayed user
| __init__ | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def retrieve(self) -> bool:
"""
Retrieve a certificate by request ID.
Returns:
True on success, False on failure
"""
if self.adcs_relay.request_id is None:
logging.error("Request ID was not defined")
return False
request_id = int(self... |
Retrieve a certificate by request ID.
Returns:
True on success, False on failure
| retrieve | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def request(self) -> Union[bool, Tuple[bytes, str]]:
"""
Request a new certificate for the relayed user.
Returns:
Tuple of (PFX data, filename) on success, False on failure
"""
# Choose appropriate template based on username
template = self.config.template
... |
Request a new certificate for the relayed user.
Returns:
Tuple of (PFX data, filename) on success, False on failure
| request | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def __init__(
self,
target: str,
ca: Optional[str] = None,
template: Optional[str] = None,
upn: Optional[str] = None,
dns: Optional[str] = None,
sid: Optional[str] = None,
subject: Optional[str] = None,
application_policies: Optional[List[str]] = N... |
Initialize the NTLM relay attack.
Args:
target: Target AD CS server (http://server/certsrv/ or rpc://server)
ca: Certificate Authority name (required for RPC)
template: Certificate template to request
upn: Alternative UPN (User Principal Name)
... | __init__ | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def request(self) -> Request:
"""
Get the current request object.
Returns:
The current request object
"""
if not self._request is None:
return self._request
self._request = Request(
Target(
DnsResolver.create(),
... |
Get the current request object.
Returns:
The current request object
| request | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def start(self) -> None:
"""
Start the relay server and wait for connections.
"""
logging.info(f"Listening on {self.interface}:{self.port}")
self.server.start()
try:
# Main loop - wait for connections
while True:
time.sleep(0.1)
... |
Start the relay server and wait for connections.
| start | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def entry(options: argparse.Namespace) -> None:
"""
Command-line entry point for relay functionality.
Args:
options: Command line arguments
"""
# Initialize logging from Impacket
_impacket_logger.init()
relay = Relay(**vars(options))
relay.start() |
Command-line entry point for relay functionality.
Args:
options: Command line arguments
| entry | python | ly4k/Certipy | certipy/commands/relay.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/relay.py | MIT |
def entry(options: argparse.Namespace) -> None:
"""
Command-line entry point for certificate operations.
Args:
options: Command-line arguments
"""
# Create target from options
target = Target.from_options(options)
options.__delattr__("target")
# Create request object
reques... |
Command-line entry point for certificate operations.
Args:
options: Command-line arguments
| entry | python | ly4k/Certipy | certipy/commands/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/req.py | MIT |
def __init__(
self,
target: Target,
account: str,
device_id: Optional[str] = None,
out: Optional[str] = None,
connection: Optional[LDAPConnection] = None,
**kwargs, # type: ignore
):
"""
Initialize the Shadow Authentication module.
Ar... |
Initialize the Shadow Authentication module.
Args:
target: Target information including domain, username, and authentication details
account: Account to target for Key Credential operations
device_id: Device ID for operations that require targeting a specific Key Cr... | __init__ | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def connection(self) -> LDAPConnection:
"""
Get or establish an LDAP connection to the domain.
Returns:
Active LDAP connection
Raises:
Exception: If connection fails
"""
if self._connection is not None:
return self._connection
... |
Get or establish an LDAP connection to the domain.
Returns:
Active LDAP connection
Raises:
Exception: If connection fails
| connection | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def get_key_credentials(
self, target_dn: str, user: LDAPEntry
) -> Optional[List[bytes]]:
"""
Retrieve the current Key Credentials for a user.
Args:
target_dn: Distinguished name of the target user
user: LDAP user entry
Returns:
List of ... |
Retrieve the current Key Credentials for a user.
Args:
target_dn: Distinguished name of the target user
user: LDAP user entry
Returns:
List of Key Credential binary values or None on failure
| get_key_credentials | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def set_key_credentials(
self, target_dn: str, user: LDAPEntry, key_credential: List[Union[bytes, str]]
) -> bool:
"""
Set new Key Credentials for a user.
Args:
target_dn: Distinguished name of the target user
user: LDAP user entry
key_credential:... |
Set new Key Credentials for a user.
Args:
target_dn: Distinguished name of the target user
user: LDAP user entry
key_credential: List of Key Credential binary values to set
Returns:
True on success, False on failure
| set_key_credentials | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def generate_key_credential(
self, target_dn: str, subject: str
) -> Tuple[X509Certificate2, KeyCredential, str]:
"""
Generate a new certificate and Key Credential object.
Args:
target_dn: Distinguished name of the target user
subject: Certificate subject nam... |
Generate a new certificate and Key Credential object.
Args:
target_dn: Distinguished name of the target user
subject: Certificate subject name
Returns:
Tuple containing (certificate, key_credential, device_id)
| generate_key_credential | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def add_new_key_credential(
self, target_dn: str, user: LDAPEntry
) -> Optional[Tuple[X509Certificate2, List[Union[bytes, str]], List[bytes], str]]:
"""
Add a new Key Credential to a user.
Args:
target_dn: Distinguished name of the target user
user: LDAP user... |
Add a new Key Credential to a user.
Args:
target_dn: Distinguished name of the target user
user: LDAP user entry
Returns:
Tuple containing (certificate, new_key_credential_list,
saved_key_credential_list, device_id) or None on f... | add_new_key_credential | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def get_key_and_certificate(
self, cert2: X509Certificate2
) -> Tuple[PrivateKeyTypes, x509.Certificate]:
"""
Extract the private key and certificate from an X509Certificate2 object.
Args:
cert2: X509Certificate2 object
Returns:
Tuple containing (pri... |
Extract the private key and certificate from an X509Certificate2 object.
Args:
cert2: X509Certificate2 object
Returns:
Tuple containing (private_key, certificate)
| get_key_and_certificate | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def _get_target_dn(self, user: LDAPEntry) -> Optional[str]:
"""
Get the distinguished name from a user entry and validate it.
Args:
user: LDAP user entry
Returns:
Distinguished name string or None if invalid
"""
target_dn = user.get("distinguishe... |
Get the distinguished name from a user entry and validate it.
Args:
user: LDAP user entry
Returns:
Distinguished name string or None if invalid
| _get_target_dn | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def _get_sam_account_name(self, user: LDAPEntry) -> str:
"""
Get the SAM account name from a user entry.
Args:
user: LDAP user entry
Returns:
SAM account name string
"""
sam_account_name = user.get("sAMAccountName")
if not isinstance(sam... |
Get the SAM account name from a user entry.
Args:
user: LDAP user entry
Returns:
SAM account name string
| _get_sam_account_name | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def auto(self) -> Optional[str]:
"""
Automatically add a Key Credential, authenticate, get NT hash, and restore original state.
This is the most common attack scenario - adding a temporary Key Credential,
using it to authenticate and get the NT hash, then cleaning up by restoring
... |
Automatically add a Key Credential, authenticate, get NT hash, and restore original state.
This is the most common attack scenario - adding a temporary Key Credential,
using it to authenticate and get the NT hash, then cleaning up by restoring
the original Key Credentials.
Ret... | auto | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def add(self) -> bool:
"""
Add a new Key Credential to a user and save the certificate as a PFX file.
Returns:
True on success, False on failure
"""
# Get the target user
user = self.connection.get_user(self.account)
if user is None:
retur... |
Add a new Key Credential to a user and save the certificate as a PFX file.
Returns:
True on success, False on failure
| add | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def list(self) -> bool:
"""
List all Key Credentials for a user.
Returns:
True if Key Credentials were found and listed, False otherwise
"""
# Get the target user
user = self.connection.get_user(self.account)
if user is None:
return False
... |
List all Key Credentials for a user.
Returns:
True if Key Credentials were found and listed, False otherwise
| list | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def clear(self) -> bool:
"""
Clear all Key Credentials for a user.
Returns:
True on success, False on failure
"""
# Get the target user
user = self.connection.get_user(self.account)
if user is None:
return False
sam_account_name =... |
Clear all Key Credentials for a user.
Returns:
True on success, False on failure
| clear | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def remove(self) -> bool:
"""
Remove a specific Key Credential identified by its Device ID.
Returns:
True on success, False on failure
"""
# Ensure a device ID was provided
if self.device_id is None:
logging.error(
"A device ID (-d... |
Remove a specific Key Credential identified by its Device ID.
Returns:
True on success, False on failure
| remove | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def info(self) -> bool:
"""
Show detailed information about a specific Key Credential.
Returns:
True if the Key Credential was found and info displayed, False otherwise
"""
# Ensure a device ID was provided
if self.device_id is None:
logging.error... |
Show detailed information about a specific Key Credential.
Returns:
True if the Key Credential was found and info displayed, False otherwise
| info | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def entry(options: argparse.Namespace) -> None:
"""
Command-line entry point for Shadow Authentication operations.
Args:
options: Command-line arguments
"""
# Create target from options
target = Target.from_options(options)
# Use provided account or default to the authenticated use... |
Command-line entry point for Shadow Authentication operations.
Args:
options: Command-line arguments
| entry | python | ly4k/Certipy | certipy/commands/shadow.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/shadow.py | MIT |
def default_into_transformer(value: Any) -> Any:
"""
Default transformer function that returns the value unchanged.
Args:
value: The value to transform
Returns:
The original value
"""
if isinstance(value, list):
return [default_into_transformer(item) for item in value]
... |
Default transformer function that returns the value unchanged.
Args:
value: The value to transform
Returns:
The original value
| default_into_transformer | python | ly4k/Certipy | certipy/commands/template.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/template.py | MIT |
def default_from_transformer(value: Any) -> Any:
"""
Default transformer function that converts a value to its original form.
Args:
value: The value to transform
Returns:
The original value
"""
if isinstance(value, list):
return [default_from_transformer(item) for item ... |
Default transformer function that converts a value to its original form.
Args:
value: The value to transform
Returns:
The original value
| default_from_transformer | python | ly4k/Certipy | certipy/commands/template.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/template.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.