# 🔐 Muragala Password Manager

Hello All 👋,

Today I wanted to quickly discuss the Muragala Application; more specifically the C# CLI Application and Python Application. Both of them have similar functionality, so what we discuss will apply to both of them.

The Python Application is written solely by itself, so I will refer to its perspective. As discussed in the previous article, the C# Application is written to interface with the C# library which handles the functionality. However, the structure is still the same. In the next article, I will discuss the library itself.

The first task the application has to do is to initialize itself. This is done by the `initialize()` function. In it, we have to perform two tasks:

1. Load the database to memory
2. Load the preferences (Key and Hash) to memory

Once these two tasks are done, we can allow the user to enter commands. The available commands are as follows:

1. `exit` - Exits the application
2. `help` - Shows the help content
3. `about` - Display the about information
4. `version` - Display the current version of the application
5. `copyright` - Displays the copyright details
6. `encrypt` - Encrypts a message with the user passcode
7. `decrypt` - Decrypts an encrypted message from the user passcode
8. `validate` - Check if the password is correct
9. `add` - Adds a new password to the database
10. `edit` - Edits an existing password in the database
11. `delete` - Deletes a password from the database
12. `show` - Displays the password for an existing profile
13. `copy` - Copies the password of an existing profile (Not available on C# CLI Application
14. `platforms` - Lists out all the platforms that exist in the database
15. `username` - Lists out all the usernames that exist under a provided platform name

When using the `help` command, you can provide the name of a command as the argument to get only the help information for that particular command.

`Add` and `edit` functions accept the arguments `-u`, `-n`, `-c`. These commands command the application to exclude Uppercase characters, numbers and special characters from the password when generating one. Before these, you can also provide a number which commands the application on how long the password must be (Character count). It is recommended not to exclude any characters and to have around 12 characters (Which is the default length). Without any of these commands, you can include a `-m` to enter a password manually. When `-m` is given, a prompt will ask you to enter a custom password instead of generating a password. Other than this, add doesn't accept any commands, however, the edit has to be entered in the form `edit <platform> <username>` to edit the <username> under the <platform>. In `add`, the application provides prompts to enter the new platform name and username.

`delete`, `show` and `copy` also has to be entered in the form `<command> <platform> <username>`. `delete` will delete the provided username from the platform after one more confirmation prompt. Therefore it is important to make sure that you're ok with losing this information. `show` and `copy` will output the password to the user.  `show` will display it while `copy` will copy it to the clipboard without displaying. Make sure that the *pyperclip* library is installed in the device, otherwise, on Python, you will see an error. C# CLI doesn't support the `copy` command as C# doesn't allow CLI applications to access the clipboard as far as I'm aware. I'm open to any ideas on how to achieve this if anyone knows. Therefore for now we don't have any way to directly copy the password to the clipboard on the C# CLI Application.

`platform` command can be used as `platform <keyword> <rows>`. Both arguments are optional. <keyword> will scan the platforms for the provided keyword. If not provided, all platforms will be shown. <rows> will only display that many rows from the results. `username` is similar, however, after the keyword, <platform> can be provided to only scan for the <keyword> within username only under the provided <platform>. <keyword> can also be replaced by the `-a` command to scan all of the usernames. This gives the username command the form: `username <keyword/'-a'> <platform> <rows>` where all the arguments are optional.

Cheers 🎉

External Links

- [Muragala Python Project](https://github.com/asankaSovis/password-manager-Python)
- [Muragala C# Project](https://github.com/asankaSovis/password-manager-CSharpLibrary)
