Python's Web Path scanning Tool

Source: Internet
Author: User
Tags python list

# 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.