用了AlphaControl皮肤组件,原理很简单,就是CSDN的一个漏洞。我主要是使用WinInet来获取相关信息,然后从里面分析出真实的下载URL,同时我也是用了AES加密。
function GetWebPage(const Url: string):string;
var
Session,
Httpfile:HINTERNET;
szSizeBuffer:Pointer;
dwLengthSizeBuffer:DWord;
dwReserved:DWord;
dwFileSize:DWord;
dwBytesRead:DWord;
Contents:PChar;
begin
Session:=InternetOpen('',0,niL,niL,0);
Httpfile:=InternetOpenUrl(Session,PChar(Url),niL,0,0,0);
dwLengthSizeBuffer:=1024;
HttpQueryInfo(HttpFile,5,szSizeBuffer,dwLengthSizeBuffer,dwReserved);
GetMem(Contents,dwFileSize);
InternetReadFile(HttpFile,Contents,dwFileSize,dwBytesRead);
InternetCloseHandle(HttpFile);
InternetCloseHandle(Session);
Result:=StrPas(Contents);
FreeMem(Contents);
end;
function GetStr(StrSource, StrBegin, StrEnd: string): string;
var
stStart,stEnd:integer;
begin
stStart:=AnsiPos(strbegin,strsource)+length(strbegin);
stEnd:=AnsiPos(strend,strsource);
result:=copy(strsource,stStart,stEnd-stStart);
end;
procedure TForm1.Button1Click(Sender: TObject);
const
AdWord = '3E000000B51B13E4074D1118B04E7693AA69E83500D5BED19BE728446313287450D8D279FDDBD96622EB0F9827AE165B7596037A36C815C3AD86AD5D1D6B7B6116ACD237';
AdDes = 'www.51dev.net';
var
Csdn: string;
CsdnId: string;
Html: string;
IE: Variant;
begin
if Edit1.Text = '' then
begin
ShowMessage('ID不能为空!');
Exit;
Edit1.SetFocus;
end;
Csdn := GY.DeEncrypt_text(AdWord, AdDes);
CsdnId := Csdn + Trim(Edit1.Text);
Html := GetWebPage(CsdnId);
Html := StringReplace(Html, '\', '', [rfReplaceAll]);
Html := StringReplace(Html, '"', '', [rfReplaceAll]);
Html := GetStr(Html, 'url:', '}');
//ShowMessage(Html);
IE := CreateOleObject('InternetExplorer.Application');
IE.Visible := True;
IE.left := 0;
IE.top := 0;
IE.width := 260;
IE.Height := 200;
IE.Navigate(Html);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Web.Navigate('http://www.lsworks.net/Ad');
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9']) then
begin
ShowMessage('您输入的不是数字,请输入数字!');
Key := #0;
Edit1.SetFocus;
end;
end;
http://www.lsworks.net/article/10.html