hashlib穷举字典破解md5,sha1,hashlibsha1,初步完工,在Ubuntu
hashlib穷举字典破解md5,sha1,hashlibsha1,初步完工,在Ubuntu
初步完工,在Ubuntu 10.04 Kernel linux 3.2.6 python 2.6.5上基本测试通过。
#! /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 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' breakif 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' breakw.close()#该片段来自于http://byrx.net
相关内容
- python求素数的一句话代码 lambda实现,pythonlambda,#在交互
- 用python计算(1+2+3+4……+100),python,[Python]代码n=
- python修改操作系统时间的代码,python操作系统,#-*- cod
- python根据出生年份计算生肖的代码,python出生年份,#计
- 解数独,,[Python]代码#!
- 解24点,,[Python]代码#!
- Python program to solve an equation using Gauss elimination,equatio
- python实例 盖房子种树记好时间,python实例,[Python]代码
- python输出各位有效数字|global变量,pythonglobal,[Python]代码
- python通过socket查询whois脚本,pythonwhois,import socke
评论关闭