I have made a basic password cracking program which tells the user in what time a basic hit and trial algorithm can crack their password.But I am getting a memory error when I am running the program, I also tried to do with adding all the data to sqlite file but that is also not working.Please help me.
My code:
from random import *
import time
import itertools
from string import *
class password_cracker():
result = 0
pswd_db = []
def __init__(self,n):
self.n = n
def input_phase(self):
self.n = input("Password: ")
def cracker(self):
data_stock = ascii_letters + digits + punctuation
pswd = ''
combs = list(itertools.permutations(data_stock, 6)) #I am getting the error here
start = time.time()
for byts in combs:
for bits in byts:
pswd += bits
pswd_db.append(pswd)
if pswd == self.n:
result = 1
break
else:
result = 0
pswd = ''
end = time.time()
total_time = end - start
def final_result(self):
if result == 0:
print('You have got an exceptional password!')
else:
print('Password cracked in ', total_time)
n = password_cracker("")
n.cracker()
In console:
Traceback (most recent call last): File "c:/Users/Soumodeep Bhowmick/Desktop/CS.IP/pws.py", line 93, in n.cracker() File "c:/Users/Soumodeep Bhowmick/Desktop/CS.IP/pws.py", line 59, in cracker combs = list(itertools.permutations(data_stock, 6)) MemoryError