Giter Site home page Giter Site logo

webshellkiller's Introduction

一、相关说明:

  1. 目前Webshell的检测方法,有基于hook、统计、正则、模糊哈希、Simhash、机器学习甚至是深度学习,对了,还有AST。其中各个方法都有自己的优势,有兴趣可以查阅下相关研究。其中基于正则和Simhash的方法依赖比较少,也更方便实现的。该二者的特点是,正则检测深度大,但容易出现误报的情况,而且针对Webshell的变形是很难处理的,需要人工进行较多的干预;Simhash等特征匹配算法,特征给的准,精度要高,与基于算法类的检测方法类似,都需要较多样本。

  2. 代码倾向于给出一个框架,其检测准确度取决于特征定义与样本数量,收集样本 & 写规则吧

  3. 着重声明下:本人不做web安全这块,只是有需求才做了简单的研究。代码留着也是没用所以共享出来,留给需要的同志。本人光整理样本就花了不少时间,一个人整理,一个人去重(当然还是有重复,也有许多分类错的地方)。但有一点,对样本进行分类是很有意义的,所以凭借这点,拿样本的伙计可以star下。

  4. 敬告 样本不是本人写的,本人甚至看不懂这些代码是在干嘛~本人也没有恶意传播,只做学术研究。所以万一用这些代码搞出了事,跟本人没有任何关系。我不要你们觉得,我要我觉得。

二、代码结构:

项目采用Python3编写,用于Webshell检测的研究,各目录结构的相关介绍如下:

  • Config: 主要用于配置文件,其中yar文件为定义特征的yara文件,用以yara规则匹配;json文件用以Simhash算法匹配
  • Samples: 一方面用于测试,完善yara规则; 另一方面,用于Simhash算法匹配,样本越大Simhash效果会越来越好。
  • Source: 源码部分
    • WebshellInspector.py 采用Simhash检测,暴露有接口,而且很简单,开袋即食;
    • WebshellKiller.py 采用yara规则匹配,检测速度较快,通过完善yara规则,查杀广度大,但容易误报。暴露有接口,也简单,开袋即食;
    • WebshellMonitor.py 基于WatchDog的文件监控,提供实时的Webshell监控(检测基于a/b)
    • WebshellObserver.py 研究了NeoPI代码和文章,由于NeoPI是Python2实现的,而且复用性比较低,改写了下;暴露有接口,也简单,开袋即食;
    • WebshellDetector.py基于Inspector和Killer,针对多种格式的Webshell进行检测,同时统一了调用接口。
  • Test: 可以将文件拷贝至Test目录,用于测试Monitor实时监控的功能

三、安装及说明:

  • WebshellInspector依赖Simhash模块,安装使用命令 pip install Simhash 即可
  • WebshellKiller依赖Python Yara模块,安装使用命令 pip install yara-python 即可
  • WebshellMonitor依赖WatchDog模块,安装使用命令 pip install watchdog 即可
  • WebshellDetector简化了WebshellInspectorWebshellKiller的使用,尤其是无差别检测(jsp, aspx, php)

四、其他说明

没有时间写界面,而且其中yara,json有些规则写得还很挫,也待完善。代码提供的是通用接口,扩展能力还行,识别能力依赖规则。转载或自用最好请标注来源,这是对开发者起码的尊重。

webshellkiller's People

Contributors

fragileeye avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.