# 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 list Go heavy
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 ("\ n", "")
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, error 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 Path scan Tool ============="
Global past #声明全局变量
past = []
Open_httptxt () #打开TXT文本写入数组
Pst_http ("baidu.com")
Python's Web Path scanning Tool