Skip to content

Commit 130c983

Browse files
authored
Merge pull request #4 from Leovalcante/develop
Develop
2 parents 431195b + 68f962f commit 130c983

File tree

9 files changed

+320
-56
lines changed

9 files changed

+320
-56
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
venv/
33
build/
44
dist/
5-
*.egg-info
5+
*.egg-info
6+
*__pycache__*

README.md

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# Random Password Generator
2-
#### *rpg v1.0.0*
2+
#### *rpg v0.0.1*
33

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

7-
## Requirements
8-
- Python 3+
97

108
## Installation
11-
1. `git clone https://github.com/Leovalcante/random-password-generator`
12-
2. `cd random-password-generator`
13-
3. `./run_install.sh`
9+
1. `pip install random-password-genrator-cli`
10+
11+
12+
## Advice
13+
1. Use rpg to generate random entropic password
14+
2. Check if your password has already been leaked here: [haveibeenpwned](https://haveibeenpwned.com/Passwords)
15+
3. Avoid to use a short password, try to use only passwords with 16+ characters.
16+
4. Do not share your passwords with any one.
17+
5. Do not reuse a password.
1418

1519

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

2327
`[OPTIONS]` are:
2428

25-
- `--help`: to print help text
26-
- `--version`: to print out rpg version
27-
- `-n <int>`: with this option you can generate *n* password
29+
- `-n, --number <pass-number>`: generate `<pass-number>` passwords
30+
- `-o, --output <out-file>`: write generated passwords into `<out-file>`
31+
- `-nL, --no-lower`: remove lower-case charsets
32+
- `-nU, --no-upper`: remove upper-case charsets
33+
- `-nD, --no-digits`: remove digits charsets
34+
- `-nP, --no-punctuation`: remove punctuation charsets
35+
- `-v, --verbose`: print verbose output
36+
- `-V, --version`: print rpg version
37+
- `-h, --help`: print help text
2838

2939
## Examples
3040
Generate a 16 character password:
3141
```
3242
$ rpg 16
43+
Passwords:
44+
6=L!Sda7~7xU5V@m
3345
34-
5;K6]V%h]ewW8N5i
46+
The entropy of generated password is: 104.8734216268422
3547
```
3648

37-
Generate a 20 character password
49+
Generate a 20 character password without lower-case charsets
3850
```
3951
$ rpg 20
4052
41-
:6#T^ioVY9"RaQ7x3i7{
53+
Passwords:
54+
.T(89$!OPT4C{1088LS=
55+
56+
The entropy of generated password is: 121.7492568250068
57+
4258
```
4359

44-
Generate five 20 character passwords
60+
Generate five 20 character passwords without punctuation charsets
4561
```
4662
$ rpg -n 5 20
4763
48-
xb|b8$_03`yZ69T"wRHS
49-
^~|78IRyH]L3jq3fR'h0
50-
w9V>2vd2!%O53|sCy?GM
51-
>01^7%zZx8X*lHb+sEV3
52-
74"2Vd17Z@hNUy__Pt/u
64+
Passwords:
65+
zW9z4974ciLgkP9hT3CC
66+
grX01Bd6MkQj01Y72dOa
67+
XtPmY88o2X87QaaA54bL
68+
dxhk9EYu7IJ4uS2d6Q66
69+
3Wr04RnOlV4h4c5Fvo6D
70+
71+
The entropy of generated password is: 119.08392620773752
5372
```
5473

74+
Generate five 12 character passwords and save them into pw-out.txt
75+
```
76+
$ rpg -n 5 -o pw-out.txt 12
77+
Passwords:
78+
.HHc'd2sK2\7
79+
Y5=3"da`W9aB
80+
60U">By<Z7db
81+
j9N4W5Tvu;'@
82+
8F,l<Oej6$M6
5583
56-
## Advice
57-
1. Do not reuse a password.
58-
2. Avoid use of short password, try to use only 16+ character passwords.
59-
3. Do not share your passwords with any one.
60-
4. Check if your password has already been leaked here: [haveibeenpwned](https://haveibeenpwned.com/Passwords)
61-
5. Use rpg to generate random entropic password
84+
The entropy of generated password is: 78.65506622013166
85+
86+
```
87+
*pw-out.txt*
88+
```
89+
$ cat pw-out.txt
90+
Passwords:
91+
.HHc'd2sK2\7
92+
Y5=3"da`W9aB
93+
60U">By<Z7db
94+
j9N4W5Tvu;'@
95+
8F,l<Oej6$M6
96+
Entropy: 78.65506622013166
97+
```
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
__name__ = "random-password-generator"
1+
__name__ = "random-password-generator-cli"
22
__name_desc__ = "Random Password Generator"
3-
__version__ = "1.0.0"
4-
__description__ = "Utility command line tool to generate random entropic password"
3+
__version__ = "0.0.1"
4+
__description__ = "Command line tool utility to generate random entropic password"
55
__url__ = "https://github.com/Leovalcante/random-password-generator"
-454 Bytes
Binary file not shown.

random_password_generator/messages/__init__.py

Whitespace-only changes.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import click
2+
3+
4+
class Prints:
5+
"""Prints class PRINTS messages in various format"""
6+
@staticmethod
7+
def emphasis(msg: str) -> None:
8+
"""
9+
Print emphasis messages.
10+
11+
:param str msg: message to print
12+
:return: None
13+
"""
14+
click.echo(click.style(msg, fg="cyan"))
15+
16+
@staticmethod
17+
def error(msg: str) -> None:
18+
"""
19+
Print error messages.
20+
21+
:param str msg: message to print
22+
:return: None
23+
"""
24+
click.echo(click.style(msg, fg="red"))
25+
26+
@staticmethod
27+
def info(msg: str) -> None:
28+
"""
29+
Print standard messages.
30+
31+
:param str msg: message to print
32+
:return: None
33+
"""
34+
click.echo(msg)
35+
36+
@staticmethod
37+
def verbose(msg: str, vrb: bool) -> None:
38+
"""
39+
Print verbose messages if verbose is enabled.
40+
41+
:param str msg: message to print
42+
:param bool vrb: verbose value
43+
:return: None
44+
"""
45+
if vrb:
46+
click.echo(click.style(msg, fg="magenta"))
47+
48+
@staticmethod
49+
def warning(msg: str) -> None:
50+
"""
51+
Print warning messages.
52+
53+
:param str msg: message to print
54+
:return: None
55+
"""
56+
click.echo(click.style(msg, fg="bright_yellow", bold=True))
57+
58+
59+
class Echoes:
60+
"""Echoes class RETURNS messages in various format"""
61+
@staticmethod
62+
def emphasis(msg: str) -> str:
63+
"""
64+
Print emphasis messages.
65+
66+
:param str msg: message to print
67+
:return str: colored msg
68+
"""
69+
return click.style(msg, fg="cyan")
70+
71+
@staticmethod
72+
def error(msg: str) -> str:
73+
"""
74+
Print error messages.
75+
76+
:param str msg: message to print
77+
:return str: colored message
78+
"""
79+
return click.style(msg, fg="red")
80+
81+
@staticmethod
82+
def info(msg: str) -> str:
83+
"""
84+
Print standard messages.
85+
86+
:param str msg: message to print
87+
:return str: colored message
88+
"""
89+
return msg
90+
91+
@staticmethod
92+
def verbose(msg: str, vrb: bool) -> str:
93+
"""
94+
Print verbose messages if verbose is enabled.
95+
96+
:param str msg: message to print
97+
:param bool vrb: verbose value
98+
:return str: colored message
99+
"""
100+
if vrb:
101+
return click.style(msg, fg="magenta")
102+
103+
return ""
104+
105+
@staticmethod
106+
def warning(msg: str) -> str:
107+
"""
108+
Print warning messages.
109+
110+
:param str msg: message to print
111+
:return: None
112+
"""
113+
return click.style(msg, fg="bright_yellow", bold=True)

0 commit comments

Comments
 (0)