Skip to content

A bash script, which uses the Clamav open-source antivirus engine to scan a folder.

License

Notifications You must be signed in to change notification settings

SKOHscripts/linux_clamav_usb_scan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

linux-clamav_usb_scan

support

Un script shell qui utilise ClamAV®, un antivirus open-source, pour détecter les chevaux de Troie, les virus, les malwares et autres menaces.

Une initialisation permet de mettre à jour la base de donnée régulièrement améliorée par la communauté. Le script va ensuite scanner le dossier sélectionner, qui peut être /media/, dans lequel se trouvent les clefs USB et autre disques durs externes.

Pour lancer le script, ne pas oublier d'autoriser l'exécution :
chmod +x ./clamav.sh

Puis se placer dans le dossier et exécuter le script :
./clamav.sh

Et voilà, après tout se fait tout seul. Le résultat du scan sera sauvegardé dans un fichier log log_clamav.txt.

Une prochaine mise à jour permettra de choisir le dossier à scanner.


A shell script that allows to do a complete maintenance of the Linux system (under Ubuntu). Useful

A shell script that uses ClamAV®, an open-source antivirus, to detect Trojans, viruses, malware and other threats.

An initialization is used to update the database regularly enhanced by the community. The script will then scan the selected folder, which could be the /media/ folder, where USB sticks and other external hard drives are located.

To launch the script, don't forget to authorize the execution :
chmod +x ./clamav.sh

Then place yourself in the folder and execute the script:
./clamav.sh

And that's it, then everything is done by itself. The scan result will be saved in a log file log_clamav.txt.

A future update will allow you to choose the folder to scan.

#!/bin/bash

rouge='\e[1;31m'
vert='\e[1;32m'
neutre='\e[0;m'

if [ "$UID" -eq "0" ]
then
    zenity --warning --height 80 --width 400 --title "EREUR" --text "Merci de lancez le script sans sudo : \n<b>./clamav.sh</b>\nVous devrez entrer le mot de passe root par la suite."
    exit
fi

which notify-send > /dev/null
if [ $? = 1 ]
then
	sudo apt install -y libnotify-bin
fi

which zenity > /dev/null
if [ $? = 1 ]
then
	sudo apt install -y zenity
fi

which clamav > /dev/null
if [ $? = 1 ]
then
	sudo apt install -y clamav clamav-daemon
fi

    echo ""
    echo -e -n "$vert [1/2]$rouge MISE A JOUR "
    for i in `seq 20 $COLUMNS`;
        do echo -n "."
    done
    echo -e " $neutre"
    zenity --info --width=300 --height=100 --text "You will be asked to enter your sudo password twice to update the virus database."
    notify-send -i system-software-update "Clamav" "Mises à jour"
    systemctl stop clamav-freshclam
    sudo freshclam
    systemctl start clamav-freshclam
    echo " "

    echo -e -n "$vert [2/2]$rouge SCAN "
    for i in `seq 13 $COLUMNS`;
        do echo -n "."
    done
    echo -e " $neutre"
    echo > log_clamav.txt
    zenity --info --width=300 --height=100 --text "Please select the folder you want to scan."
    notify-send -i system-software-update "Clamav" "Scan"
    inputStr=$(zenity --file-selection --directory "${HOME}")
    clamscan -r --remove --bell --log=log_clamav.txt $inputStr
    echo " "

    notify-send -i dialog-ok "Clamav" "Scan terminé"

About

A bash script, which uses the Clamav open-source antivirus engine to scan a folder.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages