Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Description
- tictactoe <br />
A cli-based tictactoe game to play with the computer. <br/>
[Rounak Vyas](http://www.github.com/itsron717)

- passwordgen <br />
Generates a random password with minimun 8 digits. <br/>
[Akash Ramjyothi](https://github.com/Akash-Ramjyothi)
5 changes: 5 additions & 0 deletions scripts/passwordgen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Password Generator
Generates a random password with minimun of 8 digits.

## Usage
`python main.py`
33 changes: 33 additions & 0 deletions scripts/passwordgen/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import random, string, sys

# List of characters, alphabets, numbers
# to choose from
data_set = list(string.ascii_letters) + list(string.digits) + list(string.punctuation)

# generates a random password
# very strong due to random ness
# primary protection against dictionary attack on hash tables

def generate_random_password(n):
# For password to be strong it should
# be at least 8 characters long
if n < 8:
return "Invalid Input,\nPassword should be at least 8 characters long!"

# Chooses a random character from data_set
# after password of given length is created
# returns it to user
password = ""
for x in range(n):
password += random.choice(data_set)

return password

# Test

while True:
usr = raw_input("Exit(press e), or Length: ").lower()
if usr == "e":
sys.exit()

print("Generated password: " + generate_random_password(int(usr)) + "\n")