[python]扫描网站后台脚本

#!/usr/bin/python
"""<--             The scanner to scan the admin/login path
   
                                                    by co1d7urt -->"""
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("Hostname is required")
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()
posted @ 2012-11-09 20:28  Myths  阅读(1840)  评论(0编辑  收藏  举报