GithubHelp home page GithubHelp logo

tilfin / detect-http-attack Goto Github PK

View Code? Open in Web Editor NEW
12.0 5.0 5.0 220 KB

Detecting attack tool for HTTP server such as Apache and Nginx.

Ruby 100.00%
nginx-log attack-detection http-logs ruby

detect-http-attack's Introduction

Detect HTTP attack

Build Status Coverage Status

It is a detecting attack tool for HTTP server such as Apache and Nginx. Analyzing access logs, output formated text as results.

To use shell pipelines easily, all I/O targets are STDIN, STDOUT and STDERR.

Prerequisites

Ruby 1.9.x

Installation

$ git clone https://github.com/tilfin/detect-http-attack.git
$ cd detect-http-attack

Quick Start

Analyze access log:

$ ./detect-http-attack.rb < /var/log/nginx/access.log

Targets eight or more consecutive senquential access:

$ ./detect-http-attack.rb -s 8 < /var/log/apache/access_log

Regarded as senquential access within 3 seconds:

$ ./detect-http-attack.rb -i 3 < /var/log/apache/access_log

Notify attack while tailing access log:

Notifying attacks whenever detecting them to STDERR, all results are output to a file.

$ tail -f /var/log/nginx/access.log | ./detect-http-attack.rb -n > attack.log

Supports LTSV Format:

Handle logs of Labeled Tab-separated Values (LTSV) format (http://ltsv.org/)

$ ./detect-http-attack.rb -ltsv < /var/log/apache/access_ltsv_log

Settings and Customize output template:

Edit the default configuration file (detect_http_attack.conf) or specify another file.

$ ./detect-http-attack.rb -f another.conf < access_log

Refer detect_http_attack.conf about the detail of template setting.

Usage:

$ ./detect-http-attack.rb --help
Usage: detect_http_attack [options]
    -ltsv                            Log type is LTSV
    -n                               notify when detecting attack
    -s COUNT                         Specify minimum sequential count
    -i SECONDS                       Specify maximum interval seconds
    -f CONFFILE                      Specify configuration file

Example

Detected attack result.

$ ./detect_http_attack.rb < /var/log/nginx/access.log
10.128.192.255   15   Mozilla/3.0 (windows)
2012-12-20T08:25:28+09:00       200     /admin/phpmyadmin/scripts/setup.php     -
2012-12-20T08:25:28+09:00       200     /wp-content/plugins/wp-phpmyadmin/phpmyadmin/scripts/setup.php  -
2012-12-20T08:25:28+09:00       200     /mysql/scripts/setup.php        -
2012-12-20T08:25:28+09:00       200     /phpmyadmin2/scripts/setup.php  -
2012-12-20T08:25:28+09:00       200     /pma/scripts/setup.php  -
2012-12-20T08:25:28+09:00       200     /phpmyadmin/scripts/setup.php   -
2012-12-20T08:25:28+09:00       200     /myadmin/scripts/setup.php      -
2012-12-20T08:25:28+09:00       200     /phpMyAdmin/scripts/setup.php   -
2012-12-20T08:25:28+09:00       200     /admin/scripts/setup.php        -
2012-12-20T08:25:28+09:00       200     /wordpress/wp-content/plugins/wp-phpmyadmin/phpmyadmin/scripts/setup.php        -
2012-12-20T08:25:28+09:00       200     /blog/wp-content/plugins/wp-phpmyadmin/phpmyadmin/scripts/setup.php     -
2012-12-20T08:25:28+09:00       200     /sql/scripts/setup.php  -
2012-12-20T08:25:28+09:00       200     /blog/phpMyAdmin/scripts/setup.php      -
2012-12-20T08:25:28+09:00       200     /wp/wp-content/plugins/wp-phpmyadmin/phpmyadmin/scripts/setup.php       -
2012-12-20T08:25:28+09:00       200     /scripts/setup.php      -

Settings

Excludes

Excludes monitaring targets

Host

exc_hosts=127.0.0.1,localhost

It is a comma separated list of hosts.

User-Agent

exc_ua_match=bot|google

It is a regular expression with ignored case.

Path

exc_path_match=\.(html|js|css|jpg|gif|png|ico)$

It is a regular expression.

Output Format

DateTime

date_format=%Y-%m-%dT%H:%M:%S

detect-http-attack's People

Contributors

tilfin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.