利用python脚本生成字典爆破
一、问题描述
在工作中遇到一个问题:测试目标网站安全性,发现目标网站的验证码采取前端更新方式,可暴力破解。但是在提交的时候是经过sha256加密的,所以,如果需要爆破的话首先得把字典里的每一行用sha256加密。就有了这篇文章。
二、Python代码实现
import hashlib dic = open("dict.txt") for password in dic.readlines(): password = password.strip('\n') crpt_pass = hashlib.sha256(password).hexdigest() crypt_dict = file("crypt.txt",'a+') crypt_dict.write(crpt_pass+'\n') crypt_dict.close() dic.close()
首先读取明文字典文件,然后加密,最后写入一个新的txt文本中。
使用Burpsuite可以完成爆破。
三、闲言碎语
验证码用过一次即销毁,服务端要做好判断。