解決 ClamWin 無法更新病毒定義碼

ClamWin 是 Windows 作業系統上免費的掃毒軟體,可以安裝在個人電腦或伺服器版本環境。遇到無法從 ClamWin 直接更新病毒定義碼的問題,但是可以從瀏覽器下載病毒定義碼。透過撰寫 BASH 命令列方式,下載定義碼與完成更新。



問題狀況:

選擇 ClamWin 選單的 Download Virus Database Update (病毒定義碼) 遇到無法更新的問題 (詳細記錄檔請見備註)。ClamWin 網頁 Downloading free virus definition updates 提到病毒定義碼檔案的網址。透過瀏覽器可以順利下載,想到可以利用 BASH 命令列方式,完成下載與更新定義碼。

解決方式:
1. 安裝 CygWin
例如安裝位置是 D:\cygwin64\ (請自行修改其他安裝路徑)

2. 安裝 curl 套件 (package),安裝的操作說明可參考 如何在安裝完cygwin後補安裝套件(Install Cygwin Packages after Initial Installation) | FAQ Book

3. 新增 BAT 檔案,檔案內容
版本1: 執行 BAT 更新後,自動關閉 CygWin 視窗
D:\cygwin64\bin\mintty /bin/bash -lc "cd '/cygdrive/c/Documents and Settings/All Users/.clamwin/db/'; curl -OL http://database.clamav.net/main.cvd ; curl -OL http://database.clamav.net/daily.cvd"
D:\cygwin64\bin\mintty /bin/bash -lc "cd '/cygdrive/c/Documents and Settings/All Users/.clamwin/db/'; curl -OL http://database.clamav.net/main.cvd ; curl -OL http://database.clamav.net/daily.cvd"

版本2: 執行 BAT 更新後,不會自動關閉 CygWin 視窗
D:\cygwin64\bin\mintty /bin/bash -lc "cd '/cygdrive/c/Documents and Settings/All Users/.clamwin/db/'; curl -OL http://database.clamav.net/main.cvd ; curl -OL http://database.clamav.net/daily.cvd ; exec /bin/bash"
D:\cygwin64\bin\mintty /bin/bash -lc "cd '/cygdrive/c/Documents and Settings/All Users/.clamwin/db/'; curl -OL http://database.clamav.net/main.cvd ; curl -OL http://database.clamav.net/daily.cvd ; exec /bin/bash"
4. 利用 Windows 內建的「工作排程器」或類似軟體,設定每天自動執行 BAT 檔更新病毒定義碼。再搭配 ClamWin 內建的排程進行例行掃瞄,達到每天使用更新的病毒定義碼掃描病毒的目的。

版本資訊:
  • ClamWin Free AntiVirus version 0.99.4


參考資料:


圖片素材:
Free Photo of keys, key, lock - StockSnap.io (Thanks, Suzy Hazelwood!)

備註: Virus Database Update Report
ClamAV update process started at Wed Nov 21 18:13:39 2018
main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: getpatch: Can't download daily-25139.cdiff from database.clamav.net
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: getpatch: Can't download daily-25139.cdiff from database.clamav.net
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: getpatch: Can't download daily-25139.cdiff from database.clamav.net
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: Can't download daily.cvd from database.clamav.net
Trying again in 5 secs...
ClamAV update process started at Wed Nov 21 18:13:46 2018
main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: getpatch: Can't download daily-25139.cdiff from database.clamav.net
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: getpatch: Can't download daily-25139.cdiff from database.clamav.net
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: getpatch: Can't download daily-25139.cdiff from database.clamav.net
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: Can't download daily.cvd from database.clamav.net
Trying again in 5 secs...
ClamAV update process started at Wed Nov 21 18:13:53 2018
main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: getpatch: Can't download daily-25139.cdiff from database.clamav.net
WARNING: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
WARNING: getpatch: Can't download daily-25139.cdiff from database.clamav.net
ERROR: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
ERROR: Can't get information about database.clamav.net: Non-recoverable failure in name resolution
ERROR: Can't download daily.cvd from database.clamav.net
Giving up on database.clamav.net...
Update failed. Your network may be down or none of the mirrors listed in d:\temp\tmpy_lz6g is working. Check http://www.clamav.net/doc/mirrors-faq.html for possible reasons.
--------------------------------------
Completed
--------------------------------------



留言