人丑话不多,代码直接上
import itertools
num = input("Please enter the password length:")
cc = int(num)
passwd = ("".join(x) for x in itertools.product("0123456789QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm!@#$%^&*().", repeat=cc))
#passwd,后面 0123456789QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm!@#$%^&*(). 是密码可能出现的字符你也可以自行进行更改的没有问题
while True:
try:
str = next(passwd)
print(str)
except StopIteration as e:
break
因为上面的代码还是要涉及到设置密码长度等问题,说实话还是很麻烦的,所以我又重新写了一个这个,可以无限滚雪球,直接所有密码都能打印出来
import itertools
def allpwd(Posc,length):
passwd = ("".join(x) for x in itertools.product(Posc, repeat=length))
while True:
try:
str = next(passwd)
print(str)
except StopIteration as e:
#print("over!")
break
def outputpwd(Posc):
i = 0
while(1 > 0):
allpwd(Posc , i )
i = i+1
outputpwd("ac")#ac就是密码可能出现的值,你修改成你需要爆破的就可以啦
当然了,如果是上面的代码是不方便别人进行二次创作的,所以还有一个也可以输出所有密码,但是这个可以二次代码创作方便点,不过都差不多,看得懂的人看第一个都能写出最后一个来
import itertools
def allpwd(Posc,length):
passwd = ("".join(x) for x in itertools.product(Posc, repeat=length))
while True:
try:
str = next(passwd)
print (str)
except StopIteration as e:
#print("over!")
break
i = 0
while(1 > 0):
allpwd("abc" , i )
i = i+1