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 compute_response(
server_challenge: bytes,
client_challenge: bytes,
target_info: bytes,
domain: str,
user: str,
password: str,
nt_hash: str = "",
channel_binding_data: Optional[bytes] = None,
service: str = "HOST",
) -> Tuple[bytes, bytes, bytes, bytes]:
"""
Compute NTLMv... |
Compute NTLMv2 response based on the provided parameters.
Args:
server_challenge: Challenge received from the server
client_challenge: Client-generated random challenge
target_info: Target information provided by the server
domain: Domain name for authentication
user: U... | compute_response | python | ly4k/Certipy | certipy/lib/ntlm.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/ntlm.py | MIT |
def ntlm_negotiate(
signing_required: bool = False,
use_ntlmv2: bool = True,
version: Optional[bytes] = None,
) -> NTLMAuthNegotiate:
"""
Generate an NTLMSSP Type 1 negotiation message.
Args:
signing_required: Whether signing is required for the connection
use_ntlmv2: Whether to... |
Generate an NTLMSSP Type 1 negotiation message.
Args:
signing_required: Whether signing is required for the connection
use_ntlmv2: Whether to use NTLMv2 (should be True for modern systems)
version: OS version to include in the message
Returns:
NTLMAuthNegotiate object repr... | ntlm_negotiate | python | ly4k/Certipy | certipy/lib/ntlm.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/ntlm.py | MIT |
def ntlm_authenticate(
type1: NTLMAuthNegotiate,
challenge: NTLMAuthChallenge,
user: str,
password: str,
domain: str,
nt_hash: str = "",
channel_binding_data: Optional[bytes] = None,
service: str = "HOST",
version: Optional[bytes] = None,
) -> Tuple[NTLMAuthChallengeResponse, bytes, ... |
Generate an NTLMSSP Type 3 authentication message in response to a server challenge.
Args:
type1: The Type 1 negotiate message that was sent
challenge: The Type 2 challenge message received from the server
user: Username for authentication
password: Password for authentication
... | ntlm_authenticate | python | ly4k/Certipy | certipy/lib/ntlm.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/ntlm.py | MIT |
def __init__(
self,
target: Target,
service: str = DEFAULT_SERVICE,
channel_binding: bool = False,
):
"""
Initialize the NTLM authentication handler.
Args:
target: Target object containing connection and authentication details
service:... |
Initialize the NTLM authentication handler.
Args:
target: Target object containing connection and authentication details
service: Service principal name prefix to use (default: "HTTP")
channel_binding: Whether to use channel binding for EPA compliance
| __init__ | python | ly4k/Certipy | certipy/lib/ntlm.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/ntlm.py | MIT |
def auth_flow(
self, request: httpx.Request
) -> Generator[httpx.Request, httpx.Response, None]:
"""
Implement the authentication flow for HTTPX.
This generator handles the NTLM authentication protocol flow by:
1. Sending the initial request
2. If authentication is r... |
Implement the authentication flow for HTTPX.
This generator handles the NTLM authentication protocol flow by:
1. Sending the initial request
2. If authentication is required, starting the NTLM flow
3. Completing the NTLM handshake
Args:
request: The HTTPX r... | auth_flow | python | ly4k/Certipy | certipy/lib/ntlm.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/ntlm.py | MIT |
def retry_with_auth(
self, request: httpx.Request, response: httpx.Response
) -> Generator[httpx.Request, httpx.Response, None]:
"""
Retry the request with NTLM authentication.
Implements the complete NTLM authentication flow:
1. Send Type 1 (Negotiate) message
2. Pr... |
Retry the request with NTLM authentication.
Implements the complete NTLM authentication flow:
1. Send Type 1 (Negotiate) message
2. Process Type 2 (Challenge) message from server
3. Send Type 3 (Authenticate) message
Args:
request: The original HTTPX reques... | retry_with_auth | python | ly4k/Certipy | certipy/lib/ntlm.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/ntlm.py | MIT |
def __init__(self, p: int, g: int):
"""Initialize a new DH instance with random private key."""
self.p = p
self.g = g
self.private_key = os.urandom(32)
self.private_key_int = int.from_bytes(self.private_key, byteorder="big")
self.dh_nonce = os.urandom(32) | Initialize a new DH instance with random private key. | __init__ | python | ly4k/Certipy | certipy/lib/pkinit.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/pkinit.py | MIT |
def get_public_key(self) -> int:
"""
Calculate the public key.
Returns:
Public key value (g^x mod p)
Raises:
ValueError: If p and g are not set
"""
# y = g^x mod p
return pow(self.g, self.private_key_int, self.p) |
Calculate the public key.
Returns:
Public key value (g^x mod p)
Raises:
ValueError: If p and g are not set
| get_public_key | python | ly4k/Certipy | certipy/lib/pkinit.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/pkinit.py | MIT |
def exchange(self, peer_public_key: int) -> bytes:
"""
Perform key exchange with peer's public key.
Args:
peer_public_key: Peer's public key value
Returns:
The shared secret as bytes
"""
shared_key_int = pow(peer_public_key, self.private_key_int,... |
Perform key exchange with peer's public key.
Args:
peer_public_key: Peer's public key value
Returns:
The shared secret as bytes
| exchange | python | ly4k/Certipy | certipy/lib/pkinit.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/pkinit.py | MIT |
def sign_authpack(
data: bytes,
key: rsa.RSAPrivateKey,
cert: Union[x509.Certificate, asn1x509.Certificate],
) -> bytes:
"""
Create a signed CMS structure containing the AuthPack.
Args:
data: The AuthPack data to sign
key: RSA private key for signing
cert: Certificate to... |
Create a signed CMS structure containing the AuthPack.
Args:
data: The AuthPack data to sign
key: RSA private key for signing
cert: Certificate to include in the signed data
Returns:
ASN.1 DER encoded CMS signed data
| sign_authpack | python | ly4k/Certipy | certipy/lib/pkinit.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/pkinit.py | MIT |
def build_pkinit_as_req(
username: str, domain: str, key: rsa.RSAPrivateKey, cert: x509.Certificate
) -> Tuple[bytes, DirtyDH]:
"""
Build a PKINIT AS-REQ message.
Args:
username: Client username
domain: Domain/realm name
key: RSA private key for signing
cert: Client cert... |
Build a PKINIT AS-REQ message.
Args:
username: Client username
domain: Domain/realm name
key: RSA private key for signing
cert: Client certificate
Returns:
A tuple containing:
- The encoded AS-REQ message
- The DirtyDH object for later key exchange
... | build_pkinit_as_req | python | ly4k/Certipy | certipy/lib/pkinit.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/pkinit.py | MIT |
def __init__(self, *args, **kwargs) -> None: # type: ignore
"""
Initialize a registry entry.
Args:
**kwargs: Key-value pairs to initialize the entry with
"""
super().__init__(self, *args, **kwargs)
if "attributes" not in self:
self["attributes"] ... |
Initialize a registry entry.
Args:
**kwargs: Key-value pairs to initialize the entry with
| __init__ | python | ly4k/Certipy | certipy/lib/registry.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/registry.py | MIT |
def get_raw(self, key: str) -> Union[bytes, List[bytes], None]:
"""
Get a raw (bytes) representation of an attribute value.
Args:
key: The attribute name to retrieve
Returns:
Raw data as bytes, list of bytes, or None if not found
Notes:
- St... |
Get a raw (bytes) representation of an attribute value.
Args:
key: The attribute name to retrieve
Returns:
Raw data as bytes, list of bytes, or None if not found
Notes:
- String values are encoded to bytes
- List values have each item e... | get_raw | python | ly4k/Certipy | certipy/lib/registry.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/registry.py | MIT |
def __init__(self, domain: str, sids: List[str], scheme: str = "file") -> None:
"""
Initialize a registry connection.
Args:
domain: Domain name for the connection
sids: List of security identifiers to track
scheme: Connection scheme, defaults to "file"
... |
Initialize a registry connection.
Args:
domain: Domain name for the connection
sids: List of security identifiers to track
scheme: Connection scheme, defaults to "file"
| __init__ | python | ly4k/Certipy | certipy/lib/registry.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/registry.py | MIT |
def get_user_sids(
self,
_username: str,
_user_sid: Optional[str] = None,
_user_dn: Optional[str] = None,
) -> List[str]:
"""
Get user security identifiers.
Args:
_username: Username (not used in this implementation)
_user_sid: User's ... |
Get user security identifiers.
Args:
_username: Username (not used in this implementation)
_user_sid: User's primary SID (not used in this implementation)
_user_dn: User's distinguished name (not used in this implementation)
Returns:
List of SID... | get_user_sids | python | ly4k/Certipy | certipy/lib/registry.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/registry.py | MIT |
def lookup_sid(self, sid: str) -> RegEntry:
"""
Look up a security identifier and return corresponding registry entry.
Args:
sid: Security identifier to look up
Returns:
RegEntry object representing the SID
Notes:
- Checks cached entries fir... |
Look up a security identifier and return corresponding registry entry.
Args:
sid: Security identifier to look up
Returns:
RegEntry object representing the SID
Notes:
- Checks cached entries first
- Then checks well-known SIDs
... | lookup_sid | python | ly4k/Certipy | certipy/lib/registry.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/registry.py | MIT |
def __init__(self, interface: IRemUnknown2):
"""
Initialize the ICertRequestD interface.
Args:
interface: IRemUnknown2 interface from DCOM connection
"""
super().__init__(interface)
self._iid = IID_ICertRequestD |
Initialize the ICertRequestD interface.
Args:
interface: IRemUnknown2 interface from DCOM connection
| __init__ | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def __init__(
self, error_string: Any = None, error_code: Any = None, packet: Any = None
):
"""
Initialize the DCERPCSessionError.
Args:
error_string: Error description
error_code: Numeric error code
packet: The RPC packet that caused the error
... |
Initialize the DCERPCSessionError.
Args:
error_string: Error description
error_code: Numeric error code
packet: The RPC packet that caused the error
| __init__ | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def __str__(self) -> str:
"""
Format the error message with translated error code.
Returns:
Human-readable error message
"""
self.error_code &= 0xFFFFFFFF # type: ignore
error_msg = translate_error_code(self.error_code)
return f"RequestSessionError: ... |
Format the error message with translated error code.
Returns:
Human-readable error message
| __str__ | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def handle_rpc_retrieve_response(
response: Dict[str, Any],
) -> Optional[x509.Certificate]:
"""
Process the RPC certificate retrieval response.
Args:
response: The RPC response dictionary
Returns:
Certificate object if successful, None otherwise
"""
error_code = response["... |
Process the RPC certificate retrieval response.
Args:
response: The RPC response dictionary
Returns:
Certificate object if successful, None otherwise
| handle_rpc_retrieve_response | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def handle_rpc_request_response(
response: Dict[str, Any],
) -> Union[x509.Certificate, int]:
"""
Process the RPC certificate request response.
Args:
response: The RPC response dictionary
Returns:
Certificate object if immediately successful, or request ID if pending/failed
"""... |
Process the RPC certificate request response.
Args:
response: The RPC response dictionary
Returns:
Certificate object if immediately successful, or request ID if pending/failed
| handle_rpc_request_response | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def handle_request_response(
cert: x509.Certificate,
key: PrivateKeyTypes,
username: str,
subject: Optional[str] = None,
alt_sid: Optional[str] = None,
out: Optional[str] = None,
pfx_password: Optional[str] = None,
) -> Tuple[bytes, str]:
"""
Process a successful certificate request ... |
Process a successful certificate request by saving the certificate and private key.
Args:
cert: The issued certificate
key: The private key
username: The username associated with the certificate
subject: Optional subject name
alt_sid: Optional alternate SID
out:... | handle_request_response | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def handle_retrieve(
cert: x509.Certificate,
request_id: int,
username: str,
out: Optional[str] = None,
pfx_password: Optional[str] = None,
) -> bool:
"""
Process a retrieved certificate by saving it with the private key if available.
Args:
cert: The retrieved certificate
... |
Process a retrieved certificate by saving it with the private key if available.
Args:
cert: The retrieved certificate
request_id: The certificate request ID
username: The username associated with the certificate
out: Optional output filename
pfx_password: Optional PFX p... | handle_retrieve | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def handle_pending_key_save(
request_id: int, key: PrivateKeyTypes, out: Optional[str] = None
) -> None:
"""
Offer to save the private key for pending certificate requests.
Args:
request_id: The certificate request ID
key: The private key to save
out: Optional output filename fo... |
Offer to save the private key for pending certificate requests.
Args:
request_id: The certificate request ID
key: The private key to save
out: Optional output filename for the private key
| handle_pending_key_save | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def web_request(
session: httpx.Client,
username: str,
csr: Union[str, bytes, x509.CertificateSigningRequest],
attributes_list: List[str],
template: str,
key: PrivateKeyTypes,
out: Optional[str] = None,
) -> Optional[x509.Certificate]:
"""
Request a certificate via the web enrollment... |
Request a certificate via the web enrollment interface.
Args:
session: HTTP session client
username: Username for the certificate
csr: Certificate signing request (bytes or object)
attributes_list: List of certificate attributes
template: Certificate template name
... | web_request | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def web_retrieve(
session: httpx.Client,
request_id: int,
) -> Optional[x509.Certificate]:
"""
Retrieve a certificate via the web enrollment interface.
Args:
session: HTTP session client
request_id: The certificate request ID
Returns:
Certificate if successfully retriev... |
Retrieve a certificate via the web enrollment interface.
Args:
session: HTTP session client
request_id: The certificate request ID
Returns:
Certificate if successfully retrieved, None otherwise
| web_retrieve | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def _determine_output_filename(
out: Optional[str], identities: List[Tuple[str, str]], username: str
) -> str:
"""
Determine the output filename to use for saving certificates/keys.
Args:
out: User-specified output name (if any)
identities: List of certificate identities
usernam... |
Determine the output filename to use for saving certificates/keys.
Args:
out: User-specified output name (if any)
identities: List of certificate identities
username: The username associated with the certificate
Returns:
The output filename (without extension)
| _determine_output_filename | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def _handle_policy_denial(session: httpx.Client, request_id: int) -> None:
"""
Handle certificate request denied by policy.
Args:
session: HTTP session client
request_id: The certificate request ID
"""
try:
res = session.get("/certsrv/certnew.cer", params={"ReqID": request_i... |
Handle certificate request denied by policy.
Args:
session: HTTP session client
request_id: The certificate request ID
| _handle_policy_denial | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def _handle_other_errors(content: str) -> None:
"""
Handle other certificate request errors.
Args:
content: Response content
"""
error_code_matches = re.findall(
r"Denied by Policy Module (0x[0-9a-fA-F]+),", content
)
try:
if error_code_matches:
error_c... |
Handle other certificate request errors.
Args:
content: Response content
| _handle_other_errors | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def _log_response_if_verbose(content: str) -> None:
"""
Log response content if verbose logging is enabled.
Args:
content: Response content to log
"""
if is_verbose():
print(content)
else:
logging.warning("Use -debug to print the response") |
Log response content if verbose logging is enabled.
Args:
content: Response content to log
| _log_response_if_verbose | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def __init__(self, parent: "Request"):
"""
Initialize the DCOM request interface.
Args:
parent: The parent Request object
"""
self.parent = parent
self._dcom: Optional[DCOMConnection] = None |
Initialize the DCOM request interface.
Args:
parent: The parent Request object
| __init__ | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def dcom(self) -> DCOMConnection:
"""
Get or establish a DCOM connection to the certificate authority.
Returns:
Active DCOM connection
Raises:
Exception: If target is not set or connection fails
"""
if self._dcom is not None:
return s... |
Get or establish a DCOM connection to the certificate authority.
Returns:
Active DCOM connection
Raises:
Exception: If target is not set or connection fails
| dcom | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def retrieve(self, request_id: int) -> Optional[x509.Certificate]:
"""
Retrieve a certificate by request ID via DCOM.
Args:
request_id: The request ID to retrieve
Returns:
Certificate object if successful, None on failure
"""
# Prepare empty blob... |
Retrieve a certificate by request ID via DCOM.
Args:
request_id: The request ID to retrieve
Returns:
Certificate object if successful, None on failure
| retrieve | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def __init__(self, parent: "Request"):
"""
Initialize the RPC request interface.
Args:
parent: The parent Request object
"""
self.parent = parent
self._dce = None |
Initialize the RPC request interface.
Args:
parent: The parent Request object
| __init__ | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def dce(self) -> Optional[rpcrt.DCERPC_v5]:
"""
Get or establish an RPC connection to the certificate authority.
Returns:
Active RPC connection
Raises:
Exception: If target is not set or connection fails
"""
if self._dce is not None:
... |
Get or establish an RPC connection to the certificate authority.
Returns:
Active RPC connection
Raises:
Exception: If target is not set or connection fails
| dce | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def dce_request(self, request: NDRCALL) -> Dict[str, Any]:
"""
Send a DCE RPC request and handle the response.
This wrapper method properly handles the DCE RPC request to ensure static
code analysis tools correctly understand the return value. The underlying
impacket.dcerpc.v5.r... |
Send a DCE RPC request and handle the response.
This wrapper method properly handles the DCE RPC request to ensure static
code analysis tools correctly understand the return value. The underlying
impacket.dcerpc.v5.rpcrt.DCERPC_v5.request method has type annotation
issues that ... | dce_request | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def retrieve(self, request_id: int) -> Optional[x509.Certificate]:
"""
Retrieve a certificate by request ID via RPC.
Args:
request_id: The request ID to retrieve
Returns:
Certificate object if successful, False on failure
"""
# Prepare empty blob... |
Retrieve a certificate by request ID via RPC.
Args:
request_id: The request ID to retrieve
Returns:
Certificate object if successful, False on failure
| retrieve | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def __init__(self, parent: "Request"):
"""
Initialize the Web Enrollment request interface.
Args:
parent: The parent Request object
"""
self.parent = parent
self.target = self.parent.target
self._session = None
self.base_url = "" |
Initialize the Web Enrollment request interface.
Args:
parent: The parent Request object
| __init__ | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def session(self) -> Optional[httpx.Client]:
"""
Get or establish an HTTP session to the certificate authority.
Returns:
Active HTTP session, or None if connection failed
Raises:
Exception: If target is not set or connection fails
"""
if self._se... |
Get or establish an HTTP session to the certificate authority.
Returns:
Active HTTP session, or None if connection failed
Raises:
Exception: If target is not set or connection fails
| session | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def _try_connection(self, session: httpx.Client) -> bool:
"""
Try to connect to the Web Enrollment interface.
Args:
session: HTTP session to use
base_url: Base URL to connect to
Returns:
True if connection was successful, False otherwise
"""
... |
Try to connect to the Web Enrollment interface.
Args:
session: HTTP session to use
base_url: Base URL to connect to
Returns:
True if connection was successful, False otherwise
| _try_connection | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def retrieve(self, request_id: int) -> Optional[x509.Certificate]:
"""
Retrieve a certificate by request ID via Web Enrollment.
Args:
request_id: The request ID to retrieve
Returns:
Certificate object if successful, None on failure
"""
if self.se... |
Retrieve a certificate by request ID via Web Enrollment.
Args:
request_id: The request ID to retrieve
Returns:
Certificate object if successful, None on failure
| retrieve | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def __init__(
self,
target: Target,
ca: Optional[str] = None,
template: str = "User",
upn: Optional[str] = None,
dns: Optional[str] = None,
sid: Optional[str] = None,
subject: Optional[str] = None,
application_policies: Optional[List[str]] = None,
... |
Initialize a certificate request object.
Args:
target: Target information including host and authentication
ca: Certificate Authority name
template: Certificate template name
upn: Alternative UPN (User Principal Name)
dns: Alternative DNS nam... | __init__ | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def interface(self) -> RequestInterface:
"""
Get the appropriate request interface based on configuration.
Returns:
Configured request interface instance
"""
if self._interface is not None:
return self._interface
# Select interface based on confi... |
Get the appropriate request interface based on configuration.
Returns:
Configured request interface instance
| interface | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def retrieve(self) -> bool:
"""
Retrieve a certificate by request ID.
Returns:
True if successful, False otherwise
"""
if self.request_id is None:
logging.error("No request ID specified")
return False
request_id = int(self.request_id)... |
Retrieve a certificate by request ID.
Returns:
True if successful, False otherwise
| retrieve | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def request(self) -> Union[bool, Tuple[bytes, str]]:
"""
Request a new certificate from AD CS.
Returns:
PFX data and filename if successful, False otherwise
"""
# Determine username for certificate
username = self.target.username
# Validate request o... |
Request a new certificate from AD CS.
Returns:
PFX data and filename if successful, False otherwise
| request | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def get_cax(self) -> Union[bool, bytes]:
"""
Retrieve the CAX (Exchange) certificate.
Returns:
CAX certificate in DER format if successful, False otherwise
"""
ca = CA(self.target, self.ca)
logging.info("Trying to retrieve CAX certificate")
cax_cert =... |
Retrieve the CAX (Exchange) certificate.
Returns:
CAX certificate in DER format if successful, False otherwise
| get_cax | python | ly4k/Certipy | certipy/lib/req.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/req.py | MIT |
def get_dcom_connection(target: Target) -> DCOMConnection:
"""
Establish a DCOM connection to the target.
Args:
target: Target object containing connection parameters
Returns:
DCOMConnection object for the target
Notes:
Uses Kerberos authentication if target.do_kerberos is... |
Establish a DCOM connection to the target.
Args:
target: Target object containing connection parameters
Returns:
DCOMConnection object for the target
Notes:
Uses Kerberos authentication if target.do_kerberos is True
| get_dcom_connection | python | ly4k/Certipy | certipy/lib/rpc.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/rpc.py | MIT |
def get_dce_rpc_from_string_binding(
string_binding: str,
target: Target,
timeout: int = 5,
target_ip: Optional[str] = None,
remote_name: Optional[str] = None,
auth_level: int = rpcrt.RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
) -> rpcrt.DCERPC_v5:
"""
Create a DCE RPC connection from a string bindi... |
Create a DCE RPC connection from a string binding.
Args:
string_binding: The RPC string binding (e.g., "ncacn_np:server[pipe]")
target: Target object containing authentication parameters
timeout: Connection timeout in seconds
target_ip: Override target IP address (uses target.t... | get_dce_rpc_from_string_binding | python | ly4k/Certipy | certipy/lib/rpc.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/rpc.py | MIT |
def get_dynamic_endpoint(
interface: bytes, target: str, timeout: int = 5
) -> Optional[str]:
"""
Resolve a dynamic endpoint for an RPC interface.
Args:
interface: RPC interface identifier (UUID)
target: Target hostname or IP address
timeout: Connection timeout in seconds
R... |
Resolve a dynamic endpoint for an RPC interface.
Args:
interface: RPC interface identifier (UUID)
target: Target hostname or IP address
timeout: Connection timeout in seconds
Returns:
Resolved endpoint string or None if resolution fails
Notes:
Uses the endpoin... | get_dynamic_endpoint | python | ly4k/Certipy | certipy/lib/rpc.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/rpc.py | MIT |
def get_dce_rpc(
interface: bytes,
named_pipe: str,
target: Target,
timeout: int = 5,
dynamic: bool = False,
auth_level_np: int = rpcrt.RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
auth_level_dyn: int = rpcrt.RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
) -> Optional[rpcrt.DCERPC_v5]:
"""
Get a connected DCE RP... |
Get a connected DCE RPC interface.
This function attempts to connect to an RPC interface using either named pipes
or dynamic endpoints. It will try multiple methods if the first fails.
Args:
interface: RPC interface identifier (UUID)
named_pipe: Named pipe path to connect to
t... | get_dce_rpc | python | ly4k/Certipy | certipy/lib/rpc.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/rpc.py | MIT |
def _try_binding(string_binding: str, auth_level: int) -> Optional[rpcrt.DCERPC_v5]:
"""Try to connect to a specific string binding."""
dce = get_dce_rpc_from_string_binding(
string_binding, target, timeout, auth_level=auth_level
)
logging.debug(f"Trying to connect to endpoi... | Try to connect to a specific string binding. | _try_binding | python | ly4k/Certipy | certipy/lib/rpc.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/rpc.py | MIT |
def __init__(self, security_descriptor: bytes):
"""
Initialize a security descriptor parser.
Args:
security_descriptor: Binary representation of a security descriptor
"""
if self.RIGHTS_TYPE is None:
raise NotImplementedError("Subclasses must define RIGHT... |
Initialize a security descriptor parser.
Args:
security_descriptor: Binary representation of a security descriptor
| __init__ | python | ly4k/Certipy | certipy/lib/security.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/security.py | MIT |
def _parse_aces(self) -> None:
"""
Parse the access control entries from the security descriptor.
This method extracts both standard rights and extended rights.
"""
aces = self.sd["Dacl"]["Data"]
# TODO: Handle DENIED ACEs
for ace in aces:
sid = for... |
Parse the access control entries from the security descriptor.
This method extracts both standard rights and extended rights.
| _parse_aces | python | ly4k/Certipy | certipy/lib/security.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/security.py | MIT |
def _parse_aces(self) -> None:
"""
Parse the access control entries from the security descriptor.
CA security descriptors have a simpler structure than AD security descriptors.
"""
aces = self.sd["Dacl"]["Data"]
for ace in aces:
sid = format_sid(ace["Ace"]["... |
Parse the access control entries from the security descriptor.
CA security descriptors have a simpler structure than AD security descriptors.
| _parse_aces | python | ly4k/Certipy | certipy/lib/security.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/security.py | MIT |
def is_admin_sid(sid: str) -> bool:
"""
Check if a security identifier (SID) belongs to an administrative group.
This function identifies built-in administrator accounts and groups by their well-known SIDs.
Args:
sid: The security identifier to check
Returns:
True if the SID belon... |
Check if a security identifier (SID) belongs to an administrative group.
This function identifies built-in administrator accounts and groups by their well-known SIDs.
Args:
sid: The security identifier to check
Returns:
True if the SID belongs to an administrative group, False otherw... | is_admin_sid | python | ly4k/Certipy | certipy/lib/security.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/security.py | MIT |
def create_authenticated_users_sd() -> ldaptypes.SR_SECURITY_DESCRIPTOR:
"""
Create a security descriptor for the "Authenticated Users" group.
This security descriptor grants the "Authenticated Users" group
the right to read the object and its properties.
"""
sd = ldaptypes.SR_SECURITY_DESCRIPTO... |
Create a security descriptor for the "Authenticated Users" group.
This security descriptor grants the "Authenticated Users" group
the right to read the object and its properties.
| create_authenticated_users_sd | python | ly4k/Certipy | certipy/lib/security.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/security.py | MIT |
def to_list(self) -> List["IntFlag"]:
"""
Decompose flag into list of individual flags.
Returns:
List of individual flag members
"""
if not self._value_:
return []
# Get all individual flags that make up this value
return [
fl... |
Decompose flag into list of individual flags.
Returns:
List of individual flag members
| to_list | python | ly4k/Certipy | certipy/lib/structs.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/structs.py | MIT |
def to_str_list(self) -> List[str]:
"""
Return list of flag names.
Returns:
List of flag names
"""
return [
to_pascal_case(flag.name)
for flag in self.to_list()
if flag.name is not None
] |
Return list of flag names.
Returns:
List of flag names
| to_str_list | python | ly4k/Certipy | certipy/lib/structs.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/structs.py | MIT |
def __str__(self) -> str:
"""
Smart string representation that handles combinations gracefully.
Returns:
Human-readable string representation of the flag(s)
"""
# Handle named values
if self.name is not None:
return to_pascal_case(self.name)
... |
Smart string representation that handles combinations gracefully.
Returns:
Human-readable string representation of the flag(s)
| __str__ | python | ly4k/Certipy | certipy/lib/structs.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/structs.py | MIT |
def __init__(
self,
resolver: "DnsResolver",
domain: str = "",
username: str = "",
password: Optional[str] = None,
remote_name: str = "",
hashes: Optional[str] = None,
lmhash: str = "",
nthash: str = "",
do_kerberos: bool = False,
d... |
Initialize a Target with the specified connection parameters.
Args:
resolver: DNS resolver for hostname resolution
domain: Domain name (empty string if not specified)
username: Username (empty string if not specified)
password: Password (None if not spec... | __init__ | python | ly4k/Certipy | certipy/lib/target.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/target.py | MIT |
def from_options(
options: argparse.Namespace,
dc_as_target: bool = False,
require_username: bool = True,
) -> "Target":
"""
Create a Target from command line options.
Args:
options: Command line options
dc_as_target: Whether to use DC as targ... |
Create a Target from command line options.
Args:
options: Command line options
dc_as_target: Whether to use DC as target
Returns:
Target: Configured target object
Raises:
Exception: If no target can be determined
| from_options | python | ly4k/Certipy | certipy/lib/target.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/target.py | MIT |
def __init__(self) -> None:
"""Initialize a new DNS resolver with default settings."""
self.resolver: Resolver = Resolver()
self.use_tcp: bool = False
self.mappings: Dict[str, str] = {} | Initialize a new DNS resolver with default settings. | __init__ | python | ly4k/Certipy | certipy/lib/target.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/target.py | MIT |
def from_options(options: argparse.Namespace, target: "Target") -> "DnsResolver":
"""
Create a DnsResolver from command line options.
Args:
options: The command line options
target: The Target object
Returns:
DnsResolver: A configured DNS resolver
... |
Create a DnsResolver from command line options.
Args:
options: The command line options
target: The Target object
Returns:
DnsResolver: A configured DNS resolver
| from_options | python | ly4k/Certipy | certipy/lib/target.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/target.py | MIT |
def create(
ns: Optional[str] = None,
dc_ip: Optional[str] = None,
dns_tcp: bool = False,
) -> "DnsResolver":
"""
Create a DnsResolver with specified parameters.
Args:
target: Target object which may contain DC IP information
ns: Nameserver to... |
Create a DnsResolver with specified parameters.
Args:
target: Target object which may contain DC IP information
ns: Nameserver to use
dns_tcp: Whether to use TCP for DNS queries
Returns:
DnsResolver: A configured DNS resolver
| create | python | ly4k/Certipy | certipy/lib/target.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/target.py | MIT |
def resolve(self, hostname: str) -> str:
"""
Resolve hostname to IP address using DNS or local resolution.
Uses cache for previously resolved hostnames.
Args:
hostname: The hostname to resolve
Returns:
str: The resolved IP address or the original hostnam... |
Resolve hostname to IP address using DNS or local resolution.
Uses cache for previously resolved hostnames.
Args:
hostname: The hostname to resolve
Returns:
str: The resolved IP address or the original hostname if resolution fails
| resolve | python | ly4k/Certipy | certipy/lib/target.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/target.py | MIT |
def is_ip(hostname: Optional[str]) -> bool:
"""
Check if the given hostname is an IP address.
Args:
hostname: The hostname to check
Returns:
bool: True if the hostname is an IP address, False otherwise
"""
if hostname is None:
return False
try:
_ = socket.i... |
Check if the given hostname is an IP address.
Args:
hostname: The hostname to check
Returns:
bool: True if the hostname is an IP address, False otherwise
| is_ip | python | ly4k/Certipy | certipy/lib/target.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/target.py | MIT |
def get_kerberos_principal() -> Optional[Tuple[str, str]]:
"""
Get Kerberos principal information from the KRB5CCNAME environment variable.
Returns:
Tuple containing (username, domain) or None if not available
"""
krb5ccname = os.getenv("KRB5CCNAME")
if krb5ccname is None:
loggi... |
Get Kerberos principal information from the KRB5CCNAME environment variable.
Returns:
Tuple containing (username, domain) or None if not available
| get_kerberos_principal | python | ly4k/Certipy | certipy/lib/target.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/target.py | MIT |
def filetime_to_span(filetime: bytes) -> int:
"""
Convert Windows FILETIME to time span in seconds.
Windows FILETIME is a 64-bit value representing the number of
100-nanosecond intervals since January 1, 1601 UTC.
When used for validity periods, negative values represent time remaining.
Args:
... |
Convert Windows FILETIME to time span in seconds.
Windows FILETIME is a 64-bit value representing the number of
100-nanosecond intervals since January 1, 1601 UTC.
When used for validity periods, negative values represent time remaining.
Args:
filetime: Windows FILETIME as 8 bytes
Re... | filetime_to_span | python | ly4k/Certipy | certipy/lib/time.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/time.py | MIT |
def span_to_filetime(span: int) -> bytes:
"""
Convert a time span in seconds to Windows FILETIME format.
This function converts the time span to a 64-bit integer representing
the number of 100-nanosecond intervals since January 1, 1601 UTC.
Args:
span: Time span in seconds (positive intege... |
Convert a time span in seconds to Windows FILETIME format.
This function converts the time span to a 64-bit integer representing
the number of 100-nanosecond intervals since January 1, 1601 UTC.
Args:
span: Time span in seconds (positive integer)
Returns:
Windows FILETIME as 8 by... | span_to_filetime | python | ly4k/Certipy | certipy/lib/time.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/time.py | MIT |
def span_to_str(span: int) -> str:
"""
Convert a time span in seconds to a human-readable string.
The function converts the span to the largest appropriate unit
(years, months, weeks, days, or hours) for readability.
Args:
span: Time span in seconds (positive integer)
Returns:
... |
Convert a time span in seconds to a human-readable string.
The function converts the span to the largest appropriate unit
(years, months, weeks, days, or hours) for readability.
Args:
span: Time span in seconds (positive integer)
Returns:
Human-readable time span (e.g., "1 year",... | span_to_str | python | ly4k/Certipy | certipy/lib/time.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/time.py | MIT |
def filetime_to_str(filetime: bytes) -> str:
"""
Convert Windows FILETIME to a human-readable time span string.
This is a convenience function that combines filetime_to_span()
and span_to_str() operations.
Args:
filetime: Windows FILETIME as bytes
Returns:
Human-readable time ... |
Convert Windows FILETIME to a human-readable time span string.
This is a convenience function that combines filetime_to_span()
and span_to_str() operations.
Args:
filetime: Windows FILETIME as bytes
Returns:
Human-readable time span string
Example:
>>> filetime_bytes... | filetime_to_str | python | ly4k/Certipy | certipy/lib/time.py | https://github.com/ly4k/Certipy/blob/master/certipy/lib/time.py | MIT |
def __init__(self, serial: str, adb: ADBWrapper):
"""Initialize device.
Args:
serial: Device serial number
adb: ADB wrapper instance
"""
self._serial = serial
self._adb = adb
self._properties_cache: Dict[str, str] = {} | Initialize device.
Args:
serial: Device serial number
adb: ADB wrapper instance
| __init__ | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def tap(self, x: int, y: int) -> None:
"""Tap at coordinates.
Args:
x: X coordinate
y: Y coordinate
"""
await self._adb.shell(self._serial, f"input tap {x} {y}") | Tap at coordinates.
Args:
x: X coordinate
y: Y coordinate
| tap | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def swipe(
self,
start_x: int,
start_y: int,
end_x: int,
end_y: int,
duration_ms: int = 300
) -> None:
"""Perform swipe gesture.
Args:
start_x: Starting X coordinate
start_y: Starting Y coordinate
end_... | Perform swipe gesture.
Args:
start_x: Starting X coordinate
start_y: Starting Y coordinate
end_x: Ending X coordinate
end_y: Ending Y coordinate
duration_ms: Swipe duration in milliseconds
| swipe | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def input_text(self, text: str) -> None:
"""Input text.
Args:
text: Text to input
"""
await self._adb.shell(self._serial, f"input text {text}") | Input text.
Args:
text: Text to input
| input_text | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def press_key(self, keycode: int) -> None:
"""Press a key.
Args:
keycode: Android keycode to press
"""
await self._adb.shell(self._serial, f"input keyevent {keycode}") | Press a key.
Args:
keycode: Android keycode to press
| press_key | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def start_activity(
self,
package: str,
activity: str = ".MainActivity",
extras: Optional[Dict[str, str]] = None
) -> None:
"""Start an app activity.
Args:
package: Package name
activity: Activity name
extras: Intent ... | Start an app activity.
Args:
package: Package name
activity: Activity name
extras: Intent extras
| start_activity | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def start_app(self, package: str, activity: str = "") -> str:
"""Start an app on the device.
Args:
package: Package name
activity: Optional activity name (if empty, launches default activity)
Returns:
Result message
"""
... | Start an app on the device.
Args:
package: Package name
activity: Optional activity name (if empty, launches default activity)
Returns:
Result message
| start_app | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def install_app(self, apk_path: str, reinstall: bool = False, grant_permissions: bool = True) -> str:
"""Install an APK on the device.
Args:
apk_path: Path to the APK file
reinstall: Whether to reinstall if app exists
grant_permissions: Whether to grant... | Install an APK on the device.
Args:
apk_path: Path to the APK file
reinstall: Whether to reinstall if app exists
grant_permissions: Whether to grant all requested permissions
Returns:
Installation result
| install_app | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def uninstall_app(self, package: str, keep_data: bool = False) -> str:
"""Uninstall an app from the device.
Args:
package: Package name to uninstall
keep_data: Whether to keep app data and cache directories
Returns:
Uninstallation r... | Uninstall an app from the device.
Args:
package: Package name to uninstall
keep_data: Whether to keep app data and cache directories
Returns:
Uninstallation result
| uninstall_app | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
async def list_packages(self, include_system_apps: bool = False) -> List[Dict[str, str]]:
"""List installed packages on the device.
Args:
include_system_apps: Whether to include system apps
Returns:
List of package dictionaries with 'package' and 'pa... | List installed packages on the device.
Args:
include_system_apps: Whether to include system apps
Returns:
List of package dictionaries with 'package' and 'path' keys
| list_packages | python | droidrun/droidrun | droidrun/adb/device.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/device.py | MIT |
def __init__(self, adb_path: Optional[str] = None):
"""Initialize device manager.
Args:
adb_path: Path to ADB binary
"""
self._adb = ADBWrapper(adb_path)
self._devices: Dict[str, Device] = {} | Initialize device manager.
Args:
adb_path: Path to ADB binary
| __init__ | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
async def list_devices(self) -> List[Device]:
"""List connected devices.
Returns:
List of connected devices
"""
devices_info = await self._adb.get_devices()
# Update device cache
current_serials = set()
for device_info in devices_info... | List connected devices.
Returns:
List of connected devices
| list_devices | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
async def get_device(self, serial: str) -> Optional[Device]:
"""Get a specific device.
Args:
serial: Device serial number
Returns:
Device instance if found, None otherwise
"""
if serial in self._devices:
return self._devic... | Get a specific device.
Args:
serial: Device serial number
Returns:
Device instance if found, None otherwise
| get_device | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
async def connect(self, host: str, port: int = 5555) -> Optional[Device]:
"""Connect to a device over TCP/IP.
Args:
host: Device IP address
port: Device port
Returns:
Connected device instance
"""
try:
serial =... | Connect to a device over TCP/IP.
Args:
host: Device IP address
port: Device port
Returns:
Connected device instance
| connect | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
async def disconnect(self, serial: str) -> bool:
"""Disconnect from a device.
Args:
serial: Device serial number
Returns:
True if disconnected successfully
"""
success = await self._adb.disconnect(serial)
if success and serial... | Disconnect from a device.
Args:
serial: Device serial number
Returns:
True if disconnected successfully
| disconnect | python | droidrun/droidrun | droidrun/adb/manager.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/manager.py | MIT |
def __init__(self, adb_path: Optional[str] = None):
"""Initialize ADB wrapper.
Args:
adb_path: Path to ADB binary (defaults to 'adb' in PATH)
"""
self.adb_path = adb_path or "adb"
self._devices_cache: List[Dict[str, str]] = [] | Initialize ADB wrapper.
Args:
adb_path: Path to ADB binary (defaults to 'adb' in PATH)
| __init__ | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def _run_command(
self,
args: List[str],
timeout: Optional[float] = None,
check: bool = True
) -> Tuple[str, str]:
"""Run an ADB command.
Args:
args: Command arguments
timeout: Command timeout in seconds
check: Whet... | Run an ADB command.
Args:
args: Command arguments
timeout: Command timeout in seconds
check: Whether to check return code
Returns:
Tuple of (stdout, stderr)
| _run_command | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def _run_device_command(
self,
serial: str,
args: List[str],
timeout: Optional[float] = None,
check: bool = True
) -> Tuple[str, str]:
"""Run an ADB command for a specific device."""
return await self._run_command(["-s", serial, *args], timeout, check... | Run an ADB command for a specific device. | _run_device_command | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def get_devices(self) -> List[Dict[str, str]]:
"""Get list of connected devices.
Returns:
List of device info dictionaries with 'serial' and 'status' keys
"""
stdout, _ = await self._run_command(["devices", "-l"])
devices = []
for line ... | Get list of connected devices.
Returns:
List of device info dictionaries with 'serial' and 'status' keys
| get_devices | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def connect(self, host: str, port: int = 5555) -> str:
"""Connect to a device over TCP/IP.
Args:
host: Device IP address
port: Device port
Returns:
Device serial number (host:port)
"""
serial = f"{host}:{port}"
... | Connect to a device over TCP/IP.
Args:
host: Device IP address
port: Device port
Returns:
Device serial number (host:port)
| connect | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def shell(self, serial: str, command: str, timeout: Optional[float] = None) -> str:
"""Run a shell command on the device.
Args:
serial: Device serial number
command: Shell command to run
timeout: Command timeout in seconds
Returns:
... | Run a shell command on the device.
Args:
serial: Device serial number
command: Shell command to run
timeout: Command timeout in seconds
Returns:
Command output
| shell | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def get_properties(self, serial: str) -> Dict[str, str]:
"""Get device properties.
Args:
serial: Device serial number
Returns:
Dictionary of device properties
"""
output = await self.shell(serial, "getprop")
pro... | Get device properties.
Args:
serial: Device serial number
Returns:
Dictionary of device properties
| get_properties | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def install_app(
self,
serial: str,
apk_path: str,
reinstall: bool = False,
grant_permissions: bool = True
) -> Tuple[str, str]:
"""Install an APK on the device.
Args:
serial: Device serial number
apk_path: Path to th... | Install an APK on the device.
Args:
serial: Device serial number
apk_path: Path to the APK file
reinstall: Whether to reinstall if app exists
grant_permissions: Whether to grant all permissions
Returns:
Tuple of (stdout, s... | install_app | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
async def pull_file(self, serial: str, device_path: str, local_path: str) -> Tuple[str, str]:
"""Pull a file from the device.
Args:
serial: Device serial number
device_path: Path on the device
local_path: Path on the local machine
Returns... | Pull a file from the device.
Args:
serial: Device serial number
device_path: Path on the device
local_path: Path on the local machine
Returns:
Tuple of (stdout, stderr)
| pull_file | python | droidrun/droidrun | droidrun/adb/wrapper.py | https://github.com/droidrun/droidrun/blob/master/droidrun/adb/wrapper.py | MIT |
def async_to_sync(func):
"""
Convert an async function to a sync function.
Args:
func: Async function to convert
Returns:
Callable: Synchronous version of the async function
"""
def wrapper(*args, **kwargs):
return asyncio.run(func(*args, **kwargs))
return wrapper |
Convert an async function to a sync function.
Args:
func: Async function to convert
Returns:
Callable: Synchronous version of the async function
| async_to_sync | python | droidrun/droidrun | droidrun/agent/utils/async_utils.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/async_utils.py | MIT |
async def add_ui_text_block(ui_state: str, chat_history: List[ChatMessage], copy = True) -> List[ChatMessage]:
"""Add UI elements to the chat history without modifying the original."""
if ui_state:
ui_block = TextBlock(text="\nCurrent Clickable UI elements from the device using the custom TopViewService... | Add UI elements to the chat history without modifying the original. | add_ui_text_block | python | droidrun/droidrun | droidrun/agent/utils/chat_utils.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/chat_utils.py | MIT |
def __init__(self, loop: AbstractEventLoop, locals: Dict[str, Any] = {}, globals: Dict[str, Any] = {}, tools = {}, use_same_scope: bool = True):
"""
Initialize the code executor.
Args:
locals: Local variables to use in the execution context
globals: Global variables to u... |
Initialize the code executor.
Args:
locals: Local variables to use in the execution context
globals: Global variables to use in the execution context
tools: List of tools available for execution
| __init__ | python | droidrun/droidrun | droidrun/agent/utils/executer.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/executer.py | MIT |
async def execute(self, ctx: Context, code: str) -> str:
"""
Execute Python code and capture output and return values.
Args:
code: Python code to execute
Returns:
str: Output from the execution, including print statements.
"""
# Update UI element... |
Execute Python code and capture output and return values.
Args:
code: Python code to execute
Returns:
str: Output from the execution, including print statements.
| execute | python | droidrun/droidrun | droidrun/agent/utils/executer.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/executer.py | MIT |
def load_llm(provider_name: str, **kwargs: Any) -> LLM:
"""
Dynamically loads and initializes a LlamaIndex LLM.
Imports `llama_index.llms.<provider_name_lower>`, finds the class named
`provider_name` within that module, verifies it's an LLM subclass,
and initializes it with kwargs.
Args:
... |
Dynamically loads and initializes a LlamaIndex LLM.
Imports `llama_index.llms.<provider_name_lower>`, finds the class named
`provider_name` within that module, verifies it's an LLM subclass,
and initializes it with kwargs.
Args:
provider_name: The case-sensitive name of the provider and t... | load_llm | python | droidrun/droidrun | droidrun/agent/utils/llm_picker.py | https://github.com/droidrun/droidrun/blob/master/droidrun/agent/utils/llm_picker.py | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.