Scanvirus v1.02 stable release

Hello all. “scanvirus” is a script application that has clamscan as its anti-virus engine. It has minimal functions to learn and it only has two dependencies (udisks2 and clamav). It makes virus scans of multiple drives/devices much easier, as well as many useful commands. It requires no graphical interface, but has some optional gfx functions. It’s command line is simple and easy to use with a configuration file. It’s a has good configurable logging system.

The KDE GUI should be a stable version. It has an easy to use configuration file. Note, it’s built for KDE, but you should be able to convert it to any other system with some web-surfing.

It’s been thoroughly tested for bugs and design flaws. However, any bugs or design flaws report them here. Follow the instructions in the script. It will auto-setup any files needed. Help files should be clear enough, but if not ask questions here. Note: Mismatch notice can be nothing or something. You forget to fix permissions before copying file into scanvirus folders, only once should be normal.

Upgrading from previous versions: The easy way, delete scanvirus and scanvirus-gui configuration files. Then do command ‘scanvirus -v’. Else, manually copy the changes and add new editions from the files below. Note, CFG files may change vars over time.

There is a scanvirus gui cfg editor, but it’s more of learning tool. It will be posted later.

scanvirus v1.02 stable
https://paste.opensuse.org/pastes/04b33cfed931

sha512sum scanvirus
156e4a0bdc8bf63dd828ad106737f8e39427a7bcfc5d449375a95e7e889ed807dbe74320523bf6176f3cc9489ff0ceefd482690c6f2bb7d9dbf8586d34156378 scanvirus

scanvirus-gui v1.00 beta (recommended)
https://paste.opensuse.org/pastes/ca3d0820c7d0

sha512sum scanvirus-gui
3a6d05c4e6c06ad5dd2305ae1f0a967a0ad5c3684cc7c353e74b802f1e559307e741cb40055b24cbd99aac308eafc3d40b3b97eb243b50fffca6f0bfb4a09761 scanvirus-gui

Scan Virus
help commands
-------------
scan linux and all mounted partitions --> no auto mount + scan home and root folder clamscan fix
    p1: -a or --scanall
    p2: c   copy infected files to vault     (optional)
    p2: m   move infected files to vault     (optional) --> not recommended for linux - false positives
    p2: u   freshclam update        (optional)
    p2: l   low system priority     (optional)
    p2: h   high system priority    (optional)
    p2: n   not scan home and root  (optional)
    p2: r   recursive               (optional)
    p2: s   suspend on end          (optional)
    p2: p   shutdown on end         (optional)
    p3: w   watermark               (optional)

scan folder
    p1: -f or --scanfolder
    p2: c   copy infected files to vault     (optional)
    p2: m   move infected files to vault     (optional) --> not recommended for linux - false positives
    p2: u   freshclam update        (optional)
    p2: l   low system priority     (optional)
    p2: h   high system priority    (optional)
    p2: r   recursive               (optional)
    p2: s   suspend on end          (optional)
    p2: p   shutdown on end         (optional)
    p3: scan folder                 (optional)
    p2: scan folder

scan linux partitions - Auto Mount and Unmount
    p1: -l or --linux
    p2: c   copy infected files to vault     (optional)
    p2: m   move infected files to vault     (optional) --> not recommended for linux -  - false positives
    p2: u   freshclam update        (optional)
    p2: l   low system priority     (optional)
    p2: h   high system priority    (optional)
    p2: r   recursive               (optional)
    p2: s   suspend on end          (optional)
    p2: p   shutdown on end         (optional)
    p3: w   watermark               (optional)

scan windows partitions - Auto Mount and Unmount
    p1: -m or --mswin
    p2: c   copy infected files to vault     (optional)
    p2: m   move infected files to vault     (optional)
    p2: u   freshclam update      (optional)
    p2: l   low system priority   (optional)
    p2: h   high system priority  (optional)
    p2: r   recursive             (optional)
    p2: s   suspend on end        (optional)
    p2: p   shutdown on end       (optional)
    p3: w   watermark             (optional)

kill scanvirus - kill forground or background scan
    p1: -ksv or --killscanvirus
    p2: [null] print active scans 
    p3: cancel scan number

open virus vault - Desktop: KDE & GNOME
    p1: -vf or --viewfolder

backup logs - backup scanlogs with date and time
    p1: -bl or --backuplogs
    p2: copy --> /folder                    (optional)
    
clean logs - remove scan canceled lines
    p1: -cl or --cleanlogs

view logs
    p1: -vl or --viewlogs
    p2: l or m  mask by linux/mswin scans   (optional)
    p2: c or v  mask by clean or virus      (optional)
    p2: d       mask by date                (optional)  
    p3: year                                (optional)
    p4: month                               (optional)
    p5: day                                 (optional)

view virus reports + virus files
    p1: -vr or --viewvirusreports

view version file
    p1: -v or --version

view configuration information
    p1: -vc or --viewcfg

send folder virus vault
    p1: -sv or --sendfoldervirusvault
    p2: l        list users                      (group1)
    p2: u or m   user or mail                    (group2)
    p2: c        compress folder                 (group2)
    p3:          set folder permissions to user number
    p4:          web mail adress
    (web email offline)

view help file
    p1: -h or --help
______________________________scanvirus configuration______________________________
date +%I:%M:%S%P
date +%Y-%m-%d
TimeFormat= +%I:%M:%S%P
DateFormat= +%Y-%m-%d
______________________________________________________________________________
/bin – Core binaries
/boot – Boot files
/dev – Device files
/etc – Configuration files
/home – User personal data
/lib – Shared libraries
/media – Mount point for removable devices
/mnt – Mount directory
/opt – Optional software
/proc – Process and kernel files
/root – The home directory of the root
/run — Application State Files
/sbin – System binaries
/selinux — SELinux Virtual File System
/srv – Service data
/sys - Sysfs is a ram-based filesystem
/tmp – Temporary files
/usr – User binaries and program data
/var – Variable data files

ExcludedLinuxScanFolders= .snapshots
___________________________________________________________________________________
LINUX scan - partition file system types
LinuxFileSystems= btrfs xfs ext2 ext3 ext4
___________________________________________________________________________________
MSWIN scan - partition file system types
MswinFileSystems= ntfs vfat
___________________________________________________________________________________
Bash Suspend Command
1= 'systemctl suspend' - openSUSE, Ubuntu, Fedora, Arch, Debian, etc
2= 'pm-suspend' - Void, Gentoo, Devuan etc - pm-utils power management suite
SuspendCommand= 1
___________________________________________________________________________________
Suspend or power-off lock screen on scan end - GNOME KDE
0= off
1= on
LockScreenCommand= 1
___________________________________________________________________________________
List users group filter
UserGroupFilter= users
___________________________________________________________________________________
Watermark= Default_Text

Scan Log Format
%o  OS Type             %s  Virus Status
%f  Scan Folder         %n  Scan Time
%c  Command Options     %t  Time Stamp
%d  Date Stamp          %p  Partition Log/Excluded Scan Folders
%w  Watermark           %%  Print %
ScanLogFormat= %o %s %f %n %c %t %d %p
___________________________________________________________________________________
Scanlogs Cleaned Message - add record into scanlogs
0= off
1= on
ScanlogsCleanedMessage= 1
-----------------------------------------------------------------------------------
Scan Canceled Message Position
0= start
1= end 
ScanCanceledMessagePosition= 0
___________________________________________________________________________________
GUI system notify popup on completed scan
1= xmessage
SystemNotifyMessage= 0
___________________________________________________________________________________
Recursive scan option configuration
0= normal function
1= inverse function
RecursiveScanInverse= 1
___________________________________________________________________________________
VirusFound Zip Send Folder Email
VirusFoundZipSendEmailFrom= emailfrom@server.com
VirusFoundZipSendEmailTo= emailto@server.com
VirusFoundZipSendEmailSubject= Virus Report
_________________________________________________________________________________

I found a typo in the --version line. I should be v1.02, no beta.

I’m designing a way make scan logs that can be loaded with libre office calc.

The scanlogs are missing title bars for each field means. I’m going to create a function that will make a formatted field list sometime soon. It will show all the fields in order that they appear as a reference. You can create a new ones as you change the scanvirus cfg file. It might be possible for column alignment later.

Here’s a small update. It’s the first design of a simple add to the scanlogs fields currently in use. I’m working something a better design. I’m thinking of better design for field length.

[Virus_Status] [Scan_Folder] [Scan_Time] [Command_Options] [Time_Stamp] [Date_Stamp] [Partition_Log/Excluded_Scan_Folders]

Since, the logs are text you can just move it around as needed.

There is no way to have opensuse paste for more than 3 months. So, i’ll need to repost every 3 months, if I don’t have anything new.

scanvirus
https://paste.opensuse.org/pastes/d3726d808b4e

sha512sum scanvirus
451cad172a90a9a7913dc776296e85db58ff39e94868fd7c02986190be92f4ea965d712ae524574a0090454d618d35b1affece33f5e0441d5726936d5ed67884 scanvirus

As always, all code releases have a creative common license.

Update and Bug Fix:

This fixes the offset bug in ‘-pf’ where it’s missing a field on ‘-vl’.

New Feature:
The config file now needs a new variable.


ScanLogFieldsBar= %o %s %f %n %c %t %d %p

Watermark= Default_Text

Scan Log Format
%o OS Type %s Virus Status
%f Scan Folder %n Scan Time
%c Command Options %t Time Stamp
%d Date Stamp %p Partition Log/Excluded Scan Folders
%w Watermark %% Print %
ScanLogFormat= %o %s %f %n %c %t %d %p


This variable is specifically for adding scanlog field names line into the ‘scanlog.txt’ file. Instead of data fields, it’s the name of field used. These tags are shortcuts, but not needed to make your own line. Currently '#' - (new line) is not current coded. It’s a simple addition which should be in the next version.

Notes:
I have successfully imported ‘scanlog.txt’ into Libre Office Calc. The title lines are not neatly aligned, but the rest work with some changes to the importing rules. I’m working on the problem.

The scan_time is variable length. So, lining up text is a problem, but I can fix it.

scanvirus
https://paste.opensuse.org/pastes/ad8f9b108eaa

scanvirus
98998f0a588e0e728ff98d1d83712e1f2eea9e738f2b63c602319c7890b12a068506f5ba6abe49edc37155dbf697b43efdc039a62388f588a8f97d83d410f08f scanvirus

Here’s simple update to make scan_time field in scanlogs fixed. Scanlog options is still not fixed. Using spaces as field separators still can cause problem in importing into a calc document.

This should make scanlog columns line up better and importing to libre office calc easier.

scanvirus
https://paste.opensuse.org/pastes/cc725316c468

sha512sum
e579d7f9dfe32305b3f22823495c53f3ac986e04fc0ddec11d9c4c900e6e68d55c0a18dd9edd679669e462be98538283adfb886f3bd06fc76a38e0cc3072d418

Future update:
Configuration will allow title defaults to customize with ‘\n’ (new line option). In addition to reprinting title lines. I’ll setup a default so every field lines up neatly in scanlogs and imports into a libre office calc.

The KDE desktop GUI will be updated at a later date.

scanvirus
https://paste.opensuse.org/pastes/30340c12aa4e

sha512sum scanvirus
94ae130df8a1a418ea0d2e0e0635200efb05920920da8b15b2b35dcad3496d871aa9b95ce1f3de857e82602ba7c17c5ec6f8bdd9a35b58af09c9f7609ab49279 scanvirus

scanvirus-gui
https://paste.opensuse.org/pastes/59c36d0e38d5

sha512sum scanvirus-gui
8619abfe93eb91163c72d2fec4747f1794a765d2085b775b9a3720f3d08d9651e101eef9477432828bf22afb60418a29b1c98fd27b47f8b6ec702fd41188aca0 scanvirus-gui

This is current the version for scanvirus, no bugs known. Scanvirus-GUI still needs to tested more, but you shouldn’t have any problems with it. Report any bugs here…

The import scanvirus to libre office calc should be fully functional for the GUI. Scanvirus can now create the format needed.

scanvirus -vl i > scanvirus_import_calc.txt

libreoffice --calc scanvirus_import_calc.txt

Use space (or whatever you use) as a separator.

Notes: I had an idea to add another ‘-vl’ function. For every month change in scanlogs, it adds ‘month year’ to a line.

Here’s a handy function that adds a month year separation between month changes. It makes logs easier to read. One design flaw, It prints a month change on a scan fields line. I’ll fix that later.

‘scanvirus -vl f’

scanvirus
https://paste.opensuse.org/pastes/ba872ebd458f

sha512sum scanvirus
34ff5bd7fed64a2e7002dafcf34350a72089f385c8328a6655e4863bca6b7422667c4aa23688ae219a55e0773ea7c46d8784699896b946a1405a7d966fae9b59 scanvirus

scanvirus-gui
https://paste.opensuse.org/pastes/54fe65140d83

sha512sum scanvirus-gui
8619abfe93eb91163c72d2fec4747f1794a765d2085b775b9a3720f3d08d9651e101eef9477432828bf22afb60418a29b1c98fd27b47f8b6ec702fd41188aca0 scanvirus-gui

The ‘mismatch’ bug is a difference between any files copied into scanvirus folders or new files created by scanvirus. The fix for scanvirus files will be complex, so I’m going to put this off for while.

p2: n not scan home and root (optional)

I found myself many times, interrupting the scan before it finished with home and root folders. So, I’m designing a inverse for this.

p2: N scan only home and root (optional)

Uppercase is simple and easy to remember, but I might have another like ‘&’ or ‘!’.

I need run more tests to make sure it this works with no problems. So far, it works well.

scanvirus -a [new mask options]

M= mask linux root, but not root user folder or home folder
R= mask root folder
H= mask home folder

The use of these uppercase letters may cause problems. This form is easier to remember, but I may change it.

Update, this includes the ‘scanvirus -a’ folder masks.

scanvirus
https://paste.opensuse.org/pastes/f88adef2ec38

sha512sum scanvirus
63990b10af6e1535bd00d93d2dd9cbbcb73b9dbfc73a02ce3c56fb653847112769ef5c50285bc97b6d4ad767f467a3b6131090e2a856fe8d23d0cd4758938881 scanvirus

When I get the time, I will updating the GUI to the newest build of scanvirus. If anything is missing, let me know. Some commands have been left out for technical reasons.

As a humorous note, if you understand the cultural reference, this potential usage of scanvirus commands was totally unintentional. :grinning: :laughing:

scanvirus -a cum
scanvirus -a cuM
scanvirus -a cumM
scanvirus -a umM

Back to being serious, here is the updated scanvirus-gui. It --should-- include all newer options in scan all.

scanvirus-gui
https://paste.opensuse.org/pastes/f6448a4c1c94

sha512sum scanvirus-gui
4df2ce627187b8f711b3ea2a44d919c95ad98bb00ed8d8a9fb0bdc13ab6029f0b3eaa22cad707a2431f6e03892e94b53819972b9f657eac429cec50681aa0eaa scanvirus-gui

I am using ClamTk to run clamav. I find the GUI front end Ok but very basic with no/few controls or settings/options. From the chain of messages the script and associated GUI seems to give much better control and I would like to try it.

Could you please give some idiots help on how to use it?. Should I just download, save as a script, and allow execution?. Do I run the GUI as root which in turn runs the the main script?

Thank you

Do you mean scanvirus-gui? I never used clamtk.

Personally, I found clamscan to be awkward and lacking features I wanted. So, I created scanvirus about 10 years ago. It’s now a HUGE and complex app with so many features I can’t recall them all. :wink:

The GUI was added for the challenge. Personally, it’s so much faster to use the direct scanvirus command line, moving through lots of menus. If you don’t understand scanvirus, you’ll not understand the gui. I only use the GUI when I need to scan a flash drive. There are two different types of scanning: scanvirus partition scan and normal scan. partition scan is usually for scanning mswin partitions.

scanvirus -h

common commands:

scanvirus -vf

open scanvirus folder

scanvirus -a cuHR

normal scan all start from linux root ()
copy detected virus files to virus vault
do clamscan update
skip root and home folder

scanvirus -a ucm

Skip main files, only do home and root.

The GUI just calls scanvirus. It has cfg files for it’s own use, like first menu scans.

Great, thank you for your help.
It took me a while to find out that the “^M bash error” messages were due to additional CRs in the scanvirus script which are required by Windows but confuse Linux. I got it now working and finding my way round it.
Scanvirus-gui seems to jump straight to help mode on terminal so will take me a lit bit longer to sort out
Regards

Just download them from an earlier opensuse paste link.The easiest way is use linux.

Use file superuser mode to copy the scanvirus and scanvirus-gui files into
/usr/bin

After that, enter ‘scanvirus -v’. Let the files setup.

scanvirus -a cuHR

scanvirus -vl

scanvirus -vf open the scanvirus folder

When you learn these basic commands. Then try the scanvirus-gui do those command.

main menu → scan systems → scan all →

Select the same options as above. Keep in mind their are two separate recursive scans. R default or not R default.

MSWIN scans on a dual boot systems require you turn off ‘fast boot’.

Learn to use the scanvirus cfg file.

Thank you very much, I now have both scanvirus and the -gui up and running.
I think I will be abandoning the ClamTk GUI frontend very soon :slight_smile:
Regards,

Learn to use the scanvirus cfg and the scanvirus-gui cfg. The gui has way for to add custom scan to front menu
[title]
[scanvirus]

I repeat all the functionality, at least I think, is in the gui. For me, it’s faster for most scans to use the command line. Flash drive scans are faster to setup in the gui.

In a duel boot system from opensuse linux, this I use to scan the mswin system (make sure to turn off fast boot). This is for an overnight scan. Start scan, wait for update to finish, then unplug/disconnect from the internet.

scanvirus -m cuhp

copy update high-speed power-off.

When the scan completes, the system will shutdown. I’ve used this many times over the years. Also, note the kill scan function.

Note to all:
I’ve run out of ideas for handy functions. So, I’ll just repost the scanvirus and the scanvirus-gui every 3 months.

The mismatch function has a bug. When files are created, they have slightly different permissions from the security check. I’ll find a solution in the future. For now, just ignore it.

scanvirus
https://paste.opensuse.org/pastes/ffd804377537

sha512sum scanvirus
63990b10af6e1535bd00d93d2dd9cbbcb73b9dbfc73a02ce3c56fb653847112769ef5c50285bc97b6d4ad767f467a3b6131090e2a856fe8d23d0cd4758938881 scanvirus

scanvirus-gui
https://paste.opensuse.org/pastes/d27fd5c96bb2

sha512sum scanvirus-gui
4df2ce627187b8f711b3ea2a44d919c95ad98bb00ed8d8a9fb0bdc13ab6029f0b3eaa22cad707a2431f6e03892e94b53819972b9f657eac429cec50681aa0eaa scanvirus-gui

I found a bug in the GUI. The KDE interface will not accept folders as input. It could be a KDE bug. Once I upgrade to 15.5, I will try again.