使用python生成密码库,将字符的所有组合添加到一个文件中,可以设置密码的最大长度,我这里设置的是8位。
lshuai<---~---> bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
(95*2+95^2*3+95^3*4+95^4*5+95^5*6+95^6*7+95^7*8+95^8*9)/1024/1024/1024
56132395
python代码:
!/usr/bin/python
import string
letters = string.letters + string.digits + string.punctuation
length = len(letters)
fwrite = open("/tmp/genpass.txt","wt")
fread = open("/tmp/genpass.txt","r")
for num in xrange(8):
for times in xrange(length**num):
line=fread.read(num+1).rstrip()
for letter in letters:
fwrite.write(line + letter + "n")
fwrite.flush()
fwrite.close()
fread.close()