A simple upload checker written in python
zip, rar, 7z, arj, tar, clamd
Download to your desired destination path. In this example, this will be
/opt/mystic/doors/chkr/
git clone https://gitlab.ambhost.net/stimpy/scripts_chkr.git /opt/mystic/doors/chkr/
wget https://gitlab.ambhost.net/stimpy/scripts_chkr/-/archive/master/scripts_chkr-master.zip
unzip -d /opt/mystic/doors/ scripts_chkr-master.zip
mv /opt/mystic/doors/scripts_chkr-master /opt/mystic/doors/chkr
chown -R root:mystic /opt/mystic/doors/chkr/
chmod -R 770 /opt/mystic/doors/chkr/
find /opt/mystic/doors/chkr/ -type f -exech chmod 640 "{}" \;
cd /opt/mystic
./mystic -cfg
(C)onfiguration
-> (F)ile Base Settings
(T)est Uploads
to yesC(o)mmand Line
to start CHKR:/opt/mystic/doors/chkr/chkr.py "%3"
While only been tested with MysticBBS so far, this is completely platform independant. You should be able to use it with any software and any os capable of starting python scripts and commit the full path and name of an uploaded file.
On or around line 21 of chkr.py, you find the variable EXITONERROR.
The number defines what's rated as an error. Add numbers to combine events.
1 - Problems deleting unwanted files
2 - Problems adding own ads
4 - Problem with clamav
8 - Virus found
10 - Virus found OR problem adding own ads
14 - Virus found OR problem starting clamav OR problem adding own ads.
The ansi graphics is actually included in the python script as a base64 encoded string. I've also included the original chkr.ans, so you can modify and customize it. When finished, encode it to base64, e.G. using the command base64 chkr.ans and replace the old string in the script (Line 52ff) with the new one, you've just created. String positions are hardcoded for now. This may change and you can change it yourself, easily. Just have a look at the sourcecode and search for calls to the function ansiHL and ansiXY. You'll find your way...
usage: chkr.py [-h] [-ns] [-nd] [-na] [-nc] [-u] [-q] filename [filename ...]
-h | --help - display help
-ns | --noscan - don't scan for viruses
-nd | --nodelete - don't delete unwanted files
-na | --noadd - don't add own ads
-nc | --noclamd - use clamscan instead of clamdscan
-u | --utf8 - convert CP437 output to UTF-8
-q | --quiet - don't display status
filename - Filename of the archive to check
(repeat for more than one file)
CHKR will return various status codes depending on the results of the check(s):
0 - Good
1 - Warning(s)
2 - Error(s)
Copyright (C) 2018-2024 Philipp Giebel stimpy <ÄT> kuehlbox.wtf
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
git clone https://gitlab.ambhost.net/stimpy/scripts_chkr.git