[web 安全] 源码泄露

web 源码泄露
1、.hg 源码泄露
http://www.example.com/.hg/

2、.git 源码泄露
http://www.example.com/.git/config

3、.ds_store 源码泄露
http://www.example.com/.ds_store

4、svn 源码泄露
http:/www.example.com/.svn/entries

5、cvs 源码泄露
http://www.example.com/CVS/Root
http://www.example.com/CVS/entries

6、WEB-INF/web.xml 泄露
/WEB-INF/web.xml:Web应用程序配置文件,描述了 servlet 和其他的应用组件配置及命名规则。
/WEB-INF/classes/:含了站点所有用的 class 文件,包括 servlet class 和非servlet class,他们不能包含在 .jar文件中
/WEB-INF/lib/:存放web应用需要的各种JAR文件,放置仅在这个应用中要求使用的jar文件,如数据库驱动jar文件
/WEB-INF/src/:源码目录,按照包名结构放置各个java文件。
/WEB-INF/database.properties:数据库配置文件

7、备份文件泄露
数据库备份、源码备份

python简易脚本检测:

# -*- coding: utf-8 -*-
import requests

URL = "http://www.example.com"
URL_DICT = {'hg':['/.hg/'],'git':['/.git/config'],'ds_store':['/.ds_store'],'svn':['/.svn/entries'],'cvs':['/CVS/Root']};
URL_BUG = []

def request(url):
    try:
        r = requests.get(url,timeout=3)
        if r.status_code == 200:
            URL_BUG.append(url)
            print url + "...............................unsafe"
        else:
            print url + "...............................safe"
    except:
        print url,"...............................timeout"

for k in URL_DICT:
        for i in range(len(URL_DICT[k])):
            url = URL+URL_DICT[k][i]
            request(url) 
if URL_BUG:
    print URL_BUG
else:
    print "not fund"

原文地址:https://www.cnblogs.com/natian-ws/p/7444358.html