hashlib穷举字典破解md5,sha1
#! /usr/bin/python# -*- coding: utf-8 -*-# Filename: crackhash.py 穷举字典破解md5,sha1import sys,getopt,hashlibif len(sys.argv) == 1:print 'usage: crackhash.py -t hashtype{md5/sha1} -h hashcode -w w
·
#! /usr/bin/python # -*- coding: utf-8 -*- # Filename: crackhash.py 穷举字典破解md5,sha1 import sys,getopt,hashlib if len(sys.argv) == 1: print 'usage: crackhash.py -t hashtype{md5/sha1} -h hashcode -w wordfile' sys.exit() opts,args = getopt.getopt(sys.argv[1:],"t:h:w:") hashtype = "" hashcode = "" wordfile = "" for op,value in opts: if op == "-t": hashtype = value elif op == "-h": hashcode = value elif op == "-w": wordfile = value else: sys.exit() w = file(wordfile,'r') if hashtype =="md5": while True: line = w.readline() if line: y = hashlib.md5(line.rstrip()).hexdigest() if hashcode == y: print "md5(%s)=%s" % (line.rstrip(),y) break else: print 'NULL' break if hashtype == "sha1": while True: line = w.readline() if line: y = hashlib.sha1(line.rstrip()).hexdigest() if hashcode == y: print "sha1(%s)=%s" % (line.rstrip(),y) break else: print 'NULL' break w.close()本文章来至源码世界 http://www.ymsky.net/views/34356.shtml
更多推荐
已为社区贡献3条内容
所有评论(0)