I am having some difficulty with commenting my code for a python password cracking application, I have created. I have commented on the majority of the code however was wondering if anyone could suggest anymore comments I need as my instructor is really stick on me commenting my code.
Here is my code:
import time import string #Variables max_attempts = 999999999 #the number of attempts the system makes for a brute-force attack start = time.time() #monitors the time length chars = list(string.printable) #all the possible ascii characters which the system uses to determine the password base = len(chars) #the base for conversion n = 0 #number of attempts solved = False password = input("Enter your password:") #the feature which allows the user to enter in their chosen password print(chars) #record of previous password attempts # converts number N base 10 to a list of digits base b def numberToBase(n, b): digits =  while n: # takes n and the finds the modulus, the remainder of n % b digits.append(int(n % b)) # then it will append that to a list n //= b # following on it will then divide n into b return digits[::-1] #returns those digits into reverse order from -1, the end to the beginning # checks if the user has inputted empty text/numbers/symbols if password == '': print('Your password is empty') solved = True elif password == chars[n]: print('Your password is ' + chars[n]) solved = True else: n = 1 #Begins systematically checking the password if not solved: while n < max_attempts: list = numberToBase(n, base) print(list) word = '' for c in list: #loop through each of the characters in the list word += str(chars[c]) #adds the characters from the list to a word print(word) if password == word: #checks if the password equals to the word the system has generated solved = True # if the generation is correct the password will then commence to print statements print('***Results***') print('Password: ' + word) print('Attempts: ' + str(n)) print('Time: ' + str((time.time() - start)) + ' sec') break #stops the loop else: n += 1 #however if the password generation isn't correct, we increment with n # the password is beyond max_attempts if not solved: print('Unsolved after ' + str(n) + ' attempts!')
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!