• python之web路径扫描工具


    # coding: UTF-8

    import sys, os, time, httplib
    import re
    list_http=[]  #http数组

    def open_httptxt():  #打开TXT文本写入数组
        try:
            passlist = []
            list_passlist=[]
            xxx = file('http.txt', 'r')
            for xxx_line in xxx.readlines():
                #past.append(xxx_line)
                passlist.append(xxx_line)
            xxx.close()

            for i in passlist:  #python 列表去重
                if i not in list_passlist:
                    list_passlist.append(i)

            E = 0 #得到list的第一个元素
            while E < len(list_passlist):
                #print list_passlist[E]
                past.append(list_passlist[E])  #添加到数组里
                E = E + 1
        except:
            return 0

    def pst_http(host):   #获取是否开放  #pst_http("127.0.0.1")
        try:
            for admin in past:
                admin = admin.replace(" ","")
                connection = httplib.HTTPConnection(host,80,timeout=10)
                connection.request("GET",admin)
                response = connection.getresponse()
                #print "%s %s %s" % (admin, response.status, response.reason)
                #/admin-login.php   ,错误404  ,Not Found   /moderator/ 404 File Not Found
                data=response.reason
                if "OK" in data or "Forbidden" in data:
                    SQLdata="http://"+host+admin+"---%s %s"%(response.status, response.reason)
                    print SQLdata
                else:
                    print "http://"+host+admin+"----"+data
                connection.close()
            return 1
        except:
            pass
            return 0

    if __name__=='__main__':
        print u"=============python之web路径扫描工具============="
        global  past    #声明全局变量
        past = []
        open_httptxt()  #打开TXT文本写入数组
        pst_http("baidu.com")

  • 相关阅读:
    Reactor系列(四)subscribe订阅
    Reactor系列(三)创建Flux,Mono(续)
    Reactor系列(二)Flux Mono创建
    Reactor系列(一)基本概念
    Stream系列(十五)File方法使用
    Stream系列(十四)parallet方法使用
    OpenCV二值化、归一化操作
    C# 队列
    linux shell脚本程序路径作为变量
    C++中头文件(.h)和源文件(.cpp)都应该写些什么
  • 原文地址:https://www.cnblogs.com/milantgh/p/4198674.html
Copyright © 2020-2023  润新知