zoukankan      html  css  js  c++  java
  • 自动化审计

    尹毅大牛发了个审计系统,但是毕竟是.NET写的,不太会修改代码来实现自己想要实现的功能。

    既然想搞审计,写个脚本框架吧。

    目前的想法:

    1.如何用python扫描一个目录下的所有文件,并逐个检查文件内容?

    果然,如果没有决定要学习,事情不会进展下去:

    两段脚本:

    打印出一个文件夹下所有的php文件,包括子文件夹都列举出来:

    import os
    def main(name,*types):
        for root,dirs,files in os.walk(name):
            for f in files:
                if os.path.isfile(os.path.join(root,f)) and os.path.splitext(f)[1][1:] in types:
                    print os.path.join(root,f)
    
    if __name__ == '__main__':
        main(r"D:phpStudyWWWVuln","php")

    允许输入关键字和一个文件目录,然后从文件目录下的所有文件搜索关键字,如果搜索到,则返回文件目录:

    #-*-coding:utf-8-*-
    import os
    
    # 判断文件中是否包含关键字,是则将文件路径打印出来
    def is_file_contain_word(file_list, query_word):
        for _file in file_list:
            if query_word in open(_file).read():
                print _file
        print("Finish searching.")
    
    
    # 返回指定目录的所有文件(包含子目录的文件)
    def get_all_file(floder_path):
        file_list = []
        if floder_path is None:
            raise Exception("floder_path is None")
        for dirpath, dirnames, filenames in os.walk(floder_path):
            for name in filenames:
                file_list.append(dirpath + '\' + name)
        return file_list
    
    query_word = raw_input("Please input the key word that you want to search:")
    basedir = raw_input("Please input the directory:")
    
    is_file_contain_word(get_all_file(basedir), query_word)
    raw_input("Press Enter to quit.")

    2.如何匹配到危险函数?

    其实做到上一步,我的问题就是有哪些危险函数,然后哪些危险函数会造成哪些漏洞?

    搜索到别人的文章,用python搭建自动化代码审计的想法似乎进行不下去了。。。。

    要根据别人的思路,我们在别人的基础上做二次开发吗?

     简易的自动化代码审计平台的搭建  http://www.maxwithcoco.com/notes/building-auto-webauditor-platform

    学习进行不下去了,回到最初的目的,我们是想进行代码审计,而且是希望审计很多CMS,得出很多有漏洞的CMS。

    思路其实有两种,一种是一个个审,另一种是批量化。

    学习准备:

    在小米圈收到大佬的php的笔记,上中下。

  • 相关阅读:
    把影响集中到一个点
    How to avoid Over-fitting using Regularization?
    适定性问题
    Numerical Differentiation 数值微分
    What Every Computer Scientist Should Know About Floating-Point Arithmetic
    Generally a good method to avoid this is to randomly shuffle the data prior to each epoch of training.
    What is the difference between iterations and epochs in Convolution neural networks?
    Every norm is a convex function
    Moore-Penrose Matrix Inverse 摩尔-彭若斯广义逆 埃尔米特矩阵 Hermitian matrix
    perl 类里的函数调用其他类的函数
  • 原文地址:https://www.cnblogs.com/reborn-blog/p/7900525.html
Copyright © 2011-2022 走看看