Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to generate password Dictionary by python

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to generate a password dictionary by python". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to generate a password dictionary by python.

Password Dictionary

The so-called password dictionary, mainly used with decryption, is generally used to violently crack passwords, and is a text file composed of specified characters. If you know the law of password setting to generate a password qualitatively, it will be of decisive help to crack the password!

Second, dictionary generation 1. Generate a 6-digit lowercase letter + numeric password dictionary

The code is as follows (example):

Import itertools as itswords = 'abcdefghijklmnopqrstuvwxyz1234567890' # uses the character r = its.product (words, repeat=6) # repeat to generate a dictionary of how many bits dic = open ("pass.txt", "a") # saves for i in r: dic.write (".join (I)) dic.write (" .join ("\ r")) dic.close () 2. Select mode to run python dictionary.py defaultpython dictionary.py numonlypython dictionary.py letteronly

The code is as follows (example):

Import itertools as itsimport argparsedef run_default (length,filename): global words''words='ha' if numonly = = True: words= "1234567890" else: words= "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"' 'words= "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM" r = its.product (words,repeat=length) dic = open (filename 'a') for i in r: dic.write (".join (I)) dic.write (" .join ("\ n")) dic.close () def run_numonly (length,filename): global words words= "1234567890" r = its.product (words,repeat=length) dic = open (filename) 'a') for i in r: dic.write (".join (I)) dic.write (" .join ("\ n")) dic.close () def run_letteronly (length,filename): global words words= "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM" r = its.product (words,repeat=length) dic = open (filename) 'a') for i in r: dic.write ("" .join (I)) dic.write ("" .join ("\ n") dic.close () if _ _ name__ = = "_ _ main__": choices= {"default": run_default, "numonly": run_numonly, "letteronly": run_letteronly} parser=argparse.ArgumentParser (description=' Quick Generation password Dictionary') parser.add_argument ('model',choices=choices Help=' chooses which mode to run') parser.add_argument ('- length',metavar='length',type=int,default=3,help= "length of password in password dictionary") parser.add_argument ('- filename',metavar='filename',type=str,default='password.txt',help= "password dictionary file nickname") # parser.add_argument ('- numonly',metavar='numonly',type=bool,default=False Help= "only contains numbers") args=parser.parse_args () func=choices [args.model] func (args.length,args.filename) so far I believe you have a deeper understanding of "how to generate a password dictionary in python", so you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report