Skip to content

Commit

Permalink
Merge pull request #4 from Leovalcante/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Leovalcante authored Apr 5, 2019
2 parents 431195b + 68f962f commit 130c983
Show file tree
Hide file tree
Showing 9 changed files with 320 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
venv/
build/
dist/
*.egg-info
*.egg-info
*__pycache__*
84 changes: 60 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Random Password Generator
#### *rpg v1.0.0*
#### *rpg v0.0.1*

## What is rpg?
**Rpg** stands for **R**andom **P**assword **G**enerator, it's a utility command line tool that allows you to generate random entropic password.

## Requirements
- Python 3+

## Installation
1. `git clone https://github.com/Leovalcante/random-password-generator`
2. `cd random-password-generator`
3. `./run_install.sh`
1. `pip install random-password-genrator-cli`


## Advice
1. Use rpg to generate random entropic password
2. Check if your password has already been leaked here: [haveibeenpwned](https://haveibeenpwned.com/Passwords)
3. Avoid to use a short password, try to use only passwords with 16+ characters.
4. Do not share your passwords with any one.
5. Do not reuse a password.


## Usage
Expand All @@ -22,40 +26,72 @@ In our opinion you should never use a password lower then 16 characters.

`[OPTIONS]` are:

- `--help`: to print help text
- `--version`: to print out rpg version
- `-n <int>`: with this option you can generate *n* password
- `-n, --number <pass-number>`: generate `<pass-number>` passwords
- `-o, --output <out-file>`: write generated passwords into `<out-file>`
- `-nL, --no-lower`: remove lower-case charsets
- `-nU, --no-upper`: remove upper-case charsets
- `-nD, --no-digits`: remove digits charsets
- `-nP, --no-punctuation`: remove punctuation charsets
- `-v, --verbose`: print verbose output
- `-V, --version`: print rpg version
- `-h, --help`: print help text

## Examples
Generate a 16 character password:
```
$ rpg 16
Passwords:
6=L!Sda7~7xU5V@m
5;K6]V%h]ewW8N5i
The entropy of generated password is: 104.8734216268422
```

Generate a 20 character password
Generate a 20 character password without lower-case charsets
```
$ rpg 20
:6#T^ioVY9"RaQ7x3i7{
Passwords:
.T(89$!OPT4C{1088LS=
The entropy of generated password is: 121.7492568250068
```

Generate five 20 character passwords
Generate five 20 character passwords without punctuation charsets
```
$ rpg -n 5 20
xb|b8$_03`yZ69T"wRHS
^~|78IRyH]L3jq3fR'h0
w9V>2vd2!%O53|sCy?GM
>01^7%zZx8X*lHb+sEV3
74"2Vd17Z@hNUy__Pt/u
Passwords:
zW9z4974ciLgkP9hT3CC
grX01Bd6MkQj01Y72dOa
XtPmY88o2X87QaaA54bL
dxhk9EYu7IJ4uS2d6Q66
3Wr04RnOlV4h4c5Fvo6D
The entropy of generated password is: 119.08392620773752
```

Generate five 12 character passwords and save them into pw-out.txt
```
$ rpg -n 5 -o pw-out.txt 12
Passwords:
.HHc'd2sK2\7
Y5=3"da`W9aB
60U">By<Z7db
j9N4W5Tvu;'@
8F,l<Oej6$M6
## Advice
1. Do not reuse a password.
2. Avoid use of short password, try to use only 16+ character passwords.
3. Do not share your passwords with any one.
4. Check if your password has already been leaked here: [haveibeenpwned](https://haveibeenpwned.com/Passwords)
5. Use rpg to generate random entropic password
The entropy of generated password is: 78.65506622013166
```
*pw-out.txt*
```
$ cat pw-out.txt
Passwords:
.HHc'd2sK2\7
Y5=3"da`W9aB
60U">By<Z7db
j9N4W5Tvu;'@
8F,l<Oej6$M6
Entropy: 78.65506622013166
```
6 changes: 3 additions & 3 deletions random_password_generator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__name__ = "random-password-generator"
__name__ = "random-password-generator-cli"
__name_desc__ = "Random Password Generator"
__version__ = "1.0.0"
__description__ = "Utility command line tool to generate random entropic password"
__version__ = "0.0.1"
__description__ = "Command line tool utility to generate random entropic password"
__url__ = "https://github.com/Leovalcante/random-password-generator"
Binary file not shown.
Empty file.
113 changes: 113 additions & 0 deletions random_password_generator/messages/messages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import click


class Prints:
"""Prints class PRINTS messages in various format"""
@staticmethod
def emphasis(msg: str) -> None:
"""
Print emphasis messages.
:param str msg: message to print
:return: None
"""
click.echo(click.style(msg, fg="cyan"))

@staticmethod
def error(msg: str) -> None:
"""
Print error messages.
:param str msg: message to print
:return: None
"""
click.echo(click.style(msg, fg="red"))

@staticmethod
def info(msg: str) -> None:
"""
Print standard messages.
:param str msg: message to print
:return: None
"""
click.echo(msg)

@staticmethod
def verbose(msg: str, vrb: bool) -> None:
"""
Print verbose messages if verbose is enabled.
:param str msg: message to print
:param bool vrb: verbose value
:return: None
"""
if vrb:
click.echo(click.style(msg, fg="magenta"))

@staticmethod
def warning(msg: str) -> None:
"""
Print warning messages.
:param str msg: message to print
:return: None
"""
click.echo(click.style(msg, fg="bright_yellow", bold=True))


class Echoes:
"""Echoes class RETURNS messages in various format"""
@staticmethod
def emphasis(msg: str) -> str:
"""
Print emphasis messages.
:param str msg: message to print
:return str: colored msg
"""
return click.style(msg, fg="cyan")

@staticmethod
def error(msg: str) -> str:
"""
Print error messages.
:param str msg: message to print
:return str: colored message
"""
return click.style(msg, fg="red")

@staticmethod
def info(msg: str) -> str:
"""
Print standard messages.
:param str msg: message to print
:return str: colored message
"""
return msg

@staticmethod
def verbose(msg: str, vrb: bool) -> str:
"""
Print verbose messages if verbose is enabled.
:param str msg: message to print
:param bool vrb: verbose value
:return str: colored message
"""
if vrb:
return click.style(msg, fg="magenta")

return ""

@staticmethod
def warning(msg: str) -> str:
"""
Print warning messages.
:param str msg: message to print
:return: None
"""
return click.style(msg, fg="bright_yellow", bold=True)
Loading

0 comments on commit 130c983

Please sign in to comment.