repl.it
@PythinPython/

PasswordTester

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
possiblechars = 'qwe[email protected]#$%^&*()_+[]\\{}|;\':",./<>?'
guesspassword = input('Enter your password to have it guessed (do not enter your actual password(s))\n')
#A combination with total of 804357 takes 12 seconds to calculate.
#FORMULA - (1 * 93 ** 2) + 93 ** 1 + 2
#8743
combototal = 1
reversedexponent = len(guesspassword) - 1
reversedreversedexponent = 0
while reversedexponent >= 0:
	combototal = combototal + ((possiblechars.find(guesspassword[reversedexponent]) + 1) * 93 ** reversedreversedexponent)
	reversedexponent = reversedexponent - 1
	reversedreversedexponent = reversedreversedexponent + 1
timetotal = (combototal  / 804357) * 12
print('Estimated number of combinations needed - ' + str(combototal) + '\n\nEstimated time needed (may be expressed with an "e" if the decimal is too small):\nHours - ' + str(timetotal / 60 / 60) + '\nOr Minutes - ' + str(timetotal / 60) + '\nOr Seconds - ' + str(timetotal))
skiptoggle = ''
if int(timetotal) > 740:
	skiptoggle = input('It looks like your combination will take too long. This REPL will probably crash. Would you like to skip the end? (yes or no)\n')
progresstoggle = input('Would you like to view the program in progress? (yes or no) (saying yes will make the program slower but it looks cooler. Optimal frequency would be 10^[the length of the estimate - 2])\n')
if progresstoggle == 'yes':
	progressoutputfrequency = int(input('Enter progress output frequency. (MUST BE A NUMBER)\n'))
combinationpassport = True
if len(guesspassword) > 2:
	for inspectchar in guesspassword:
		if inspectchar not in possiblechars:
			print('Invalid character detected. "' + inspectchar + '"')
			combinationpassport = False
			break
	if combinationpassport == True:
		finalresultguesses = 0
		finalresult = ''
		finalevel = 0
		totalguesses = 8743
		#Must be preset to this amount in order to account for the above 2 integer rule.
		guessedpassword = []
		digits = 3
		preinteger = 0
		preintegerprogress = 0
		guesscharlevels = [0, 0, 0]
		if skiptoggle == 'yes':
			for levelskipped in range(len(guesspassword) - len(guesscharlevels)):
				guesscharlevels.append(0)
			outsideinteger = 0
			print(guesscharlevels)
			for replacelevel in guesspassword:
				guesscharlevels[outsideinteger] = possiblechars.find(replacelevel)
				outsideinteger = outsideinteger + 1
			guesscharlevels[len(guesscharlevels) - 1] = 0
			guesscharlevels[len(guesscharlevels) - 2] = 0
			print(guesscharlevels)
			progressoutputfrequency = 1
			progresstoggle = 'yes'
			digits = len(guesscharlevels)
			print('Light speed skip prepared.')
		while True:
			for stringprep in range(digits):
				guessedpassword.append('')
			for layergeneration in range(len(possiblechars) ** len(guesscharlevels) + 1):
				for levelgeneration in range(len(guessedpassword)):
					try:
						guessedpassword[levelgeneration] = possiblechars[guesscharlevels[levelgeneration]]
					except:
						print(str(layergeneration) + ' combinations tested; Level ' + str(digits) + ' completed; Last tested string ' + str(guessedpassword))
				if progresstoggle == 'yes':
					if int(layergeneration / progressoutputfrequency) > preintegerprogress:
						print(str(layergeneration) + str(guessedpassword))
						preintegerprogress = int(layergeneration / progressoutputfrequency)
				guesscharlevels[len(guesscharlevels) - 1] = guesscharlevels[len(guesscharlevels) - 1] + 1
				testitem = len(guesscharlevels) - 1
				while testitem >= 1:
					if guesscharlevels[testitem] == len(possiblechars):
						guesscharlevels[testitem] = 0
						guesscharlevels[testitem - 1] = guesscharlevels[testitem - 1] + 1
					testitem = testitem - 1
				totalguesses = totalguesses + 1
				refinedpassword = ''
				for torefineitem in guessedpassword:
					refinedpassword = refinedpassword + torefineitem
				if refinedpassword == guesspassword:
					finalresultguesses = totalguesses
					finalresult = refinedpassword
					finalevel = len(guesscharlevels)
					break
				if int(totalguesses / 100000) > preinteger:
					if progresstoggle != 'yes':
						print(str(totalguesses) + ' combinations tested; Level ' + str(digits) + ' in progress; ' + str(int(totalguesses / combototal * 100)) + '% complete.')
						preinteger = int(totalguesses / 100000)
			if finalresult != '':
				break
			else:
				digits = digits + 1
				guessedpassword = []
				guesscharlevels = []
				for additem in range(digits):
					guesscharlevels.append(0)
		if skiptoggle != 'yes':
			print('Password has been tested! Your password "' + finalresult + '" has taken ' + str(finalresultguesses) + ' trials to test and ' + str(digits) + ' levels to complete!\n\n\n')
		else:
			print('Password has been tested! Your password "' + finalresult + '" has taken ABOUT ' + str(finalresultguesses) + ' trials to test FROM SKIP and ABOUT ' + str(digits) + ' levels to complete FROM SKIP!\n' + 'So the total amount of guesses needed was actually ABOUT - ' + str(combototal) + '\n\n\n')
else:
	print('How is your password that long. If it is that short then you are doomed.')
?