Git Product home page Git Product logo

ufw-stats's Introduction

ufw-stats

License: BSD 3 Clause

Show ufw actions since boot, with ip address information from RIPE database. Firewall actions are sourced from journalctl.

Usage:

▶ ufw-stats --help
Usage: ufw-stats [OPTION]...
  Show ufw actions since boot, with ip address information from RIPE database.

Options:
  -j, --json          produce JSON optput instead of plain text
  -o, --output=FILE   direct output to the FILE
  -f, --follow        tail the log (continuously print new entries)
  -n, --num-actions=N show N most recent firewall actions
  -h, --help          show this message and exit

Installation: Just copy the ufw-stats file to a directory included in the $PATH environment variable.

Output

In the default text mode the program produces one record per each firewall action, for example:

TS:     2021-02-02 11:01:53.494073+0000
ACTION: BLOCK
PROTO:  UDP
SRC:
  SCOPE:   global
  IF:      n/a
  IP:      213.230.86.36
  PORT:    29960
  HOST:    36.64.uzpak.uz
  NET:     213.230.86.0/24
  NAME:    UZTELECOM-DYNAMIC-CUSTOMERS-CGN
  DESCR:   n/a
  COUNTRY: UZ
DEST:
  SCOPE:   private
  IF:      wlp2s0
  IP:      192.168.0.6
  PORT:    53233
  HOST:    m-desktop
  NET:     192.168.0.0/24
  NAME:    n/a
  DESCR:   n/a
  COUNTRY: n/a

In JSON mode the output is a JSON array of records each equivalent to the above, for example (pretty-printed for readability):

{
  "SRC": {
    "IP": "213.230.86.36",
    "SCOPE": [
      "global"
    ],
    "HOST": "36.64.uzpak.uz",
    "NAME": "UZTELECOM-DYNAMIC-CUSTOMERS-CGN",
    "NET": "213.230.86.0/24",
    "COUNTRY": "UZ",
    "PORT": 29960
  },
  "DST": {
    "IP": "192.168.0.6",
    "SCOPE": [
      "private"
    ],
    "HOST": "m-desktop",
    "NET": "192.168.0.0/24",
    "IF": "wlp2s0",
    "PORT": 53233
  },
  "PROTO": "UDP",
  "TS": "2021-02-02T11:01:53.494073+0000",
  "ACTION": "BLOCK"
}

Status

Tested on Linux Mint 20.1 with ufw v0.36 and Python 3.8.5.

ufw-stats's People

Contributors

maxim2266 avatar

Stargazers

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

Watchers

 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.