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-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

The content of this article mainly focuses on how python generates a password dictionary. The content of the article is clear and well-organized. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!

The code and the result of the code running:

Code:

Import itertools as itswords= "rot123" a=its.product (words,repeat=4) name=open ("pass.txt", "a") for i in a: name.write (".join (I)) name.write (" .join ("\ n")) name.close ()

Code parsing:

# Import module

Import itertools as its

# the password "element" is the character that cracked the password

Words= "rot123"

# its=itertools,repeat is the number of passwords generated

A=its.product (words,repeat=4)

# write the name of the file. "a" is opened in encryption mode.

Name=open ("pass.txt", "a")

# for Loop-equivalent to cyclic words

For i in a:

# join is to concatenate elements with specified characters to generate a new string, and what connection is used to output

Name.write ("" .join (I)) #\ n is a newline

After name.write ("" .join ("\ n")) # outputs, close closes the open file

Name.close ()

Effect picture:

What can python do Python is a programming language, built in many effective tools, Python is almost omnipotent, the language is easy to understand, easy to start, powerful, in many fields, such as the most popular big data analysis, artificial intelligence, Web development and so on.

Thank you for your reading. I believe you have a certain understanding of "how to generate a password dictionary in python". Go and practice it. If you want to know more about it, you can follow the website! The editor will continue to bring you better articles!

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