通行证│用户名: 密码: 验证码: 验证码,看不清楚?请点击刷新验证码 电信网通铁通移动   在线
文章搜索:
热门搜索:红客 黑鹰 红客技术 安全动画 红客培训
首页 文章 软件 动画 资源 励志 论坛 邮箱 会员 军事 科技 博客 爱心红客 最近更新 800g资源
 业内新闻 漏洞公告 病毒公告 电脑知识 网络知识 菜鸟入门 攻防教程 黑客攻防 安全编程 工具使用 综合安全 个人安全 安全相关 Q Q安全 原创精华 红客人物 站内事件
您现在的位置: 爱国者安全网 >> 文章类 >> 红客教程 >> 网络攻防 >> 文章正文
Pclxav木马猎手第一代特征码引擎源代码
责任编辑:酷酷の鱼   更新日期:2008-1-2
 

来源:安全中国

发布原因,主要是因为国内某安全软件长期存在的引擎问题,希望本文可以让其做实质性更新。 

安全软件,要给用户,使用者以安全,而不是麻烦。具体引擎问题表现,是扫描文件,创建一拷贝,再扫描这个拷贝的文件。 

即使象AVP这种杀壳专家,见到壳也不会通通脱掉。也有很大的可能直接在壳中提取病毒定义。 
源代码如下,有部分删节,因本文并不是让所有的人都来写扫描器,且此引擎亦不再使用。 

constcBuf_Size = 65536; 
var fintbuffer:pbytearray; 

procedure CheckInternalBuffer ( aPos : Integer ); 

var 
pFR : Integer; 
begin 
if (fIntBufferPos = -1 ) or (aPos < fIntBufferPos) or ((aPos+16) > 
(fIntBufferPos+cBuf_size)) 
then begin 
 
 pFR := aPos - (cBuf_size div 2); 
 if pFR < 0 
 then 
 pFR := 0; 
 fIntFile.Position := pFR; 
 fIntFile.Read ( fIntBuffer^, cBuf_Size); 
 fIntBufferPos := pFR; 
end; 
end; 
procedure FreeFile; 
begin 
 if fIntFile <> nil 
then begin 
 
 fIntFile.Free; 
 fIntFile := nil; 
end; 
end; 
function CanOpenFile ( const aName : string ) :Boolean; 
var 
fHandle : THandle ; 
begin 
Result := False; 
//ReadOnly := True; 
if FileExists ( aName ) 
then begin 
fhandle:=CreateFileA(pchar(aname ) , GENERIC_READ, FILE_SHARE_READ , 
NIL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 
 if fhandle <> INVALID_HANDLE_VALUE 
 then begin 
closehandle ( fHandle ); 
Result := True; 
 
 end; 
end; 
end; 
function LoadFromFile(const Filename: string): Boolean; 
begin 
Result := True; 

fIntFile := newreadfilestream ( filename ); 
 try 
fIntFile.Position := 0; 

 
fdatasize2:=fintfile.Size; 
fintbufferpos:=-1; 

Result := True; 
 finally 
 
end 
end; 


function Find ( aBuffer : PChar ; const aCount , aStart , aEnd : Integer 
 ) : Integer; 
 // find something in the current file and return the 
position, -1 if not found const IgnoreCase , SearchText : Boolean 
var 
//pCR : TCursor; 
pChAct : Char; 
pCMem , pCFind , pCHit , pEnd : Integer; 
begin 
Result := -1; 
pEnd := aEnd; 
 
if aCount < 1 
then 
Exit; 

if aStart + aCount > (pEnd+1) 
then 
Exit; // will never be found, if search-part is smaller than 
searched data 
try 

 pCMem := aStart; 
 PCFind := 0; 
 pCHit := pCMem+1; 

 repeat 

 if pCMem > pEnd 
 then 
 Exit; 

 CheckInternalBuffer ( pCMem ); 
 PChAct := Char(fIntBuffer [ pCMem - fIntBufferPos]); 

 if ( PChAct = aBuffer[PCFind] ) 
 then begin 
if PCFind = (aCount-1) 
then begin 
 Result := PCMem-aCount+1; 
 Exit; 
end 
else begin 
 if PCFind = 0 
 then 
 PCHit := PCMem+1; 
 Inc ( PCMem ); 
 Inc ( PCFind ); 
end; 
 end 
 else begin 
PCMem := PCHit; 
PCFind := 0; 
PCHit := PCMem+1; 
 end; 
 until False; 


finally 
// Cursor := pCR; 
end; 

end; 
function TForm1.check2(filename:string):boolean; 

const 
cHexChars = ’0123456789ABCDEF’; 
varh,n,x, 
findlen,FindPos,mypos : longint; 
up , findstr:string; 
pSTR : String; 
pCT,pCT1: integer; 
begin 
result:=false; 
findstr,mypos给值: 
 mypos:=mypoint; 
 
pSTR := ’’; 
pCT1 := Length ( findstr ) div 2; 
for pCT := 0 to (Length ( findstr ) div 2) -1 

pStr := pStr + Char ( (Pos ( findstr[pCt*2+1] , cHexChars ) -1) * 16 + 
(Pos ( findstr[pCt*2+2] , cHexChars ) -1)); 

 GetMem ( FindBuf , pCT1 ); 
try 
 
 FindLen := pCT1; 

 Move ( pStr[1] , FindBuf^, pCt1 ); 
 
 FindPos :=Find (findstr, FindBuf , FindLen ,mypos, mypos+findlen-1) 

 
if FindPos = -1 
then exit 

 else 
 
begin 

// do something! 
 result:=true; 
 exit; 

 


end; 
finally 
end; 
 end; 

支持多段定义的代码省略,无非也就是找到后再继续咯。 
支持?忽略部分字节的代码省略,无非改改函数。 
代码很乱,确实,本人一向不大喜欢排整齐,不然怎么出BUG(搞笑) 

此代码是从十六进制编辑器代码中分离的,由于原控件是为使用者编辑文件而作,所以默认是将文件拷到WINDOWS临时文件夹,再修改那个 
拷贝的文件,避免用户误操作。所以使用任何控件,还是得仔细检查源代码意图,必要时修改之,不然对使用者是不利的。 

关于国产杀软,江民不知错就改,剔除可查2000种病毒的某安全软件病毒码,就不能认为有度量; 
瑞星:如能提升国际病毒猎杀力,多多关注国外动向,还是有希望的; 
金山:不要免费赠送用户不需要的东西,未来会更好。 
国外杀软猎杀病毒能力:KAV>MCAFEE>NOD32 未知病毒猎杀力则相反。 

最后一点小小要求,望国人少使用国外多引擎检测,使得国产杀软的底气再足点吧。 

关于本文作者:jike,the2avpro(pclxav)创建者,该软件正运行着第二代特征码引擎,第三代浮动特征码引擎能不能出来尚是未知数。 

  • 上一篇文章:
  • 下一篇文章:
  • 最近更新
    固顶文章 爱国者安全网2007年度优秀版主评选
    普通文章 瑞星公司01月11日发布 每日计算机病毒及木马播报
    普通文章 破解博彩神助(专注彩票) V2.8.01
    推荐文章 推荐:跨站脚本执行漏洞代码的六点思路
    普通文章 Windows系统下的远程堆栈溢出 实战篇
    普通文章 Windows系统下的远程堆栈溢出 原理篇
    普通文章 MsSQLServer是如何加密口令的
    普通文章 浅谈国内的渗透评估过程
    普通文章 Dvbbs8.1 0DAY(通杀Access和mssql版本)
    普通文章 微软:我们的代码比赛门铁克更安全
    热门文章
    普通文章REAL蛀虫利用播放器漏洞下载恶意程序
    普通文章李彦宏:中国要在互联网领域逐渐超越美国
    普通文章马云:阿里巴巴的成功是一个生态链的成功
    普通文章Ingres用户认证非授权访问漏洞
    普通文章TCPreen FD_SET()函数远程栈溢出漏洞
    普通文章Winace UUE文件解压堆溢出漏洞
    普通文章Pclxav木马猎手第一代特征码引擎源代码
    普通文章IE收藏夹管理小精灵算法分析
    普通文章Extra Drive Pro算法分析历程
    普通文章雨过天晴自我注册
    精彩专题