Categories > WeAreDevs > Hangout >
Scratch Password Generator
Posted
Ik no one asked but I made this for a school project and thought that I did pretty good and thought I would share it
https://scratch.mit.edu/projects/750317521/
Discord Contact : fatty__joe
Replied
Fire stuff vouch works as intended pretty cool
Cancel
Post
https://media.discordapp.net/attachments/1013939973671624917/1027279180192292944/unknown.png
https://media.discordapp.net/attachments/1010670716062007347/1108945330847883274/image.png
Replied
Thats Cool especially since you managed to do that in scratch
Cancel
Post
Its a me Abhidjt!
I am currently making a modified Version of WRD Template (ik nobody cares) but
https://github.com/LeontKing2/WRD-ExploitAPI-Template-Modified
Replied
I'm no scratcher but, while it does work, this is the code you used to specify how many times a character should be chosen:
https://ibb.co/KLvbXSp
+ a lot more of those same "join" blocks.
Why do that when you could do this:
https://ibb.co/FxmmMHP
EDIT: I was bored so decided to write this same thing but in Python. I explained every line using comments, so maybe this can help you learn or something? I don't know, but here it is:
import random # Imports the module for generating random numbers
pw = "" # Declaring the password variable outside of the loop so that it can be accessed globally by different instances of the loop.
wow = ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "-", "+", "="] # Declaring an "array" or list of possible characters that can be put in the password. This can be modified to add or take away more.
idx = len(wow) # idx is referring to "index", but we use that same variable name later so we'll just put this as idx. This gets the length of "wow", which is the list of possible characters. You'll see why this will be useful later on.
times = 0 # Declaring the times variable outside of the loop so that it can be accessed globally by different instance of the loop.
index = 0 # Declaring the times variable outside of the loop so that it can be accessed globally by different instances of the loop.
option = "" # Declaring the option variable outside of the loop so that it can be accessed globally by different instances of the loop.
repeat = True # Determines whether the loop of generating passwords should continue or not.
print("Generating password...") # Initial console text the user will see, which will be preceded by the generating of a password.
while repeat == True: # Declaring the loop as to which passwords will be generated.
pw = "" # Clearing the password variable so they don't generate on top of each other.
times = 0 # Clearing the times variable so that the loop can proceed without times remaining 14, which would then not allow the loop to run properly causing the password to not generate.
while times < 14: # Replicating the function of a for loop since Python doesn't have one.
index = random.randint(0, idx - 1) # Setting index to a random number between 0 and the length of the character list.
pw = pw + wow[index] # Adding the current value of pw with the character in thelist that has been selected by the randomly generated number.
times = times + 1 # Increasing the value of times by 1 so that way it will know when to stop, otherwise we'd have an infinite loop because the while condition would never be met.
print("Finished generating password.") # Printing that it finished generating. These lines of code will be run once the while loop has finished.
print("Password: " + pw) # Printing the generated password.
print("Do you want to generate another password? (Y/N)") # Asking if the user would like to generate another password.
option = input() # Getting user input.
if option == "N" or option == "n": # If they say no:
print("Thank you for using Alternate's password generator.") # Tell the user thank you and give me credits for this code.
repeat = False # Turn the repeat variable False so that the initial while loop condition will no longer be met, hence the password generator loop will be cancelled, hence no more passwords will be generated.
elif option == "Y" or option == "y": # If they say yes:
print("Generating new password...") # Simply print generating a new password and the loop will take care of the rest.
else: # If they say none of the options:
print("An appropriate answer was not inputted. Generating new password...") # Tell the user they did not input a valid answer and simply resort to generating another password.
You can pop this into an online Python compiler to test it, it works really good actually.
Cancel
Post
we are dead
Replied
Vouch, Certainly works.
Cancel
Post
"And it'll be a long time, before you ever see me again"
Random quote here...
Replied
Pretty useful. Nice release
Cancel
Post
Did I mention I use arch btw?
Added
@Alternate Thank you I will be sure to update it so its simplier also cool python im also in a class for that
Cancel
Post
Added
@Alternate Second message I just realized the code you send and it would work if you want a 2 digit code lol
Cancel
Post
Discord Contact : fatty__joe
we are dead
Discord Contact : fatty__joe
Replied
v o u c h, Epic work bro!
Cancel
Post
not really active anymore
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post