Coder Social home page Coder Social logo

axelhahn / clamd-syslog-watcher Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 450 KB

Bash script to watch clamd messages in syslog and send desktop notifications on new found infections

License: GNU General Public License v3.0

Shell 100.00%
bash bash-script clamav gnu-gplv3 opensource

clamd-syslog-watcher's Introduction

Clamd syslog watcher

Description

A bash script to watch the syslog for clamav messages. It shows FOUND infections on terminal. If the found file is new then it sends a notification to the desktop (using notify-send).

๐Ÿ‘ค Author: Axel Hahn
๐Ÿ“„ Source: https://github.com/axelhahn/clamd-syslog-watcher
๐Ÿ“œ License: GNU GPL 3.0
๐Ÿ“— Docs: TODO www.axel-hahn.de/docs

Help

./clamav-syslog-watcher.sh -h


  ---===<<<###|  CLAMD SYSLOG WATCHER  *  v0.2  |###>>>===--- 


HELP:
It is a cyclic watcher into journalctl and scans for clamd messages.
On detection it shows the log lines on termimal amd sends a list of
infected files to the desktop using 'notify-send'.

The script writes a log with mothly log files with 1st occurance
per infecte file. See subdir ./log/infections__*.txt

PARAMETERS:
    -h|--help     show this help
    -n|--nocolor  do not show colored output; NO_COLOR=1 is respected too.
    -q|--quiet    Do not show unneeded output
    -s|--sleep N  sleeptime in sec between checks; default: 30

EXITCODES:
    1 - Failed to source file 'color.class.sh'
    2 - unknown parameter was given
    3 - clamonacc not found (clamav was not installed yet)
    4 - unable to create log directory

EXAMPLES:
    clamav-syslog-watcher.sh -s 60   start scan and set scan interval to 60 sec
    clamav-syslog-watcher.sh -n -q   Show only found infections and no coloring

Screenshots

After starting the syslog watcher interactively:

Screenshot

When I simulate a virus detection (using the eicar test file) it will be shown in the terminal. The First detection is marked with prefix "NEW". If the same file will be detected again, you get a prefix "OLD" and gray text.

Screenshot

Any 1st detection of a new (probaly) infected file will be shown as notification:

Screenshot

Log

In the subdir "logs" a file named infections_[YEAR]-[MONTH].txt will be created.

$ cat log/infections__23-09.txt 
Sep 06 18:32:45 linux-pc clamd[570]: Wed Sep  6 18:32:45 2023 -> /home/axel/Downloads/eicar.com.txt: Win.Test.EICAR_HDB-1 FOUND

clamd-syslog-watcher's People

Contributors

axelhahn avatar

Watchers

 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.