diff --git a/README.md b/README.md index e9ed08d..becb6b6 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ So far, the following projects have been integrated to this repo: |[Port Scanner](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Port_Scanner)|[Plutoberth](https://github.com/Plutoberth)| |[Python Algebra Solver](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Algebra-Solver)|[Sengxay Xayachack](https://github.com/frankxayachack)| |[Random name generator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Random_Names_Generator)| [Ayush Bhardwaj](https://github.com/hastagAB)| +|[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)| |[Server Ping](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Ping_Server)|[prince]()| |[Signature photo to PNG converter](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/signature2png)|[Rodolfo Ferro](https://github.com/RodolfoFerro)| |[Simple Webpage Parser](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/SimpleWebpageParser)|[Nitish Srivastava](https://github.com/nitish-iiitd)| diff --git a/Random_Password_Generator/README.md b/Random_Password_Generator/README.md index 587dcb2..357f76f 100644 --- a/Random_Password_Generator/README.md +++ b/Random_Password_Generator/README.md @@ -1,9 +1,18 @@ -# Random Password Generator +# Programs +## [PasswordGenerator.py](./PasswordGenerator.py) 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. -# Requirements +## [createPassword.py](./createPassword.py) +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. -Python 3 and higher or Python 2 and higher +# Requirements +* [PasswordGenerator.py](./PasswordGenerator.py) can use Python 3 and higher or Python 2 and higher +* [createPassword.py](./createPassword.py) can run on python 3.6 or higher or for Python 2 do: + * `cd Random_Password_Generator/` to change directory into this folder. + * Create virtual environment with `virtualvenv env` + * do `source venv/bin/activate` to activate virtual environment. + * do `pip install -r requirements.txt` to install python2-secrets + * **TIP**: to deactivate virtual environment, do `deactivate`. # Usage diff --git a/Random_Password_Generator/createPassword.py b/Random_Password_Generator/createPassword.py new file mode 100644 index 0000000..8fe1b7e --- /dev/null +++ b/Random_Password_Generator/createPassword.py @@ -0,0 +1,23 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Create a pseudo random password with alphanumeric, numbers, and special characters + +import secrets #implemented in python version 3.6+ + +#String of characters +chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=_+`~[]{]\|;:,<.>/?' + +#2 for loops should be O(n²) runtime +def create(number_of_passwords, pass_length): + for i in range(number_of_passwords): + list = [] # create new empty list + for i in range(pass_length): + select = secrets.choice(chars) #the secret sauce to select a pseudo random character + list.append(select) #add pseudo random char to list + l = ''.join(list) #concatenate list to string for every '' + print(l) #<-- comment me out for faster computing + return l + +#Run function +create(int(5),int(20)) #number_of_passwords, pass_length \ No newline at end of file diff --git a/Random_Password_Generator/requirements.txt b/Random_Password_Generator/requirements.txt new file mode 100644 index 0000000..e68f006 --- /dev/null +++ b/Random_Password_Generator/requirements.txt @@ -0,0 +1 @@ +python2-secrets>=1.0.5