发布原因,主要是因为国内某安全软件长期存在的引擎问题.希望本文可以让其做实质性更新.
安全软件,要给用户,使用者以安全,而不是麻烦
.具体引擎问题表现,是扫描文件,创建一拷贝,再扫描这个拷贝的文件.
即使象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