なんだこれは

はてなダイアリーから移転しました。

ClamdOmitScan.pl続き

昨日のClamdOmitScan.plでハードディスク全体をscanしたときの記録とかそんなもの。OSは10.4.9最新patch適用で、CPUはPPC1.2GHzで、メモリは1256MB で、HDDは30GB全体のFUJITSU MHT2030AT(純正)でjornal onでCase sensitiveなHFS+ファイルシステム

20GBの検査に一回目は306分かかっていたのが、三回目には34分になりました。

ちなみにscanning dataというファイルのscan日時その他のデータ格納には1.1GBほど消費しました。これちょっと多くない?

使用したscript

OKAMURAさんのページにあったのを改造していく。

元々、/etc/以下はscanしない設定なので、"scanning data"を/etc/ClamdOmitScandirに置くことにする。これをrootで実行してみた。/ClamXavBoxは隔離ディレクトリ。

以下をomitscan.shとしてsudo omitscan.sh /とか絶対PATHでGo!

#!/bin/sh
# This is cron-like clamscan script
# Original Author Okamura Yuji
# is based by http://homepage.mac.com/yuji_okamura/iblog/DotMac/Tips/C1181169702/E20060502200534/index.html
# 
/usr/local/bin/ClamdOmitScan.pl -r \
--data="/etc/ClamdOmitScandir" \
--stdout \
--infected \
--log="/var/log/clamav-scan.log" \
--move=/ClamXavBox \
--exclude='/clamav-[0-9]+(\.[0-9]+)*\.tar\.gz$' \
--exclude='[^/]+\.iso$' \
--exclude='[^/]+\.dmg$' \
--exclude='[^/]+\.dmg\.gz$' \
--exclude='[^/]+\.dmg\.bz2$' \
--exclude='^/+mach_kernel$' \
--exclude='^/+mach.sym$' \
--exclude='^/+mach$' \
--exclude='^/+\.hotfiles.btree$' \
--exclude-dir='^/+ClamXavBox$' \
--exclude-dir='^/+\.Spotlight_V100$' \
--exclude-dir='^/+\.vol$' \
--exclude-dir='^/+dev$' \
--exclude-dir='^/+afs$' \
--exclude-dir='^/+Network$' \
--exclude-dir='^/+Volumes$' \
--exclude-dir='^/+automount$' \
--exclude-dir='^/+Library$' \
--exclude-dir='^/+Developer$' \
--exclude-dir='^/+etc$' \
--exclude-dir='^/+var$' \
--exclude-dir='^/+private$' \
--exclude-dir='^/+var/root$' \
$*

一回目

実行すると306分。長いよ!clamscan並だよ。さて、du -skでもしてみると、scanning dataは1135760つまり1.1GB だ。これ大きくないか?

WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/sbasic.jar
WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/scalc.jar
WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/shared.jar
WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/simpress.jar
WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/swriter.jar
WARNING: Scan timeout: /Applications/OpenOffice.org 2.2.app/Contents/MacOS/help/en/sbasic.jar
WARNING: Scan timeout: /Applications/OpenOffice.org 2.2.app/Contents/MacOS/help/en/scalc.jar
WARNING: Scan timeout: /Applications/OpenOffice.org 2.2.app/Contents/MacOS/help/en/shared.jar
WARNING: Scan timeout: /Applications/OpenOffice.org 2.2.app/Contents/MacOS/help/en/simpress.jar
WARNING: Scan timeout: /Applications/OpenOffice.org 2.2.app/Contents/MacOS/help/en/smath.jar
WARNING: Scan timeout: /Applications/OpenOffice.org 2.2.app/Contents/MacOS/help/en/swriter.jar

----------- SCAN SUMMARY -----------
Start at: Fri May  4 20:50:36 2007
Server: /tmp/clamd
Engine version: ClamAV 0.90.2/3204/Fri May  4 03:46:39 2007
Inspection period: 2419200 sec (4.0 w)
Scanning data: /etc/ClamdOmitScandir
Scanned directories: 63729
Scanned files: 283926
Checked files: 0
Infected files: 0
Data scanned: 20.08 GB
Data checked: 0.00 B
Time: 18397.540 sec (306 m 37 s)

二回目(失敗)

二回目を実行すると、14分え、短っ。違う。エラーだ。全然scanしてくれない。一回目と同じ条件のはずなのになぜ?ちなみにこのまま幾度となくやってみると、ほぼ同じ1061MBぐらいで糸冬了してる。これを深追いしても仕方がないので、manを読み、オプションを追加することに。先ほどのscriptに以下を追加

WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/sbasic.jar
WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/scalc.jar
WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/shared.jar
WARNING: Scan timeout: /Applications/NeoOffice.app/Contents/help/en/simpress.jar
ERROR: Frequence of continual clamd timeout is over 3.

----------- SCAN SUMMARY -----------
Start at: Sat May  5 03:27:30 2007
Server: /tmp/clamd
Engine version: ClamAV 0.90.2/3204/Fri May  4 03:46:39 2007
Inspection period: 2419200 sec (4.0 w)
Scanning data: /etc/ClamdOmitScandir
Scanned directories: 6043
Scanned files: 4
Checked files: 31516
Infected files: 0
Data scanned: 188.16 MB
Data checked: 979.98 MB
Time: 847.385 sec (14 m 7 s)

三度目の正直

警告もアレなので、全ての値をグッと増やしておく。以下のオプションを追加。

--scan-timeout=80 \
--limit-timeout=12 \
--timeout=8 \

で終了。これでもファイルを40個/76MBもscanしているのだ。

----------- SCAN SUMMARY -----------
Start at: Sat May  5 08:50:39 2007
Server: /tmp/clamd
Engine version: ClamAV 0.90.2/3204/Fri May  4 03:46:39 2007
Inspection period: 2419200 sec (4.0 w)
Scanning data: /etc/ClamdOmitScandir
Scanned directories: 63729
Scanned files: 40
Checked files: 283900
Infected files: 0
Data scanned: 75.92 MB
Data checked: 20.01 GB
Time: 2064.012 sec (34 m 24 s)