mongopasswordmanager 1.0.7
A simple password manager

# Python MongoDB Password Manager

## Introduction

Python MongoDB Password Manager is a secure and convenient tool for storing and managing your passwords using MongoDB, a popular NoSQL database. With this password manager, you can securely store your passwords and retrieve them whenever needed, all within a user-friendly command-line interface.

## Features

- Generate strong, random passwords and automatically save to db and copy to clipboard
- Strong encryption to protect your passwords
- Securely store and manage your passwords
- User-friendly command-line interface
- Create, view, update, and delete password entries
- Automatically Copy passwords to the clipboard for easy use
- Search for passwords by account name or username

## Prerequisites

Before running this password manager, please ensure that the following requirements are met:

- Python 3.x is installed on your system.
- MongoDB is installed and running.

## Installation

To Install this tool run :

```bash
  git clone git@github.com:Praveenms13/PyMongo-PasswordManager.git
```

Navigate to the project directory:

```
cd Password_Manager/
```

install the required packages

```
pip install pymongo
pip install json
pip install sys
pip install os
pip install secrets
pip install string
pip install subprocess
sudo apt-get install xclip
```

## Environment Variables

To run this project, you will need to add the following environment variables to your `config.json` file.

If you want to connect the mongoDb with url, try this:

`mongoConnectionUrl: <connection url, eg. mongodb+srv://<user-name>:<user-password>@cluster0.ylmuuht.mongodb.net/>`

or with Crediantials, try this:

- `mongoUsername` : `praveenMongo`,
- `mongoPassword` : `nd6eG7Wda4T3rkS1`,
- `clusterHost` : `ac-zjjljvo-shard-00-02.ylmuuht.mongodb.net`,
- `databaseName` : `PassWordManager`

Place the config.json file in the root directory

```
PyMongo-PasswordManager
├── passManager.py
├── config.json
├── README.md
└── .gitignore

```

after adding the env variables, call the contents from `config.json` file from `passManager` python file

`config.json` Looks like

```
{
    "mongoConnectionUrl": "localhost:27017",

    "mongoUsername": "praveen",
    "mongoPassword": "krvhrfvr",
    "clusterHost": "ac-skhfwjfb-shard-00-02.ylmuuht.mongodb.net",
    "databaseName": "PassWordManager"
}
```

calling json variables from the main python file `passmanager` looks like
replace `/home/praveen/Desktop/PyMongo-PasswordManager/config.json` to `<your_access_path>` in `passManager` python file

```
def get_json_data():
    with open("/home/praveen/Desktop/Backup-Win-/developer/WebD/Developer/linuxTools/PyMongo-PasswordManager/config1.json", "r") as f:
        data = json.load(f)
    return data
```

## Add Your public ip in mongodb dashboard
click "add ip address" on top right corner in the below dashboard and add you public ip address. You can obtain your public ip from https://whatismyipaddress.com/

![Alt text](images/mongoip.png)

## After setting up all

Make the tool as the executable

```
$ pwd
/home/praveen/Desktop/PyMongo-PasswordManager/
```

copy the above directory, then paste the below code in `~/.bashrc` file to make executable

```
export PATH=$PATH:/home/praveen/Desktop/PyMongo-PasswordManager/
```

## Hurrah!! Setup Completed.

Now run the tool as below with start point
`$ passManager`


## Tool Usage

To run the basic operations:

```
❯ passManager
Establishing a new connection...
Connection successful.
Available Databases: ['PassWordManager', 'admin', 'local']
What do you want to do?
1. Add new credentials,
2. Get credentials with only platform,
3. Get credentials with platform and username,
4. Delete credentials,
5. Update credentials,
6. Exit

Enter your choice:
```

Order of Execution:

```
-gp=<condition> -l=<num> -s -cp
```

```
- To Generate a New Password--generatepassword or -gp = alphanumeric|alphabets|numeric|symbols
- To give lenght of a password --length or -l = count
- To Save it in database --save or -s
- To Automatically Copy the Password to Clipboard --copy or -cp
```

## Sample commands:

To generate and not save passwords in mongodb

```
with condition(alphanumeric, alphabets, aphanumsym, numeric, symbols):
$ passManager -gp=alphanumeric -l=10 -cp
Establishing a new connection...
Connection successful.
Generating Password without save option
Password Type:  alphanumeric
Generated Password:  8Ezzf41JB3
Password copied to clipboard successfully!
-------------------------------------------------------------------------
without condition(default=alpha+numeric+symbols):
$ passManager -gp -l=10 -cp
Establishing a new connection...
Connection successful.
Generating Password without save option
Password Type:  None
Generated Password:  ~a%,@z}*g!
Password copied to clipboard successfully!
-------------------------------------------------------------------------
with length(default=13):
$ passManager -gp=alphanumeric -l=10 -cp
Establishing a new connection...
Connection successful.
Generating Password without save option
Password Type:  alphanumeric
Generated Password:  330IOpH0j5
Password copied to clipboard successfully!
-------------------------------------------------------------------------
without length:
$ passManager -gp=alphanumeric
Establishing a new connection...
Connection successful.
Generating Password without save option
Password Type:  alphanumeric
Generated Password:  kkoXQWSRdKaNW
-------------------------------------------------------------------------
with save:
$ passManager -gp=alphanumeric -l=10 -s -cp
Establishing a new connection...
Connection successful.
To Save Password the password you should give the platform, username, and comment
Do you want to continue? (y/n): y
Generating Password with save option
Password Type:  alphanumeric
Generated Password:  6PShvcvjeO

Add new credentials..
Enter the platform name: instagram
Enter Comment: praveen instagram account
Enter the username of the account: praveen_test
Generated Password:  6PShvcvjeO

Data to be added:
Platform: instagram
Comment: praveen instagram account
Username: praveen_test
Password: 6PShvcvjeO
Data added successfully.
Password copied to clipboard successfully!
-------------------------------------------------------------------------
without save:
$ passManager -gp=alphanumeric -l=10 -cp
Establishing a new connection...
Connection successful.
Generating Password without save option
Password Type:  alphanumeric
Generated Password:  2kbX22BxyT
Copying Password...
Password copied to clipboard successfully!
-------------------------------------------------------------------------
with copy:
$ passManager -gp=alphanumeric -l=10 -cp
Establishing a new connection...
Connection successful.
Generating Password without save option
Password Type:  alphanumeric
Generated Password:  VcSMcFDfLC
Copying Password...
Password copied to clipboard successfully!
-------------------------------------------------------------------------
without copy:
$ passManager -gp=alphanumeric -l=10
Establishing a new connection...
Connection successful.
Generating Password without save option
Password Type:  alphanumeric
Generated Password:  aPdqJMeuQ8
-------------------------------------------------------------------------
```