Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Python generate file with password




# -*- coding:utf-8 -*-

#IMPORT MODULE
import itertools
from itertools import islice

#FILE TO WRITE RESULT
File = "password_list.txt"


#FUNCTION GENERATE PASSWORD WORD'S
def generate():
for z in xrange(3,9):
res = itertools.product('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ@', repeat=z)
for i in res:
r = "".join(i)
yield r

#WRITE WORD IN FILE
with open(File, 'w') as f:
for s in generate():
f.write("{}\n".format(s))


#IF YOU WANT TO READ A FILE SECOND FUNCTION DO THIS
#UNCOMENT ROW FOR WORK WITH!

# with open(File, 'r') as f:
# while True:
# next_line = list(islice(f, 1000))
# if not next_line:
# break
# for line in next_line:
# print line.strip()




This post first appeared on Linux Command's, please read the originial post: here

Share the post

Python generate file with password

×

Subscribe to Linux Command's

Get updates delivered right to your inbox!

Thank you for your subscription

×