Created
December 1, 2014 16:01
-
-
Save jaypeche/55fcecf61d9ec93be5bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Script "ClamAV Temps Réel", par HacKurx | |
| # http://hackurx.wordpress.com | |
| # Licence: GPL v3 | |
| # Dépendance: clamav-daemon inotify-tools | |
| # Recommandé pour PC de bureau: libnotify-bin | |
| DOSSIER=$HOME/Téléchargements | |
| QUARANTAINE=/tmp | |
| LOG=$HOME/.clamav-rt.log | |
| [ $EUID = 0 ] && echo -e "For security, this script must be run as simple user, exiting !" && exit 1 | |
| inotifywait -q -m -r -e create,modify,access,close_write,moved_to "$DOSSIER" --format '%w%f|%e' | sed --unbuffered 's/|.*//g' | | |
| while read FICHIER; do | |
| clamdscan --quiet --no-summary -i -m "$FICHIER" --move=$QUARANTAINE | |
| if [ "$?" == "1" ]; then | |
| beep // Beep Event sound | |
| echo "`date` - Threat found into $FICHIER. File was moved to $QUARANTAINE." >> $LOG | |
| echo -e "\033[31mThreat found : \033[00m" "'$FICHIER' was moved to quarantine." | |
| if [ -f /usr/bin/notify-send ]; then | |
| notify-send -u critical -t 20000 --icon=/home/jay/clamav/clamav-icone-4692-96.png \ | |
| "ClamAV Realtime" "1 Threat found : \n $FICHIER was moved to quarantine." | |
| fi | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment