通过python来获取网页状态
阅读原文时间:2023年07月10日阅读:2

#!/usr/bin/python

import sys,httplib
from optparse import OptionParser
usageString = "Usage: %prog [options] hostname"
parser = OptionParser(usage=usageString)
(opts,args) = parser.parse_args()
if len(args) < 1:
parser.error("www.baidu.com")
print __doc__
website = args[0]
#login path
dirs = ["admin","login","admin_index","admin/admin","admin/login","admin/index","admin/user"]

for line in dirs:
conn = httplib.HTTPConnection(website)
conn.request('GET','/'+line)
r1 = conn.getresponse()
if r1.status == 200 or r1.status == 301:
print "********************************Lucky?*************************************"
print website+'/'+line,r1.status,r1.reason
conn.close()
conn = httplib.HTTPConnection(website)
conn.request('GET','/'+line+'.asp')
r1 = conn.getresponse()
if r1.status == 200 or r1.status == 301:
print "********************************Lucky?*************************************"
print website+'/'+line+'.asp',r1.status,r1.reason
conn.close()
conn = httplib.HTTPConnection(website)
conn.request('GET','/'+line+'.php')
r1 = conn.getresponse()
if r1.status == 200 or r1.status == 301:
print "********************************Lucky?*************************************"
print website+'/'+line+'.php',r1.status,r1.reason
conn.close()
f.close()

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章