Skip to content

Commit e6d0f61

Browse files
committed
add createPassword.py + details
1 parent 537132d commit e6d0f61

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ So far, the following projects have been integrated to this repo:
4343
|[Port Scanner](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Port_Scanner)|[Plutoberth](https://github.com/Plutoberth)|
4444
|[Python Algebra Solver](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Algebra-Solver)|[Sengxay Xayachack](https://github.com/frankxayachack)|
4545
|[Random name generator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Random_Names_Generator)| [Ayush Bhardwaj](https://github.com/hastagAB)|
46+
|[Random Password Generators](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Random_Password_Generator)| [Hafpaf](https://github.com/hafpaf) and [Renderer-RCT2](https://github.com/Renderer-RCT2)|
4647
|[Server Ping](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Ping_Server)|[prince]()|
4748
|[Signature photo to PNG converter](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/signature2png)|[Rodolfo Ferro](https://github.com/RodolfoFerro)|
4849
|[Simple Webpage Parser](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/SimpleWebpageParser)|[Nitish Srivastava](https://github.com/nitish-iiitd)|

Random_Password_Generator/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
# Random Password Generator
1+
# Programs
2+
## [PasswordGenerator.py](./PasswordGenerator.py)
23
This program randomly generates a secure password using a mix of letters, both caps on and off, numbers, and punctuation, then outputs the results and saves them as a text document.
34

4-
# Requirements
5+
## [createPassword.py](./createPassword.py)
6+
This program uses the Python 3 module `secrets` to create a pseudo random password with alphanumeric, numbers, and special characters. The output will be printed into the terminal.
57

6-
Python 3 and higher or Python 2 and higher
8+
# Requirements
9+
* [PasswordGenerator.py](./PasswordGenerator.py) can use Python 3 and higher or Python 2 and higher
10+
* [createPassword.py](./createPassword.py) can run on python 3.6 or higher or for Python 2 do:
11+
* `cd Random_Password_Generator/` to change directory into this folder.
12+
* Create virtual environment with `virtualvenv env`
13+
* do `source venv/bin/activate` to activate virtual environment.
14+
* do `pip install -r requirements.txt` to install python2-secrets
15+
* **TIP**: to deactivate virtual environment, do `deactivate`.
716

817
# Usage
918

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/python
2+
# -*- coding: utf-8 -*-
3+
4+
# <Summary>Create a pseudo random password with alphanumeric, numbers, and special characters</summary>
5+
6+
import secrets #implemented in python version 3.6+
7+
8+
#String of characters
9+
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=_+`~[]{]\|;:,<.>/?'
10+
11+
#2 for loops should be O(n²) runtime
12+
def create(number_of_passwords, pass_length):
13+
for i in range(number_of_passwords):
14+
list = [] # create new empty list
15+
for i in range(pass_length):
16+
select = secrets.choice(chars) #the secret sauce to select a pseudo random character
17+
list.append(select) #add pseudo random char to list
18+
l = ''.join(list) #concatenate list to string for every ''
19+
print(l) #<-- comment me out for faster computing
20+
return l
21+
22+
#Run function
23+
create(int(5),int(20)) #number_of_passwords, pass_length
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python2-secrets>=1.0.5

0 commit comments

Comments
 (0)