最近工作变动,目前稳定了,现在继续学习哈哈
昨天爆破需要用到字典,而且要逐行加密成md5,就写了下面的小脚本,从1.txt打开原密码,可以逐行进行md5....
要点:如果直接加密是不行的因为每行后面有\n或者空格,所以使用a[i].strip()去一下就好了.
#coding=utf-8 import hashlib f = open("1.txt","r") a = f.readlines() for i in range(len(a)): m2 = hashlib.md5() a[i] = a[i].strip() m2.update(a[i].encode(encoding='utf-8')) a[i] = m2.hexdigest() # print(a[i]) n = open('result.txt','wt') for q in range(len(a)): n.write(a[q]+'\n') n.close()
例子:
1.txt
admin
123
asdsadasd
dsadsa
3
4124
10
10
24a
asfa
结果:
395257a42c5b9691c9693cf7c36f89a4
d829b843a6550a947e82f2f38ed6b7a7
202cb962ac59075b964b07152d234b70
396ac2a33748bb784077f4112335faa0
c91c03ea6c46a86cbc019be3d71d0a1a
eccbc87e4b5ce2fe28308fd9f2a7baf3
7dc3338d429a3114842ca29dbbfccfef
d3d9446802a44259755d38e6d163e820
d3d9446802a44259755d38e6d163e820
f34d4aca94ce5e5d965ae4d2bfb1b793
9fa16ee8683740b1883e5844d8c288ac
d41d8cd98f00b204e9800998ecf8427e
找一个验证下:asfa 结果是对的
ing=utf-8import hashlibprint ('[+]runing...')sleep(5)f = open("1.txt","r") a = f.readlines()for i in range(len(a)):m2 = hashlib.md5() a[i] = a[i].strip()m2.update(a[i].encode(encoding='utf-8')) a[i] = m2.hexdigest()print(a[i])n = open('result.txt','wt')for q in range(len(a)):n.write(a[q]+'\n')n.close()