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 get_templates(self) -> Optional[List[str]]:
"""
Get list of templates enabled on the CA.
Returns:
List of template names and their OIDs
Returns False if the operation fails
"""
if self.ca is None:
logging.error("A CA (-ca) is required")
... |
Get list of templates enabled on the CA.
Returns:
List of template names and their OIDs
Returns False if the operation fails
| get_templates | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def list_templates(self) -> None:
"""
List templates enabled on the CA.
Prints the list of templates to stdout.
"""
certificate_templates = self.get_templates()
if certificate_templates is None:
return
if len(certificate_templates) == 1:
... |
List templates enabled on the CA.
Prints the list of templates to stdout.
| list_templates | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def enable(self, disable: bool = False) -> bool:
"""
Enable or disable a template on the CA.
Args:
disable: If True, disable the template; otherwise enable it
Returns:
True if successful, False otherwise
"""
if self.ca is None:
loggin... |
Enable or disable a template on the CA.
Args:
disable: If True, disable the template; otherwise enable it
Returns:
True if successful, False otherwise
| enable | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def _modify_ca_security(
self, user: str, right: int, right_type: str, remove: bool = False
) -> Union[bool, None]:
"""
Add or remove rights for a user on the CA.
Args:
user: Username
right: Right to add/remove (from CERTIFICATION_AUTHORITY_RIGHTS)
... |
Add or remove rights for a user on the CA.
Args:
user: Username
right: Right to add/remove (from CERTIFICATION_AUTHORITY_RIGHTS)
right_type: Description of the right (for logging)
remove: If True, remove the right; otherwise add it
Returns:
... | _modify_ca_security | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def add_officer(self, officer: str) -> Union[bool, None]:
"""
Add certificate officer rights for a user.
Officers can approve/deny certificate requests.
Args:
officer: Username to add as an officer
Returns:
True if successful, False if failed, None if us... |
Add certificate officer rights for a user.
Officers can approve/deny certificate requests.
Args:
officer: Username to add as an officer
Returns:
True if successful, False if failed, None if user not found
| add_officer | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def remove_officer(self, officer: str) -> Union[bool, None]:
"""
Remove certificate officer rights from a user.
Args:
officer: Username to remove as an officer
Returns:
True if successful, False if failed, None if user not found
"""
return self.r... |
Remove certificate officer rights from a user.
Args:
officer: Username to remove as an officer
Returns:
True if successful, False if failed, None if user not found
| remove_officer | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def remove_manager(self, manager: str) -> Union[bool, None]:
"""
Remove certificate manager rights from a user.
Args:
manager: Username to remove as a manager
Returns:
True if successful, False if failed, None if user not found
"""
return self.re... |
Remove certificate manager rights from a user.
Args:
manager: Username to remove as a manager
Returns:
True if successful, False if failed, None if user not found
| remove_manager | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def get_enrollment_services(self) -> List[LDAPEntry]:
"""
Get all enrollment services in the domain.
Returns:
List of enrollment service objects
"""
enrollment_services = self.connection.search(
"(&(objectClass=pKIEnrollmentService))",
search_... |
Get all enrollment services in the domain.
Returns:
List of enrollment service objects
| get_enrollment_services | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def get_enrollment_service(self, ca: str) -> Optional[LDAPEntry]:
"""
Get a specific enrollment service.
Args:
ca: CA name
Returns:
Enrollment service object or None if not found
"""
enrollment_services = self.connection.search(
f"(&(... |
Get a specific enrollment service.
Args:
ca: CA name
Returns:
Enrollment service object or None if not found
| get_enrollment_service | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def get_backup(self) -> Optional[bytes]:
"""
Retrieve CA backup file from the target.
Returns:
PFX data as bytes or None if retrieval fails
"""
# Connect to SMB share
smbclient = SMBConnection(
self.target.remote_name,
self.target.targ... |
Retrieve CA backup file from the target.
Returns:
PFX data as bytes or None if retrieval fails
| get_backup | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def backup(self) -> bool:
"""
Create a backup of the CA key and certificate.
Returns:
True if successful, False otherwise
"""
# Connect to service control manager
dce = get_dce_rpc(
scmr.MSRPC_UUID_SCMR, # type: ignore
"\\pipe\\svcctl... |
Create a backup of the CA key and certificate.
Returns:
True if successful, False otherwise
| backup | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def __init__(
self,
active_policy: str,
edit_flags: int,
disable_extension_list: List[str],
request_disposition: int,
interface_flags: int,
security: CASecurity,
):
"""
Initialize a CA configuration object.
Args:
active_pol... |
Initialize a CA configuration object.
Args:
active_policy: Name of the active policy module (typically CertificateAuthority_MicrosoftDefault.Policy)
edit_flags: Policy edit flags that control certificate issuance behavior
disable_extension_list: List of disabled cer... | __init__ | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def entry(options: argparse.Namespace) -> None:
"""
Entry point for the 'ca' command.
Args:
options: Command-line arguments
"""
target = Target.from_options(options)
options.__delattr__("target")
ca = CA(target, **vars(options))
# Validate CA name if required
if not option... |
Entry point for the 'ca' command.
Args:
options: Command-line arguments
| entry | python | ly4k/Certipy | certipy/commands/ca.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/ca.py | MIT |
def load_certificate_file(file_path: str) -> bytes:
"""
Load certificate data from a file.
Args:
file_path: Path to certificate file
Returns:
Certificate data as bytes
"""
logging.debug(f"Loading certificate from {file_path!r}")
try:
with open(file_path, "rb") as f:... |
Load certificate data from a file.
Args:
file_path: Path to certificate file
Returns:
Certificate data as bytes
| load_certificate_file | python | ly4k/Certipy | certipy/commands/cert.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/cert.py | MIT |
def load_key_file(file_path: str) -> bytes:
"""
Load private key data from a file.
Args:
file_path: Path to private key file
Returns:
Private key data as bytes
"""
logging.debug(f"Loading private key from {file_path!r}")
try:
with open(file_path, "rb") as f:
... |
Load private key data from a file.
Args:
file_path: Path to private key file
Returns:
Private key data as bytes
| load_key_file | python | ly4k/Certipy | certipy/commands/cert.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/cert.py | MIT |
def parse_certificate(cert_data: bytes) -> x509.Certificate:
"""
Parse certificate data from PEM or DER format.
Args:
cert_data: Raw certificate data
Returns:
Parsed certificate object
"""
try:
# Try PEM format first
return pem_to_cert(cert_data)
except Exce... |
Parse certificate data from PEM or DER format.
Args:
cert_data: Raw certificate data
Returns:
Parsed certificate object
| parse_certificate | python | ly4k/Certipy | certipy/commands/cert.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/cert.py | MIT |
def parse_key(key_data: bytes) -> PrivateKeyTypes:
"""
Parse private key data from PEM or DER format.
Args:
key_data: Raw private key data
Returns:
Parsed private key object
"""
try:
# Try PEM format first
return pem_to_key(key_data)
except Exception:
... |
Parse private key data from PEM or DER format.
Args:
key_data: Raw private key data
Returns:
Parsed private key object
| parse_key | python | ly4k/Certipy | certipy/commands/cert.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/cert.py | MIT |
def write_output(data: Union[bytes, str], output_path: Optional[str] = None) -> None:
"""
Write data to a file or stdout.
Args:
data: Data to write
output_path: Path to output file or None for stdout
"""
if output_path:
# Determine if we need binary mode
mode = "wb" ... |
Write data to a file or stdout.
Args:
data: Data to write
output_path: Path to output file or None for stdout
| write_output | python | ly4k/Certipy | certipy/commands/cert.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/cert.py | MIT |
def entry(options: argparse.Namespace) -> None:
"""
Entry point for the 'cert' command.
Processes certificates and private keys according to specified options.
Args:
options: Command-line arguments
"""
cert, key = None, None
# Validate inputs
if not any([options.pfx, options.c... |
Entry point for the 'cert' command.
Processes certificates and private keys according to specified options.
Args:
options: Command-line arguments
| entry | python | ly4k/Certipy | certipy/commands/cert.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/cert.py | MIT |
def connection(self) -> LDAPConnection:
"""
Get or create an LDAP connection.
Returns:
Active LDAP connection to the target
"""
if self._connection is not None:
return self._connection
self._connection = LDAPConnection(self.target)
self._... |
Get or create an LDAP connection.
Returns:
Active LDAP connection to the target
| connection | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
def user_sids(self) -> Set[str]:
"""
Get current user's SIDs.
Returns:
Set of SIDs associated with the current user
"""
if self._user_sids is None:
self._user_sids: Optional[Set[str]] = self.connection.get_user_sids(
self.target.username, ... |
Get current user's SIDs.
Returns:
Set of SIDs associated with the current user
| user_sids | python | ly4k/Certipy | certipy/commands/find.py | https://github.com/ly4k/Certipy/blob/master/certipy/commands/find.py | MIT |
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 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)
# Initialize RPC interface
self.interface = RPCRequestInterface(parent=self.adcs_relay.... |
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
full_username = f"{self.username}@{self.domain}"
if (
not self.adcs_relay.no_skip
... |
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 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 |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves Python code examples from Django repository that contain 'django' in the code, which helps identify Django-specific code snippets but provides limited analytical insights beyond basic filtering.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.