python源码:python简单实现网站目录扫描器
原作者:飞龙321
1 #!/usr/local/bin/python 2 #-*- coding: UTF-8 -*- 3 #QQ29295842 python 网络安全编程群 138612676 希望认识更多的朋友 4 #BLOG http://hi.baidu.com/alalmn 5 import sys, os, time, httplib 6 import re 7 list_http=[] #http数组 8 9 def open_httptxt(): #打开TXT文本写入数组 10 try: 11 passlist = [] 12 list_passlist=[] 13 xxx = file('http.txt', 'r') 14 for xxx_line in xxx.readlines(): 15 #past.append(xxx_line) 16 passlist.append(xxx_line) 17 xxx.close() 18 19 for i in passlist: #python 列表去重 20 if i not in list_passlist: 21 list_passlist.append(i) 22 23 E = 0 #得到list的第一个元素 24 while E < len(list_passlist): 25 #print list_passlist[E] 26 past.append(list_passlist[E]) #添加到数组里 27 E = E + 1 28 except: 29 return 0 30 31 def pst_http(host): #获取是否开放 #pst_http("127.0.0.1") 32 try: 33 for admin in past: 34 admin = admin.replace("\n","") 35 connection = httplib.HTTPConnection(host,80,timeout=10) 36 connection.request("GET",admin) 37 response = connection.getresponse() 38 #print "%s %s %s" % (admin, response.status, response.reason) 39 #/admin-login.php ,错误404 ,Not Found /moderator/ 404 File Not Found 40 data=response.reason 41 if "OK" in data or "Forbidden" in data: 42 SQLdata="http://"+host+admin+"---%s %s"%(response.status, response.reason) 43 print SQLdata 44 else: 45 print "http://"+host+admin+"----"+data 46 connection.close() 47 return 1 48 except: 49 pass 50 return 0 51 52 if __name__=='__main__': 53 print u"=============2.0 python写的web路径扫描工具=============" 54 global past #声明全局变量 55 past = [] 56 open_httptxt() #打开TXT文本写入数组 57 pst_http("blog.csdn.net")
作者:HelloPython
提示:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
posted on 2013-05-10 23:36 hellopython 阅读(960) 评论(0) 收藏 举报
浙公网安备 33010602011771号