- Encryption: The passwords are encrypted using the cryptography.Fernet symmetric encryption system. A key is generated and saved in a file (secret.key). This key is required for both encryption and decryption.
- Password Generation: You can generate random passwords using the generate_password function.
- Storing Passwords: When a password is generated or entered by the user, it's encrypted and stored in a CSV file (passwords.csv).
- Viewing Passwords: Stored passwords are decrypted before being shown to the user.
- File Security: Passwords are saved in a CSV file, and the contents are encrypted to ensure that even if the file is accessed, the passwords remain secure.
- Storing: When a password is stored, it is encrypted before being written to the CSV.
- Loading: When the stored passwords are viewed, they are decrypted using the saved encryption key.
Password Manager
1. Generate a new password
2. Store a password
3. View stored passwords
4. Exit
Choose an option (1-4): 1
Generated Password: quick-4-flame-@dog-9-jumped
Password Manager
1. Generate a new password
2. Store a password
3. View stored passwords
4. Exit
Choose an option (1-4): 2
Enter the service name (e.g., 'Google'): Google
Enter the password to store (or leave empty to generate one):
Password for Google stored successfully.
Password Manager
1. Generate a new password
2. Store a password
3. View stored passwords
4. Exit
Choose an option (1-4): 3
Stored Passwords:
Service: Google - Password: quick-4-flame-@dog-9-jumped
This is a Python-based SSH Manager that allows users to store, update, remove, and test SSH credentials securely. The credentials (including private/public SSH keys, usernames, and passwords) are encrypted using the cryptography library for security. This script also supports generating new SSH key pairs and uploading public keys to remote servers.
- Store SSH credentials: Save SSH username, password, private key, and public key securely in a CSV file.
- Update SSH credentials: Update an existing SSH entry based on the service name.
- Remove SSH credentials: Remove a specific entry from the stored SSH credentials.
- Test SSH connection: Connect to remote servers using stored SSH credentials and test the connection.
- Generate SSH keys: Generate a new RSA SSH key pair (private and public).
- Upload public key: Upload the generated or existing public key to a server's authorized_keys.
- Encrypt and decrypt data: SSH credentials are encrypted using a key generated by the cryptography library.
- Python 3.x
cryptographylibraryparamikolibrary- To install the required dependencies, run the following command:
pip install cryptography paramiko
-
Store SSH credentials
- Select option 1 to store SSH credentials.
- You will be prompted to enter:
- Service name (e.g., MyServer)
- SSH username
- SSH password (leave empty if using a private key)
- SSH private key (optional, if you wish to use an existing key)
- SSH public key (optional, if you use an existing key)
- Hostname (e.g., example.com)
The credentials will be stored securely in a CSV file (ssh_credentials.csv), with passwords and keys encrypted.
-
View stored SSH credentials
- Select option 2 to view the stored SSH credentials.
- The credentials are decrypted and displayed in the terminal.
-
Test SSH connection
- Select option 3 to test a connection to a server using stored SSH credentials.
- You can connect using either the SSH username/password or a private key if available.
-
List public key
- Select option 4 to list the public key of a specific service.
- You will be prompted to enter the service name, and the public key will be displayed.
-
Upload SSH public key to server
- Select option 5 to upload the SSH public key to a server's authorized_keys file.
- You will be prompted to enter the service name, and the script will upload the key to the specified server and test the connection.
-
Update SSH credentials
- Select option 7 to update existing SSH credentials.
- You will be prompted to enter the new credentials (username, password, private key, public key, hostname).
- The credentials will be updated in the CSV file.
-
Exit
- Select option 8 to exit the program.
generate_key()- Generates a new encryption key used to encrypt and decrypt the SSH credentials.
save_key(key, filename="ssh_secret.key")- Saves the generated encryption key to a file for later use.
load_key(filename="ssh_secret.key")- Loads the encryption key from a file.
encrypt_message(message, key)- Encrypts a given message (e.g., SSH username, password, or key) using the encryption key.
decrypt_message(encrypted_message, key)- Decrypts a given encrypted message using the encryption key.
store_ssh_credentials(username, password, private_key, public_key, hostname, service_name, key)- Stores the provided SSH credentials (username, password, private key, public key, and hostname) into a CSV file, with encryption applied to sensitive information.
load_ssh_credentials(key, filename="ssh_credentials.csv")- Loads SSH credentials from the CSV file and decrypts the information using the provided encryption key.
update_creds(username, password, private_key, public_key, hostname, service_name, key, filename="ssh_credentials.csv")- Updates the stored SSH credentials for a specific service, replacing the old credentials with new ones.
remove_ssh_credentials(service_name, key, filename="ssh_credentials.csv")- Removes the SSH credentials for a specific service from the CSV file.
connect_ssh(username, password=None, private_key=None, hostname='localhost', port=22)- Establishes an SSH connection to a server using either username/password or private key authentication.generate_ssh_key_pair(service_name)- Generates a new RSA key pair (private and public keys) and saves them to disk.upload_ssh_key_to_server(hostname, username, password, private_key, service_name)- Uploads the public SSH key to the specified server's authorized_keys file, allowing SSH access without a password.
- The script assumes that the ~/.ssh/authorized_keys file on the remote server is writable.
- It is crucial to protect the ssh_secret.key file as it is used for encryption and decryption.
- Always ensure the private key files are securely stored and protected.
This project is open source and licensed under the MIT License.