From 48f6bf9cff66607627480cd642ceae7fe349d959 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Wed, 17 Jun 2026 14:41:47 +0300 Subject: fix: remove clamav commands --- alfred/files.py | 5 ----- alfred/helpstrings.py | 6 ++---- alfred/server.py | 22 ---------------------- 3 files changed, 2 insertions(+), 31 deletions(-) (limited to 'alfred') diff --git a/alfred/files.py b/alfred/files.py index 5775bdf..5f01430 100644 --- a/alfred/files.py +++ b/alfred/files.py @@ -10,7 +10,6 @@ All commands are owner-only and work in channel or PM. !files shorten [wkfo|gumx] - shorten a URL (default: wkfo) !files mirror [wkfo|gumx] - mirror a remote URL to this instance !files prune - delete expired files from disk - !files vscan - run ClamAV scan on stored files !files remove - permanently remove a file """ @@ -145,10 +144,6 @@ def cmd_files(bot, trigger): bot.say("pruning expired files...") bot.say(_flask(bot, "prune")) - elif sub == "vscan": - bot.say("running vscan - this may take a while...") - bot.say(_flask(bot, "vscan", timeout=300)) - elif sub == "remove" and len(args) == 2: _cmd_remove(bot, args[1]) diff --git a/alfred/helpstrings.py b/alfred/helpstrings.py index e81676b..d944799 100644 --- a/alfred/helpstrings.py +++ b/alfred/helpstrings.py @@ -1,6 +1,6 @@ TOPICS = "topics: srv, bot, files, irc, coffee, vpn, list, git. type !help for details" -SRV_TOPIC = "srv: uptime disk mem load status net top topmem io conns who logs scan. type !help srv for details" +SRV_TOPIC = "srv: uptime disk mem load status net top topmem io conns who logs. type !help srv for details" SRV = { "uptime": "srv uptime: system uptime and load averages. usage: !srv uptime", "disk": "srv disk: disk usage for root. usage: !srv disk", @@ -14,7 +14,6 @@ SRV = { "conns": "srv conns: TCP connection summary. usage: !srv conns", "who": "srv who: currently logged-in users. usage: !srv who", "logs": "srv logs: last n lines from a service log. usage: !srv logs service or !srv logs service n", - "scan": "srv scan: run clamscan on a path. usage: !srv scan or !srv scan path (allowed: mail, 0x0 files, tmp, quarantine)", } BOT_TOPIC = "bot: list, all, name start stop restart status. type !help bot for details" @@ -24,14 +23,13 @@ BOT = { } BOT_NAME = "bot name: control or check a specific bot. usage: !bot name start or stop or restart or status" -FILES_TOPIC = "files: stats list shorten mirror prune vscan remove. type !help files for details" +FILES_TOPIC = "files: stats list shorten mirror prune remove. type !help files for details" FILES = { "stats": "files stats: live permanent removed count and total size. usage: !files stats", "list": "files list: last n uploads with name size and expiry. usage: !files list or !files list n", "shorten": "files shorten: shorten a URL. usage: !files shorten url or !files shorten url wkfo or gumx", "mirror": "files mirror: mirror a remote URL into this instance. usage: !files mirror url or !files mirror url wkfo or gumx", "prune": "files prune: delete all expired files from disk. usage: !files prune", - "vscan": "files vscan: run ClamAV scan on all stored files. usage: !files vscan", "remove": "files remove: permanently delete a file by filename. usage: !files remove filename", } diff --git a/alfred/server.py b/alfred/server.py index a369b88..0ed514b 100644 --- a/alfred/server.py +++ b/alfred/server.py @@ -15,7 +15,6 @@ Commands (owner only) - use !server or !srv: !server conns - TCP connection summary !server who - logged-in users !server logs [n] - last n lines of service log (default 10) - !server scan [path] - run clamscan on path (default: mail) """ import os @@ -229,26 +228,6 @@ def _who(bot, _args): bot.say(line) -def _scan(bot, args): - path = args[0] if args else "/home/ahmed/mail" - allowed = ("/home/ahmed/mail", "/var/0x0/files", "/tmp", "/var/quarantine") - if not any(path.startswith(p) for p in allowed): - bot.say(f"scan: path not allowed: {path}") - return - bot.say(f"scan: starting clamscan on {path} ...") - r = subprocess.run( - ["clamscan", "-r", "--quiet", "--infected", path], - capture_output=True, text=True, timeout=300 - ) - out = (r.stdout + r.stderr).strip() - if not out: - bot.say("scan: no infected files found") - else: - for line in out.splitlines()[:15]: - bot.say(line) - bot.say(f"scan: done (exit {r.returncode})") - - def _logs(bot, args): if not args: bot.say("usage: !srv logs [n]") @@ -284,7 +263,6 @@ _SUBCOMMANDS = { "conns": _conns, "who": _who, "logs": _logs, - "scan": _scan, } -- cgit v1.2.3