persistent_ssh_agent.cli module

Command-line interface for persistent-ssh-agent.

class persistent_ssh_agent.cli.Args(**kwargs)[源代码]

基类:object

Simple class to mimic argparse namespace for compatibility with existing functions.

class persistent_ssh_agent.cli.ConfigManager[源代码]

基类:object

Manages persistent configuration for SSH agent.

add_key(name: str, identity_file: str) bool[源代码]

Add a named SSH key.

参数:
  • name -- Name of the key

  • identity_file -- Path to SSH identity file

返回:

True if successful

返回类型:

bool

clear_config() bool[源代码]

Clear all configuration.

返回:

True if successful

返回类型:

bool

deobfuscate_passphrase(encrypted_data: str) str[源代码]

Decrypt passphrase.

参数:

encrypted_data -- Encrypted passphrase

返回:

Plain text passphrase

返回类型:

str

export_config(include_sensitive: bool = False) Dict[源代码]

Export configuration.

参数:

include_sensitive -- Whether to include sensitive information

返回:

Exported configuration

返回类型:

Dict

get_expiration_time() int | None[源代码]

Get stored expiration time.

返回:

Expiration time in seconds or None

返回类型:

Optional[int]

get_identity_file() str | None[源代码]

Get stored identity file path.

返回:

Stored identity file path or None

返回类型:

Optional[str]

get_passphrase() str | None[源代码]

Get stored passphrase.

返回:

Stored passphrase or None

返回类型:

Optional[str]

get_reuse_agent() bool | None[源代码]

Get stored reuse agent setting.

返回:

Reuse agent setting or None

返回类型:

Optional[bool]

import_config(config_data: Dict) bool[源代码]

Import configuration.

参数:

config_data -- Configuration data to import

返回:

True if successful

返回类型:

bool

list_keys() Dict[源代码]

List all configured SSH keys.

返回:

Dictionary of configured keys

返回类型:

Dict

load_config() Dict[源代码]

Load configuration from file.

返回:

Configuration dictionary

返回类型:

Dict

remove_key(name: str) bool[源代码]

Remove a named SSH key.

参数:

name -- Name of the key

返回:

True if successful

返回类型:

bool

save_config(config: Dict) bool[源代码]

Save configuration to file.

参数:

config -- Configuration dictionary

返回:

True if successful

返回类型:

bool

static secure_delete_from_memory(data: str | bytes | bytearray) None[源代码]

Securely delete sensitive data from memory.

参数:

data -- Data to delete

set_expiration_time(hours: int) bool[源代码]

Set and store expiration time.

参数:

hours -- Expiration time in hours

返回:

True if successful

返回类型:

bool

set_identity_file(identity_file: str) bool[源代码]

Set and store identity file path.

参数:

identity_file -- Path to SSH identity file

返回:

True if successful

返回类型:

bool

set_passphrase(passphrase: str) bool[源代码]

Set and store passphrase.

参数:

passphrase -- SSH key passphrase

返回:

True if successful

返回类型:

bool

set_reuse_agent(reuse: bool) bool[源代码]

Set and store reuse agent setting.

参数:

reuse -- Whether to reuse existing SSH agent

返回:

True if successful

返回类型:

bool

persistent_ssh_agent.cli.add_key(args)[源代码]

Add a configured SSH key.

参数:

args -- Command line arguments

persistent_ssh_agent.cli.export_config(args)[源代码]

Export configuration.

参数:

args -- Command line arguments

persistent_ssh_agent.cli.import_config(args)[源代码]

Import configuration.

参数:

args -- Command line arguments

persistent_ssh_agent.cli.list_keys(_)[源代码]

List all configured SSH keys.

参数:

_ -- Command line arguments (unused)

persistent_ssh_agent.cli.remove_key(args)[源代码]

Remove a configured SSH key.

参数:

args -- Command line arguments

persistent_ssh_agent.cli.run_ssh_connection_test(args)[源代码]

Test SSH connection.

参数:

args -- Command line arguments

persistent_ssh_agent.cli.setup_config(args)[源代码]

Set up configuration.

参数:

args -- Command line arguments