- 论坛徽章:
- 0
|
不多说了,随便玩玩……
默认用当前目录下的sig特征库……(随便找个文件夹放样本)
可以工作在windows、linux等平台……
#!/usr/bin/perl -w
die "Usage: AVScan.pl sample_derectory\n" if(@ARGV!=1);
open SIG,"<SIG"[ color][color="#0000CC];
chdir $ARGV[0] or die "Can't open the sample derectory !\n";
while(<SIG>)
{
s/\x0D//;
if(/^(.*):1:\*:(.*)$/)
{
push @name,$1;
$line_sig=$2;
$line_sig=~s#(.{2})#\\x$1#g;
push @sig,$line_sig;
}
}
foreach (<*>)
{
open FILE,$_ or (warn "Can't load $_ !\n"),next;
$sample_name=$_;
@sample=<FILE>;
$sample_str=join '',@sample;
$i=0; #the sig index
foreach (@sig)
{
if($sample_str=~/$_/)
{
printf("%-25s FOUND!Infected with $name[$i]\n",$sample_name);
last;
}
else
{ $i++;}
}
printf("%-25s NOT FOUND!\n",$sample_name) if($i==@sig);
} |
[ 本帖最后由 wellfroggy 于 2008-8-14 20:50 编辑 ] |
|