Password Generator 01-26-2014, 08:31 AM
#1
Imports
For this project we will need "os", "random", and "string".
Definitions
You only need to define one thing for this project. The Close event.
Generator
Printing and re-generating
All we need to do now is print the password and prompt the user if they want a new one.
It's very short and simple.
Hope you liked the generator I coded. I think I am getting better everytime, especially being a Python noob.
For this project we will need "os", "random", and "string".
Code:
import os
import random
import stringDefinitions
You only need to define one thing for this project. The Close event.
Code:
def close(event):
os.system('taskkill /PID %d /F' % os.getpid())Generator
Code:
length = random.randint(8,30)
chars = string.ascii_letters + string.digits + '~!@#$%^&*()_+'
random.seed = (os.urandom(1024))Printing and re-generating
All we need to do now is print the password and prompt the user if they want a new one.
Code:
password = print("[PASSGEN]Generating password.\n[PASSGEN]Password generated:\n" + " ".join(random.choice(chars) for i in range(length)).replace(" ",""))
answer = input("[PASSGEN]Would you like to generate a new password? ")
if answer == "yes":
os.startfile("password generator.py"),close(password)
elif answer == "no":
close(password)It's very short and simple.
Code:
import os
import random
import string
import time
def close(event):
os.system('taskkill /PID %d /F' % os.getpid())
length = random.randint(8,30)
chars = string.ascii_letters + string.digits + '~!@#$%^&*()_+'
random.seed = (os.urandom(1024))
password = print("[PASSGEN]Generating password.\n[PASSGEN]Password generated:\n" + " ".join(random.choice(chars) for i in range(length)).replace(" ",""))
answer = input("[PASSGEN]Would you like to generate a new password? ")
if answer == "yes":
os.startfile("password generator.py"),close(password)
elif answer == "no":
close(password)Hope you liked the generator I coded. I think I am getting better everytime, especially being a Python noob.
![[Image: BXqGARG.png]](https://i.imgur.com/BXqGARG.png)









![[+]](https://sinister.li/images/modern/collapse_collapsed.png)









I love programming. Even though I partially suck at it. xD







![[Image: TeusoI9.png]](http://i.imgur.com/TeusoI9.png)
![[Image: jWSyE88.png]](http://i.imgur.com/jWSyE88.png)
![[Image: helper.png]](http://s8.postimg.org/cqtx6i3wl/helper.png)