In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to write MD5 scripts based on python". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Development ideas
1. Automatically generate dictionaries through string module
2. Use the permutations () function to arrange all the dictionaries
3. Use md5 module to convert fully arranged dictionaries.
4. Multithreading is used to perform md5 collisions on 5-bit 18-bit strings respectively to prevent it from taking too long (although it will take a long time now).
Md5 collision function def md5_poj (self, md5_value, k): if len (md5_value)! = 32: print ("error") return md5_value = md5_value.lower () # permutations () full permutation for item in permutations (all_letters K): item = ".join (item) if item = =" hongrisec@2019 ": print (item) if md5 (item.encode ()) .hexdigest () = = md5_value: print ('\ n success:'+ md5_value +'= = >'+ item) self.__mdfive = 1
Where if len (md5_value)! = 32 determines whether the input md5 is 32-bit
Main function def main (self): NT_md5 = input ("Please fill in MD5:") start_time = time () t_list = [] print ("querying...") # add thread t_first = threading.Thread (target=self.md5_first, args= (NT_md5,)) t_first.daemon = 1 t_first.start () for k in range (5 18): t = Process (target=self.md5_poj, args= (NT_md5, k)) # t = threading.Thread (target=self.md5_poj, args= (NT_md5) K) t.daemon = 1 # daemon t_list.append (t) # start all threads for i in t_list: i.start () # end all threads when _ _ mdfive = = 1 while 1: if self.__mdfive: break Print ("\ nquery ends!") Print ('used% f seconds'% (time ()-start_time)) full code script import threadingfrom multiprocessing import Processfrom hashlib import md5from itertools import permutationsfrom string import ascii_letters, digits, ascii_lowercase, ascii_uppercasefrom time import timeall_letters = ascii_lowercase +'. @'+ digitsclass MDfive: def _ _ init__ (self): self.__mdfive = 0 def md5_poj (self, md5_value, k): if len (md5_value)! = 32: print ("error") return md5_value = md5_value.lower () # permutations () full permutation for item in permutations (all_letters K): item = ".join (item) if item = =" hongrisec@2019 ": print (item) if md5 (item.encode ()). Hexdigest () = = md5_value: print ('\ n success:'+ md5_value +'= = >'+ item) self.__mdfive = 1 # determines that md5 is No match with empty def md5_first (self Md5_firstvalue): if len (md5_firstvalue)! = 32: elif md5_firstvalue = = "31d6cfe0d16ae931b73c59d7e0c089c0": print ("\ npassword is empty!") Self.__mdfive = 1 def main (self): NT_md5 = input ("Please enter MD5:") start_time = time () t_list = [] print ("querying...") # add thread t_first = threading.Thread (target=self.md5_first, args= (NT_md5) ) t_first.daemon = 1 t_first.start () for k in range (5,18): t = Process (target=self.md5_poj, args= (NT_md5, k)) # t = threading.Thread (target=self.md5_poj, args= (NT_md5) K) t.daemon = 1 # daemon t_list.append (t) # start all threads for i in t_list: i.start () # end all threads when _ _ mdfive = = 1 while 1: if self.__mdfive: break Print ("\ nquery ends!") Print ('used% f seconds'% (time ()-start_time)) if _ _ name__ = ='_ _ main__': MDfive (). Main () "how to write MD5 scripts based on python" ends here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.