All Projects → nbs-system → nxtool-ng

nbs-system / nxtool-ng

Licence: other
Because life is too short to waste your time transforming naxsi logs to rules by hand

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to nxtool-ng

Naxsi
NAXSI is an open-source, high performance, low rules maintenance WAF for NGINX
Stars: ✭ 3,927 (+9717.5%)
Mutual labels:  waf, naxsi
openresty-project-v0.01
🌹 基于OpenResty编写一个MVC模式的WEB项目 V0.01
Stars: ✭ 40 (+0%)
Mutual labels:  waf
Sks
Security Knowledge Structure(安全知识汇总)
Stars: ✭ 205 (+412.5%)
Mutual labels:  waf
shieldfy-php-client
The official PHP SDK for Shieldfy
Stars: ✭ 15 (-62.5%)
Mutual labels:  waf
Autosqli
An automatic SQL Injection tool which takes advantage of ~DorkNet~ Googler, Ddgr, WhatWaf and sqlmap.
Stars: ✭ 222 (+455%)
Mutual labels:  waf
waf-brain
Machine Learning WAF Based
Stars: ✭ 74 (+85%)
Mutual labels:  waf
Docker Waf
An NGINX and ModSecurity based Web Application Firewall for Docker
Stars: ✭ 181 (+352.5%)
Mutual labels:  waf
roxy-wi
Web interface for managing Haproxy, Nginx, Apache and Keepalived servers
Stars: ✭ 1,109 (+2672.5%)
Mutual labels:  waf
wafbypasser
No description or website provided.
Stars: ✭ 73 (+82.5%)
Mutual labels:  waf
airlock-waf-kubernetes-openshift-integration
Integrate Airlock WAF in a Kubernetes or OpenShift Environment
Stars: ✭ 12 (-70%)
Mutual labels:  waf
waflab
A web-based testing platform for WAF (Web Application Firewall)'s correctness
Stars: ✭ 25 (-37.5%)
Mutual labels:  waf
Secbox
🖤 网络安全与渗透测试工具导航
Stars: ✭ 222 (+455%)
Mutual labels:  waf
encode-me
Payload encoder for bypass WAF
Stars: ✭ 14 (-65%)
Mutual labels:  waf
Wafw00f
WAFW00F allows one to identify and fingerprint Web Application Firewall (WAF) products protecting a website.
Stars: ✭ 2,983 (+7357.5%)
Mutual labels:  waf
aws-firewall-factory
Deploy, update, and stage your WAFs while managing them centrally via FMS.
Stars: ✭ 72 (+80%)
Mutual labels:  waf
Wafpass
Analysing parameters with all payloads' bypass methods, aiming at benchmarking security solutions like WAF.
Stars: ✭ 184 (+360%)
Mutual labels:  waf
ingress
Kubernetes Ingress controller with integrated Wallarm services
Stars: ✭ 31 (-22.5%)
Mutual labels:  waf
phpwaf-phanalyzer
AliGuard PHP WAF
Stars: ✭ 12 (-70%)
Mutual labels:  waf
PoW-Shield
Project dedicated to fight Layer 7 DDoS with proof of work, featuring an additional WAF. Completed with full set of features and containerized for rapid and lightweight deployment.
Stars: ✭ 99 (+147.5%)
Mutual labels:  waf
releases-openstar-Enterprise
releases-openstar-Enterprise
Stars: ✭ 53 (+32.5%)
Mutual labels:  waf

Coverage Status Code Health Code Climate Build Status

              __                __                  
.-----.--.--.|  |_.-----.-----.|  |____.-----.-----.
|     |_   _||   _|  _  |  _  ||  |____|     |  _  |
|__|__|__.__||____|_____|_____||__|    |__|__|___  |
                                             |_____|

 -- Because life is too short to transform naxsi logs into rules by hand.

nxtool-ng is a tool to magically transform your naxsi logs into useful rules. It can get its data from your elastic instance, or you can feed it flat files, and it will magically show you some statistics, generate relevant whitelists, provide type-based rules, …

It works with modules, that are generating whitelists, without overlapping each other.

Proudly powered by Python (2 and 3 by the way), using (optionally) elasticsearch-dsl, written with love and tears by the great people of NBS-System, nxtool-ng is released under the GPL.

Installation

Nxtool-ng depends on nxapi for naxsi-related magic, and optionally on elasticsearch-dsl if you want to generate rules from an Elastic instance. You can install them with

Elasticsearch 5.x

pip install -r ./requirements-v5.txt

Elasticsearch 2.x

pip install -r ./requirements-v2.txt

Elasticsearch 1.x

pip install -r /requirements-v1.txt

Usage

$ python nxtool.py -h
usage: nxtool.py [-h] [-v] [--elastic] [--flat-file] [--stdin] [--archive]
                 [--typing] [--whitelist] [--filter FILTER] [--stats]
                 [hostname]

Sweet tool to help you managing your naxsi logs.

positional arguments:
  hostname

optional arguments:
  -h, --help       show this help message and exit
  -v, --verbose

Log sources:
  --elastic-source
  --flat-file
  --stdin

Actions:
  --typing
  --whitelist
  --elastic-dest
  --filter FILTER
  --stats
  --slack

First you can populate an elasticsearch instance by:

$ python nxtool.py --elastic-dest --flat-file example.com.log

For example, if you want some stats about example.com using your elasticsearch instance:

$ python nxtool.py --elastic-source --stats example.com
2.39.218.24: 14
14.76.8.132: 18
13.24.13.122: 8
157.5.39.176: 13
19.187.104.23: 8
80.24.150.43: 21
50.2.176.10: 198
79.14.72.145: 44
14.26.23.213: 80
86.242.8.36: 58

# URI #
/cache.php: 12
/11.php: 12
/call-for-paper-contact/: 82
/: 22
/xmlrpc.php: 22
/en/production/type.asp: 41
/contact/: 21
/wp-json/oembed/1.0/embed: 38
/en/production/formation.asp: 68
/totallylegit/: 14

# ZONE #
BODY: 276
ARGS|NAME: 24
URL: 22
ARGS: 146
HEADERS: 54
BODY|NAME: 10
FILE_EXT: 4

# SERVER #
example.com: 536

To generate some whitelists for example.com, using your elasticsearch instance:

$ python nxtool.py --elastic-source --whitelist example.com
[+] Generating Google analytics rules
[+] Generating Image 1002 rules
[+] Generating cookies rules
[+] Generating var + zone rules
[+] Generating site rules
[+] Generating zone rules
[+] Generating url rules

Generated whitelists:
	BasicRule wl:1310,1311 "mz:$HEADERS_VAR:cookie" "msg:Cookies";

You can add the --verbose flag if you want more information about what's going on. If you're using flat files, you can either pass, well flat files, but also archives, like .zip or .tar.gz.

You can add the --slack flag if you want loosen constraints on whitelist generation. It can be useful with only little amount of logs.

You can also use nxtool-ng to query your elasticsearch instance, for example to search for access to /admin, that triggered the rule 1010 in the HEADERS:

$ python nxtool.py --elastic-source --filter 'uri=/admin,zone=HEADERS,id=1010'

zone: HEADERS
ip: 133.144.211.172
whitelisted: false
uri: /admin
comments: import:2016-08-30 09:44:17.938620
server: example.com
content: 
var_name: cookie
country: 
date: 2016-08-30T09:45:13+0200
id: 1010

zone: HEADERS
ip: 15.125.251.122
whitelisted: false
uri: /admin
comments: import:2016-08-30 11:00:03.523580
server: example.com
content: 
var_name: cookie
country: 
date: 2016-08-30T11:06:36+0200
id: 1010

It's also possible to type your parameters, to tighten a bit the security of your application:

$ python nxtool.py --elastic-source --typing --verbose example.com

Generated types:

BasicRule negative "rx:^$" "msg:empty" "mz:FILE_EXT:user_avatar" "s:BLOCK";
BasicRule negative "rx:^$" "msg:empty" "mz:FILE_EXT:society_logo" "s:BLOCK";
BasicRule negative "rx:^https?://([0-9a-z-.]+\.)+[\w?+-=&/ ]+$" "msg:url" "mz:ARGS:url" "s:BLOCK";

Note on the structure of ElasticSearch entries

Each core rule violation is logged in a NAXSI_FMT entry. Each violation is reported once in the ElasticSearch instance. Types in the used elasticsearch entries are enforced:

    ip = Ip
    coords = GeoPoint
    learning = Boolean
    total_processed = Integer
    total_blocked = Integer
    blocked = Boolean
    cscore0 = Keyword
    score0 = Integer
    zone = Keyword
    id = Integer
    var_name = Keyword
    date = Date
    whitelisted = Boolean
    uri = Text
    server = Text
    comments = Text
    vers = Text

First term is the key used in NAXSI_FMT and second term is the defined ElasticSearch type. Text is used as a backward compatible version of Keyword. We may drop the support of old elasticsearch version in the near future and replace Text with Keyword.

It is noteworthy that one request might violate multiple core rule and lead to multiple entries in ElasticSearch.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].